mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-04-11 22:40:01 +03:00
fix #103
This commit is contained in:
parent
be2474bb1c
commit
7b4a986f13
@ -56,3 +56,50 @@ test_target1/test_source2/fs2/sub@test-20101111000000
|
||||
test_target1/test_source2/fs2/sub@test-20101111000001
|
||||
test_target1/test_source2/fs2/sub@test-20101111000002
|
||||
""")
|
||||
|
||||
|
||||
def test_excludepaths(self):
|
||||
"""Test issue #103"""
|
||||
|
||||
shelltest("zfs create test_target1/target_shouldnotbeexcluded")
|
||||
shelltest("zfs set autobackup:test=true test_target1/target_shouldnotbeexcluded")
|
||||
shelltest("zfs create test_target1/target")
|
||||
|
||||
with patch('time.strftime', return_value="test-20101111000000"):
|
||||
self.assertFalse(ZfsAutobackup(
|
||||
"test test_target1/target --no-progress --verbose --allow-empty".split(
|
||||
" ")).run())
|
||||
|
||||
|
||||
r = shelltest("zfs list -H -o name -r -t all " + TEST_POOLS)
|
||||
self.assertMultiLineEqual(r, """
|
||||
test_source1
|
||||
test_source1/fs1
|
||||
test_source1/fs1@test-20101111000000
|
||||
test_source1/fs1/sub
|
||||
test_source1/fs1/sub@test-20101111000000
|
||||
test_source2
|
||||
test_source2/fs2
|
||||
test_source2/fs2/sub
|
||||
test_source2/fs2/sub@test-20101111000000
|
||||
test_source2/fs3
|
||||
test_source2/fs3/sub
|
||||
test_target1
|
||||
test_target1/target
|
||||
test_target1/target/test_source1
|
||||
test_target1/target/test_source1/fs1
|
||||
test_target1/target/test_source1/fs1@test-20101111000000
|
||||
test_target1/target/test_source1/fs1/sub
|
||||
test_target1/target/test_source1/fs1/sub@test-20101111000000
|
||||
test_target1/target/test_source2
|
||||
test_target1/target/test_source2/fs2
|
||||
test_target1/target/test_source2/fs2/sub
|
||||
test_target1/target/test_source2/fs2/sub@test-20101111000000
|
||||
test_target1/target/test_target1
|
||||
test_target1/target/test_target1/target_shouldnotbeexcluded
|
||||
test_target1/target/test_target1/target_shouldnotbeexcluded@test-20101111000000
|
||||
test_target1/target_shouldnotbeexcluded
|
||||
test_target1/target_shouldnotbeexcluded@test-20101111000000
|
||||
""")
|
||||
|
||||
|
||||
|
@ -158,7 +158,8 @@ class ZfsDataset:
|
||||
|
||||
# our path starts with one of the excluded paths?
|
||||
for exclude_path in exclude_paths:
|
||||
if self.name.startswith(exclude_path):
|
||||
# if self.name.startswith(exclude_path):
|
||||
if (self.name + "/").startswith(exclude_path + "/"):
|
||||
# too noisy for verbose
|
||||
self.debug("Excluded (path in exclude list)")
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user