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!
Quellcode durchsuchen

Added -f switch in focker jail prune

tags/0.92
Stanislaw Adaszewski vor 4 Jahren
Ursprung
Commit
ee2fcd0eb1
2 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen
  1. +2
    -0
      focker.py
  2. +4
    -3
      jail.py

+ 2
- 0
focker.py Datei anzeigen

@@ -65,6 +65,7 @@ def create_parser():
parser.add_argument('--tags', '-t', type=str, nargs='+', default=[])
parser.add_argument('--env', '-e', type=str, nargs='+', default=[])
parser.add_argument('--mounts', '-m', type=str, nargs='+', default=[])
parser.add_argument('--hostname', '-n', type=str)
parser = subparsers.add_parser('run')
parser.set_defaults(func=command_jail_run)
@@ -87,6 +88,7 @@ def create_parser():
parser = subparsers.add_parser('prune')
parser.set_defaults(func=command_jail_prune)
parser.add_argument('--force', '-f', action='store_true')
# volume
subparsers = subparsers_top.add_parser('volume').add_subparsers()


+ 4
- 3
jail.py Datei anzeigen

@@ -17,7 +17,7 @@ def gen_env_command(command, env):
return command
def jail_create(path, command, env, mounts, hostname):
def jail_create(path, command, env, mounts, hostname=None):
name = os.path.split(path)[-1]
if os.path.exists('/etc/jail.conf'):
conf = jailconf.load('/etc/jail.conf')
@@ -159,7 +159,8 @@ def command_jail_create(args):
{ a.split(':')[0]: ':'.join(a.split(':')[1:]) \
for a in args.env },
[ [a.split(':')[0], ':'.join(a.split(':')[1:])] \
for a in args.mounts ] )
for a in args.mounts ],
args.hostname )
print(sha256)
print(path)
@@ -213,5 +214,5 @@ def command_jail_prune(args):
used.add(j['path'])
lst = zfs_list(fields=['focker:sha256,focker:tags,mountpoint,name'], focker_type='jail')
for j in lst:
if j[1] == '-' and j[2] not in used:
if j[1] == '-' and (j[2] not in used or args.force):
jail_remove(j[2])

Laden…
Abbrechen
Speichern