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!
소스 검색

Added support for chown, chmod and zfs props in volume compose.

master
부모
커밋
ac5b6f7ac8
2개의 변경된 파일23개의 추가작업 그리고 11개의 파일을 삭제
  1. +5
    -1
      example/gitea/focker-compose.yml
  2. +18
    -10
      focker/compose.py

+ 5
- 1
example/gitea/focker-compose.yml 파일 보기

@@ -6,7 +6,11 @@ images:
certbot-latest: ../certbot
volumes:
gitea-data: {}
gitea-data:
chmod: 0750
chown: 211:211
zfs:
quota: 5G
certbot-webroot: {}
certbot-config-gitea: {}


+ 18
- 10
focker/compose.py 파일 보기

@@ -12,7 +12,8 @@ from .zfs import AmbiguousValueError, \
zfs_tag, \
zfs_untag, \
zfs_mountpoint, \
zfs_poolname
zfs_poolname, \
zfs_set_props
from .jail import jail_fs_create, \
jail_create, \
jail_remove
@@ -25,19 +26,26 @@ import os
def build_volumes(spec):
poolname = zfs_poolname()
for tag in spec.keys():
for tag, params in spec.items():
name = None
try:
name, _ = zfs_find(tag, focker_type='volume')
continue
except AmbiguousValueError:
raise
except ValueError:
pass
sha256 = random_sha256_hexdigest()
name = find_prefix(poolname + '/focker/volumes/', sha256)
subprocess.check_output(['zfs', 'create', '-o', 'focker:sha256=' + sha256, name])
zfs_untag([ tag ], focker_type='volume')
zfs_tag(name, [ tag ])
if name is None:
sha256 = random_sha256_hexdigest()
name = find_prefix(poolname + '/focker/volumes/', sha256)
subprocess.check_output(['zfs', 'create', '-o', 'focker:sha256=' + sha256, name])
zfs_untag([ tag ], focker_type='volume')
zfs_tag(name, [ tag ])
mountpoint = zfs_mountpoint(name)
print('params:', params)
if 'chown' in params:
os.chown(mountpoint, *map(int, params['chown'].split(':')))
if 'chmod' in params:
os.chmod(mountpoint, params['chmod'])
if 'zfs' in params:
zfs_set_props(name, params['zfs'])
def build_images(spec, path):


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