mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-06-05 01:33:00 +03:00
allow to only select parent dataset, non-recursively. (usefull for /var/lib/docker )
This commit is contained in:
parent
4d3aa6da22
commit
564daaa1f8
@ -146,6 +146,11 @@ test_target1
|
|||||||
shelltest("zfs create test_source1/fs1/subexcluded")
|
shelltest("zfs create test_source1/fs1/subexcluded")
|
||||||
shelltest("zfs set autobackup:test=false test_source1/fs1/subexcluded")
|
shelltest("zfs set autobackup:test=false test_source1/fs1/subexcluded")
|
||||||
|
|
||||||
|
# only select parent
|
||||||
|
shelltest("zfs create test_source1/fs1/onlyparent")
|
||||||
|
shelltest("zfs create test_source1/fs1/onlyparent/child")
|
||||||
|
shelltest("zfs set autobackup:test=parent test_source1/fs1/onlyparent")
|
||||||
|
|
||||||
# should be excluded by being unchanged
|
# should be excluded by being unchanged
|
||||||
shelltest("zfs create test_source1/fs1/unchanged")
|
shelltest("zfs create test_source1/fs1/unchanged")
|
||||||
shelltest("zfs snapshot test_source1/fs1/unchanged@somesnapshot")
|
shelltest("zfs snapshot test_source1/fs1/unchanged@somesnapshot")
|
||||||
@ -158,6 +163,7 @@ test_target1
|
|||||||
|
|
||||||
# basics
|
# basics
|
||||||
self.assertEqual(s, """[(local): test_source1/fs1,
|
self.assertEqual(s, """[(local): test_source1/fs1,
|
||||||
|
(local): test_source1/fs1/onlyparent,
|
||||||
(local): test_source1/fs1/sub,
|
(local): test_source1/fs1/sub,
|
||||||
(local): test_source2/fs2/sub]""")
|
(local): test_source2/fs2/sub]""")
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class CliBase(object):
|
|||||||
Overridden in subclasses that add stuff for the specific programs."""
|
Overridden in subclasses that add stuff for the specific programs."""
|
||||||
|
|
||||||
# also used by setup.py
|
# also used by setup.py
|
||||||
VERSION = "3.2-alpha2"
|
VERSION = "3.2-beta1"
|
||||||
HEADER = "{} v{} - (c)2022 E.H.Eefting (edwin@datux.nl)".format(os.path.basename(sys.argv[0]), VERSION)
|
HEADER = "{} v{} - (c)2022 E.H.Eefting (edwin@datux.nl)".format(os.path.basename(sys.argv[0]), VERSION)
|
||||||
|
|
||||||
def __init__(self, argv, print_arguments=True):
|
def __init__(self, argv, print_arguments=True):
|
||||||
|
@ -131,7 +131,7 @@ class ZfsDataset:
|
|||||||
:type exclude_unchanged: bool
|
:type exclude_unchanged: bool
|
||||||
:type min_change: bool
|
:type min_change: bool
|
||||||
|
|
||||||
:param value: Value of the zfs property ("false"/"true"/"child"/"-")
|
:param value: Value of the zfs property ("false"/"true"/"child"/parent/"-")
|
||||||
:param source: Source of the zfs property ("local"/"received", "-")
|
:param source: Source of the zfs property ("local"/"received", "-")
|
||||||
:param inherited: True of the value/source was inherited from a higher dataset.
|
:param inherited: True of the value/source was inherited from a higher dataset.
|
||||||
"""
|
"""
|
||||||
@ -142,7 +142,7 @@ class ZfsDataset:
|
|||||||
raise (Exception(
|
raise (Exception(
|
||||||
"{} autobackup-property has illegal source: '{}' (possible BUG)".format(self.name, source)))
|
"{} autobackup-property has illegal source: '{}' (possible BUG)".format(self.name, source)))
|
||||||
|
|
||||||
if value not in ["false", "true", "child", "-"]:
|
if value not in ["false", "true", "child", "parent", "-"]:
|
||||||
# user error
|
# user error
|
||||||
raise (Exception(
|
raise (Exception(
|
||||||
"{} autobackup-property has illegal value: '{}'".format(self.name, value)))
|
"{} autobackup-property has illegal value: '{}'".format(self.name, value)))
|
||||||
@ -155,6 +155,10 @@ class ZfsDataset:
|
|||||||
if value == "child" and not inherited:
|
if value == "child" and not inherited:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# only select parent, no childs, ignore
|
||||||
|
if value == "parent" and inherited:
|
||||||
|
return False
|
||||||
|
|
||||||
# manually excluded by property
|
# manually excluded by property
|
||||||
if value == "false":
|
if value == "false":
|
||||||
self.verbose("Excluded")
|
self.verbose("Excluded")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user