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

Started implementing focker compose

tags/0.92
부모
커밋
b4a8c24c1f
2개의 변경된 파일59개의 추가작업 그리고 0개의 파일을 삭제
  1. +56
    -0
      compose.py
  2. +3
    -0
      focker-compose.yml

+ 56
- 0
compose.py 파일 보기

@@ -0,0 +1,56 @@
import os
import yaml
from .zfs import AmbiguousValueError, \
zfs_find, \
zfs_tag
from .misc import random_sha256_hexdigest, \
find_prefix
import subprocess
def build_volumes(spec):
for tag in spec.keys():
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', name])
zfs_untag([ tag ], focker_type='volume')
zfs_tag(name, [ tag ])
def build_images(spec, path):
# print('build_images(): NotImplementedError')
for (tag, focker_dir) in spec.items():
res = subprocess.run(['focker', 'image', 'build',
os.path.join(path, focker_dir), '-t', tag])
if res.returncode != 0:
raise RuntimeError('Image build failed: ' + str(res.returncode))
def build_jails(spec):
print('build_jails(): NotImplementedError')
def command_compose_build(args):
if not os.path.exists(args.filename):
raise ValueError('File not found: ' + args.filename)
path, _ = os.path.split(args.filename)
with open(args.filename, 'r') as f:
spec = yaml.safe_load(f)
if 'volumes' in spec:
build_volumes(spec['volumes'])
if 'images' in spec:
build_images(spec['images'], path)
if 'jails' in spec:
build_jails(spec['jails'])
def command_compose_run(args):
raise NotImplementedError

+ 3
- 0
focker-compose.yml 파일 보기

@@ -4,6 +4,9 @@
# focker compose wordpress.yml restore
#
images:
wordpress-5: .
jails:
wordpress:
image: wordpress-5


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