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!
Przeglądaj źródła

Trying to make sure you can Ctrl+C at any time

tags/0.92
rodzic
commit
a9f833b254
4 zmienionych plików z 13 dodań i 7 usunięć
  1. +2
    -0
      Fockerfile
  2. +2
    -2
      image.py
  3. +5
    -1
      jail.py
  4. +4
    -4
      snapshot.py

+ 2
- 0
Fockerfile Wyświetl plik

@@ -9,3 +9,5 @@ steps:
- copy:
- [ '/tmp/x', '/etc/x' ]
- [ 'focker-compose.yml', '/etc/focker-compose.yml' ]
- run: |
pkg install py37-certbot

+ 2
- 2
image.py Wyświetl plik

@@ -47,11 +47,11 @@ def build(spec, args):
name = root + '/' + st_sha256[:pre]
if not zfs_exists(name):
break
snap_name = new_snapshot(base, lambda: st.execute(zfs_mountpoint(name), args=args), name)
feed = {
'focker:sha256': st_sha256
}
zfs_set_props(name, feed)
snap_name = new_snapshot(base, lambda: st.execute(zfs_mountpoint(name), args=args) and zfs_set_props(name, feed), name)
# zfs_set_props(name, feed)
# zfs_set_props(snap_name, feed)
base = snap_name
base_sha256 = st_sha256


+ 5
- 1
jail.py Wyświetl plik

@@ -7,8 +7,12 @@ import shutil
def jail_run(path, command):
command = ['jail', '-c', 'host.hostname=' + os.path.split(path)[1], 'mount.devfs=1', 'interface=lo1', 'ip4.addr=127.0.1.0', 'path=' + path, 'command', '/bin/sh', '-c', command]
print('Running:', ' '.join(command))
res = subprocess.run(command)
try:
res = subprocess.run(command)
finally:
subprocess.run(['umount', os.path.join(path, 'dev')])
if res.returncode != 0:
subprocess.run(['umount', os.path.join(path, 'dev')])
raise RuntimeError('Command failed')


+ 4
- 4
snapshot.py Wyświetl plik

@@ -11,10 +11,10 @@ def new_snapshot(base, fun, name):
zfs_run(['zfs', 'clone', base, name])
try:
fun()
zfs_run(['zfs', 'set', 'readonly=on', name])
snap_name = name + '@1'
zfs_run(['zfs', 'snapshot', snap_name])
except:
zfs_run(['zfs', 'destroy', name])
zfs_run(['zfs', 'destroy', '-f', name])
raise
zfs_run(['zfs', 'set', 'readonly=on', name])
snap_name = name + '@1'
zfs_run(['zfs', 'snapshot', snap_name])
return snap_name

Ładowanie…
Anuluj
Zapisz