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 focker jail tag/untag.

tags/0.92
Stanislaw Adaszewski пре 4 година
родитељ
комит
a532056790
3 измењених фајлова са 25 додато и 3 уклоњено
  1. +12
    -1
      focker.py
  2. +10
    -0
      jail.py
  3. +3
    -2
      zfs.py

+ 12
- 1
focker.py Прегледај датотеку

@@ -16,7 +16,9 @@ from .volume import command_volume_create, \
import sys
from .zfs import zfs_init
from .jail import command_jail_run, \
command_jail_list
command_jail_list, \
command_jail_tag, \
command_jail_untag
def create_parser():
@@ -64,6 +66,15 @@ def create_parser():
parser.set_defaults(func=command_jail_list)
parser.add_argument('--full-sha256', '-f', action='store_true')
parser = subparsers.add_parser('tag')
parser.set_defaults(func=command_jail_tag)
parser.add_argument('reference', type=str)
parser.add_argument('tags', type=str, nargs='+')
parser = subparsers.add_parser('untag')
parser.set_defaults(func=command_jail_untag)
parser.add_argument('tags', type=str, nargs='+')
# volume
subparsers = subparsers_top.add_parser('volume').add_subparsers()
parser = subparsers.add_parser('create')


+ 10
- 0
jail.py Прегледај датотеку

@@ -85,3 +85,13 @@ def command_jail_list(args):
a[2],
jails[a[2]]['jid'] if a[2] in jails else '-' ], lst))
print(tabulate(lst, headers=['Tags', 'SHA256', 'mountpoint', 'JID']))
def command_jail_tag(args):
name, _ = zfs_find(args.reference, focker_type='jail')
zfs_untag(args.tags, focker_type='jail')
zfs_tag(name, args.tags)
def command_jail_untag(args):
zfs_untag(args.tags, focker_type='jail')

+ 3
- 2
zfs.py Прегледај датотеку

@@ -131,9 +131,10 @@ def zfs_tag(name, tags, replace=False):
zfs_run(['zfs', 'inherit', 'focker:tags', name])
def zfs_untag(tags):
def zfs_untag(tags, focker_type='image'):
# print('zfs_untag(), tags:', tags)
lst = zfs_parse_output(['zfs', 'list', '-o', 'name,focker:tags', '-H'])
poolname = zfs_poolname()
lst = zfs_parse_output(['zfs', 'list', '-o', 'name,focker:tags', '-H', '-r', poolname + '/focker/' + focker_type + 's'])
lst = filter(lambda a: any([b in a[1].split(' ') for b in tags]), lst)
for row in lst:
cur_tags = row[1].split(' ')


Loading…
Откажи
Сачувај