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
부모
커밋
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])


불러오는 중...
취소
저장