Skip to content

Commit

Permalink
various automount fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Sep 27, 2023
1 parent 16ab4f8 commit aa2c283
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 69 deletions.
14 changes: 7 additions & 7 deletions tests/test_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ def test_encrypt(self):
self.prepare_encrypted_dataset("22222222", "test_target1/encryptedtarget")

with patch('time.strftime', return_value="test-20101111000000"):
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-progress --encrypt --debug --allow-empty --exclude-received".split(" ")).run())
self.assertFalse(ZfsAutobackup("test test_target1/encryptedtarget --verbose --no-progress --encrypt --debug --no-snapshot --exclude-received".split(" ")).run())
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-progress --encrypt --debug --allow-empty --exclude-received --clear-mountpoint".split(" ")).run())
self.assertFalse(ZfsAutobackup("test test_target1/encryptedtarget --verbose --no-progress --encrypt --debug --no-snapshot --exclude-received --clear-mountpoint".split(" ")).run())

with patch('time.strftime', return_value="test-20101111000001"):
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-progress --encrypt --debug --allow-empty --exclude-received".split(" ")).run())
self.assertFalse(ZfsAutobackup("test test_target1/encryptedtarget --verbose --no-progress --encrypt --debug --no-snapshot --exclude-received --force".split(" ")).run())
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-progress --encrypt --debug --allow-empty --exclude-received --clear-mountpoint".split(" ")).run())
self.assertFalse(ZfsAutobackup("test test_target1/encryptedtarget --verbose --no-progress --encrypt --debug --no-snapshot --exclude-received --clear-mountpoint".split(" ")).run())

r = shelltest("zfs get -r -t filesystem encryptionroot test_target1")
self.assertEqual(r, """
Expand Down Expand Up @@ -158,16 +158,16 @@ def test_reencrypt(self):

with patch('time.strftime', return_value="test-20101111000000"):
self.assertFalse(ZfsAutobackup(
"test test_target1 --verbose --no-progress --decrypt --encrypt --debug --allow-empty --exclude-received".split(" ")).run())
"test test_target1 --verbose --no-progress --decrypt --encrypt --debug --allow-empty --exclude-received --clear-mountpoint".split(" ")).run())
self.assertFalse(ZfsAutobackup(
"test test_target1/encryptedtarget --verbose --no-progress --decrypt --encrypt --debug --no-snapshot --exclude-received --force".split(
"test test_target1/encryptedtarget --verbose --no-progress --decrypt --encrypt --debug --no-snapshot --exclude-received --clear-mountpoint".split(
" ")).run())

with patch('time.strftime', return_value="test-20101111000001"):
self.assertFalse(ZfsAutobackup(
"test test_target1 --verbose --no-progress --decrypt --encrypt --debug --allow-empty --exclude-received".split(" ")).run())
self.assertFalse(ZfsAutobackup(
"test test_target1/encryptedtarget --verbose --no-progress --decrypt --encrypt --debug --no-snapshot --exclude-received --force".split(
"test test_target1/encryptedtarget --verbose --no-progress --decrypt --encrypt --debug --no-snapshot --exclude-received".split(
" ")).run())

r = shelltest("zfs get -r -t filesystem encryptionroot test_target1")
Expand Down
17 changes: 16 additions & 1 deletion tests/test_zfsautobackup32.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_invalid_common_snapshot_with_data(self):

#create 2 snapshots with the same name, which are invalid as common snapshot
shelltest("zfs snapshot test_source1/fs1@invalid")
shelltest("zfs mount test_target1/test_source1/fs1")
shelltest("touch /test_target1/test_source1/fs1/shouldnotbeHere")
shelltest("zfs snapshot test_target1/test_source1/fs1@invalid")

Expand Down Expand Up @@ -137,3 +136,19 @@ def test_mount_consitency_unmounted(self):
/test_target1
""")


# def test_stuff(self):
#
#
# shelltest("zfs set autobackup:test=true test_source2")
# # shelltest("zfs set readonly=on test_target1")
#
# with patch('time.strftime', return_value="test-20101111000000"):
# self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --verbose --allow-empty --clear-mountpoint".split(" ")).run())
#
# # shelltest("zfs mount test_target1/test_source2/fs2/sub" )
#
# with patch('time.strftime', return_value="test-20101111000001"):
# self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --verbose --allow-empty --rollback".split(" ")).run())


2 changes: 1 addition & 1 deletion zfs_autobackup/CliBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CliBase(object):
Overridden in subclasses that add stuff for the specific programs."""

# also used by setup.py
VERSION = "3.2.3-beta"
VERSION = "3.3-beta"
HEADER = "{} v{} - (c)2022 E.H.Eefting ([email protected])".format(os.path.basename(sys.argv[0]), VERSION)

def __init__(self, argv, print_arguments=True):
Expand Down
1 change: 1 addition & 0 deletions zfs_autobackup/ZfsAutobackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def sync_datasets(self, source_node, source_datasets, target_node):
and target_dataset.parent \
and target_dataset.parent not in target_datasets \
and not target_dataset.parent.exists:
target_dataset.debug("Creating unmountable parents")
target_dataset.parent.create_filesystem(parents=True)

# determine common zpool features (cached, so no problem we call it often)
Expand Down
Loading

0 comments on commit aa2c283

Please sign in to comment.