IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Преглед изворни кода

Add protect switch to volumes in compose.

master
Stanislaw Adaszewski пре 4 година
родитељ
комит
050447f8d5
2 измењених фајлова са 8 додато и 1 уклоњено
  1. +5
    -0
      focker/compose.py
  2. +3
    -1
      tests/test_compose.py

+ 5
- 0
focker/compose.py Прегледај датотеку

@@ -77,6 +77,11 @@ def build_volumes(spec):
os.chmod(mountpoint, params['chmod'])
if 'zfs' in params:
zfs_set_props(name, params['zfs'])
if 'protect' in params:
if params['protect']:
zfs_set_props(name, { 'focker:protect': 'on' })
else:
zfs_run(['zfs', 'inherit', '-r', 'focker:protect', name])
def build_images(spec, path, args):


+ 3
- 1
tests/test_compose.py Прегледај датотеку

@@ -122,6 +122,7 @@ def test_build_volumes():
'test-build-volumes': {
'chown': '65534:65534',
'chmod': 0o123,
'protect': True,
'zfs': {
'quota': '1G',
'readonly': 'on'
@@ -134,9 +135,10 @@ def test_build_volumes():
assert st.st_uid == 65534
assert st.st_gid == 65534
assert ('%o' % st.st_mode)[-3:] == '123'
zst = zfs_parse_output(['zfs', 'get', '-H', 'quota,readonly', name])
zst = zfs_parse_output(['zfs', 'get', '-H', 'quota,readonly,focker:protect', name])
assert zst[0][2] == '1G'
assert zst[1][2] == 'on'
assert zst[2][2] == 'on'
subprocess.check_output(['zfs', 'destroy', '-r', '-f', name])


Loading…
Откажи
Сачувај