Release v0.0.3

main
svalouch 3 years ago
parent 83fcbb1053
commit cc3ea0b302

@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
## Release 0.0.4 - Unreleased ## Release 0.0.4 - Unreleased
## Release 0.0.3 - Unreleased ## Release 0.0.3 - 2021-11-26
**Features** **Features**
@ -24,6 +24,12 @@ All notable changes to this project will be documented in this file.
- Fix pytest deprecation warning - Fix pytest deprecation warning
## Release 0.0.2 ## Release 0.0.2 - 2020-11-03
**Bugfixes**
- `PropertySource` now propertly handles `inherited` properties which specify the dataset they inherit their value from.
## Release 0.0.1 - 2020-10-07
It spawned like this out of thin air. It spawned like this out of thin air.

@ -0,0 +1 @@
../CHANGELOG.md

@ -8,6 +8,9 @@ Enumerations
.. autoclass:: simplezfs.types.DatasetType .. autoclass:: simplezfs.types.DatasetType
:members: :members:
.. autoclass:: simplezfs.types.PEHelperMode
:members:
.. autoclass:: simplezfs.types.PropertySource .. autoclass:: simplezfs.types.PropertySource
:members: :members:

@ -10,10 +10,11 @@
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
# #
# import os import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Read-the-docs specifics -------------------------------------------------
on_rtd = os.environ.get('READTHEDOCS') == 'True'
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
@ -22,7 +23,7 @@ copyright = '2019-2020, Andreas Gonschorek, Stefan Valouch'
author = 'Andreas Gonschorek, Stefan Valouch' author = 'Andreas Gonschorek, Stefan Valouch'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = '0.0.2' release = '0.0.3'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
@ -34,6 +35,7 @@ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'sphinx.ext.todo', 'sphinx.ext.todo',
'sphinx_autodoc_typehints', 'sphinx_autodoc_typehints',
'recommonmark',
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.

@ -171,8 +171,8 @@ return information about the internal states (like ``creation`` time).
.. note:: The python library does not validate the names of native properties, as these are subject to change with the .. note:: The python library does not validate the names of native properties, as these are subject to change with the
ZFS version and it would mean that the library needs an update every time a new ZFS version changes some of ZFS version and it would mean that the library needs an update every time a new ZFS version changes some of
these. Thus, it relies on validating the input for syntax based on the ZFS documentation of the ZFS on Linux these. Thus, it relies on validating the input for syntax based on the ZFS documentation of the OpenZFS
(ZoL) project and ZFS telling it that it did not like a name. project and ZFS telling it that it did not like a name.
A word on metadata/user properties A word on metadata/user properties
---------------------------------- ----------------------------------

@ -23,11 +23,5 @@ At the time of writing, the ``native``-API has not been implemented.
properties_metadata properties_metadata
testing testing
api api
CHANGELOG
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

@ -1,3 +0,0 @@
Sphinx>=2.0
sphinx-autodoc-typehints
sphinx-rtd-theme

@ -27,20 +27,23 @@ setup(
platforms='any', platforms='any',
python_requires='>=3.6', python_requires='>=3.6',
# install_requires=[ install_requires=[
# ], 'typing_extensions ; python_version < "3.8"',
],
extras_require={ extras_require={
'tests': [ 'tests': [
'flake8',
'mypy', 'mypy',
'pylint',
'pytest', 'pytest',
'pytest-cov', 'pytest-cov',
'pytest-pylint',
], ],
'docs': [ 'docs': [
'Sphinx>=2.0', 'Sphinx>=2.0',
'sphinx-autodoc-typehints', 'sphinx-autodoc-typehints',
'sphinx-rtd-theme', 'sphinx-rtd-theme',
'recommonmark>=0.5.0',
], ],
}, },

@ -93,8 +93,6 @@ class ZFS:
@metadata_namespace.setter @metadata_namespace.setter
def metadata_namespace(self, namespace: str) -> None: def metadata_namespace(self, namespace: str) -> None:
''' '''
Sets a new metadata namespace
:todo: validate! :todo: validate!
''' '''
self._metadata_namespace = namespace self._metadata_namespace = namespace
@ -102,15 +100,12 @@ class ZFS:
@property @property
def pe_helper(self) -> Optional[PEHelperBase]: def pe_helper(self) -> Optional[PEHelperBase]:
''' '''
Returns the pe_helper, which may be None if not set. Returns or changes the privilege escalation (PE) helper. A value of ``None`` means none set.
''' '''
return self._pe_helper return self._pe_helper
@pe_helper.setter @pe_helper.setter
def pe_helper(self, helper: Optional[PEHelperBase]) -> None: def pe_helper(self, helper: Optional[PEHelperBase]) -> None:
'''
Sets the privilege escalation (PE) helper. Supply ``None`` to unset it.
'''
if helper is None: if helper is None:
log.debug('PE helper is None') log.debug('PE helper is None')
self._pe_helper = helper self._pe_helper = helper
@ -119,12 +114,15 @@ class ZFS:
@property @property
def use_pe_helper(self) -> bool: def use_pe_helper(self) -> bool:
''' '''
Returns whether the privilege escalation (PE) helper should be used. If the helper has not been set, this Returns or sets whether the privilege escalation (PE) helper should be used. If the helper has not been set,
property evaluates to ``False``. reading the property returns ``False``.
.. deprecated:: 0.0.3 .. deprecated:: 0.0.3
Use :func:`~simplezfs.zfs.pe_helper_mode` instead. Returns whether the helper mode is **not** set to Use :func:`~simplezfs.zfs.ZFS.pe_helper_mode` instead. Returns whether the helper mode is **not** set to
``PEHelperMode.DO_NOT_USE`` if the helper is set. ``PEHelperMode.DO_NOT_USE`` if the helper is set. If set to ``False``, sets the mode to
:attr:`~simplezfs.types.PEHelperMode.DO_NOT_USE`, ``True`` sets it to
:attr:`~simplezfs.types.PEHelperMode.USE_IF_REQUIRED` unless it is already set to
:attr:`~simplezfs.types.PEHelperMode.USE_PROACTIVE`, in which case it will do nothing.
This property will be removed in 0.0.4! This property will be removed in 0.0.4!
''' '''
@ -135,16 +133,6 @@ class ZFS:
# TODO remove this in 0.0.4 # TODO remove this in 0.0.4
@use_pe_helper.setter @use_pe_helper.setter
def use_pe_helper(self, use: bool) -> None: def use_pe_helper(self, use: bool) -> None:
'''
Enable or disable using the privilege escalation (PE) helper.
.. deprecated:: 0.0.3
Use :func:`~simplezfs.zfs.pe_helper_mode` instead. If set to ``False``, sets the mode to
``PEHelperMode.DO_NOT_USE``, ``True`` sets to ``PEHelperMode.USE_IF_NEEDED`` unless it is set to
``PEHelperMode.USE_PROACTIVE`` already, in which case it will do nothing.
This property will be removed in 0.0.4!
'''
if use: if use:
if self.pe_helper_mode == PEHelperMode.DO_NOT_USE: if self.pe_helper_mode == PEHelperMode.DO_NOT_USE:
self.pe_helper_mode = PEHelperMode.USE_PROACTIVE self.pe_helper_mode = PEHelperMode.USE_PROACTIVE
@ -157,8 +145,8 @@ class ZFS:
@property @property
def pe_helper_mode(self) -> PEHelperMode: def pe_helper_mode(self) -> PEHelperMode:
''' '''
Returns whether the privilege escalation (PE) helper should be used and when. If the helper has not been set, Returns or sets whether the privilege escalation (PE) helper should be used and when. If the helper has not
this property evaluates to ``False``. been set, this property evaluates to ``False``.
.. versionadded:: 0.0.3 .. versionadded:: 0.0.3
''' '''
@ -168,11 +156,6 @@ class ZFS:
@pe_helper_mode.setter @pe_helper_mode.setter
def pe_helper_mode(self, mode: PEHelperMode) -> None: def pe_helper_mode(self, mode: PEHelperMode) -> None:
'''
Sets the privilege escalation (PE) helper mode.
.. versionadded:: 0.0.3
'''
self._pe_helper_mode = mode self._pe_helper_mode = mode
def dataset_exists(self, name: str) -> bool: def dataset_exists(self, name: str) -> bool:
@ -424,7 +407,7 @@ class ZFS:
no default has been set, format the key using ``namespace:key``. no default has been set, format the key using ``namespace:key``.
:return: Info about the newly created dataset. :return: Info about the newly created dataset.
:raises ValidationError: If validating the parameters failed. :raises ValidationError: If validating the parameters failed.
:raises DatasetNotFOund: If the dataset can't be found. :raises DatasetNotFound: If the dataset can't be found.
''' '''
return self.create_dataset( return self.create_dataset(
f'{dataset}@{name}', f'{dataset}@{name}',
@ -477,7 +460,7 @@ class ZFS:
parameter for ``zfs create``. parameter for ``zfs create``.
:return: Info about the newly created dataset. :return: Info about the newly created dataset.
:raises ValidationError: If validating the parameters failed. :raises ValidationError: If validating the parameters failed.
:raises DatasetNotFOund: If the parent dataset can't be found and ``recursive`` is `False`. :raises DatasetNotFound: If the parent dataset can't be found and ``recursive`` is `False`.
''' '''
if mountpoint is not None: if mountpoint is not None:
if properties is None: if properties is None:
@ -510,10 +493,10 @@ class ZFS:
.. note:: .. note::
Please read the note in :func:`~simplezfs.ZFS.create_filesystem` for permission handling for filesystems. Please read the note in :func:`~simplezfs.zfs.ZFS.create_fileset` for permission handling for filesystems.
Generally, if the user does not have permission to set certain properties, the dataset may or may not have Generally, if the user does not have permission to set certain properties, the dataset may or may not have
been created but is missing the properties. It is up to the user of the library to clean up after been created but is missing the properties. It is up to the user of the library to clean up after catching a
catching a :class:`+simplezfs.exceptions.PermissionError`. :class:`~simplezfs.exceptions.PermissionError`.
:param name: Name of the new volume (complete path in the ZFS hierarchy). :param name: Name of the new volume (complete path in the ZFS hierarchy).
:param size: The size (in `bytes`) for the new volume. :param size: The size (in `bytes`) for the new volume.

Loading…
Cancel
Save