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

Add focker volume get|set.

master
Stanislaw Adaszewski vor 4 Jahren
Ursprung
Commit
66e835e5dd
2 geänderte Dateien mit 29 neuen und 1 gelöschten Zeilen
  1. +13
    -1
      focker/focker.py
  2. +16
    -0
      focker/volume.py

+ 13
- 1
focker/focker.py Datei anzeigen

@@ -22,7 +22,9 @@ from .volume import command_volume_create, \
command_volume_list, \
command_volume_tag, \
command_volume_untag, \
command_volume_remove
command_volume_remove, \
command_volume_set, \
command_volume_get
import sys
from .zfs import zfs_init
from .jail import command_jail_create, \
@@ -193,6 +195,16 @@ def create_parser():
parser.add_argument('references', type=str, nargs='+')
parser.add_argument('--force', '-f', action='store_true')
parser = ListForwarder([subparsers.add_parser(cmd) for cmd in ['set', 's']])
parser.set_defaults(func=command_volume_set)
parser.add_argument('reference', type=str)
parser.add_argument('properties', type=str, nargs=argparse.REMAINDER)
parser = ListForwarder([subparsers.add_parser(cmd) for cmd in ['get', 'g']])
parser.set_defaults(func=command_volume_get)
parser.add_argument('reference', type=str)
parser.add_argument('properties', type=str, nargs=argparse.REMAINDER)
# compose
subparsers = ListForwarder([ subparsers_top.add_parser(cmd).add_subparsers(dest='L2_command') \
for cmd in ['compose', 'comp', 'c'] ])


+ 16
- 0
focker/volume.py Datei anzeigen

@@ -55,3 +55,19 @@ def command_volume_remove(args):
except:
if not args.force:
raise
def command_volume_set(args):
name, _ = zfs_find(args.reference, focker_type='volume')
if not args.properties:
raise ValueError('You must specify some properties')
zfs_run(['zfs', 'set'] + args.properties + [name])
def command_volume_get(args):
name, _ = zfs_find(args.reference, focker_type='volume')
if not args.properties:
raise ValueError('You must specify some properties')
res = zfs_parse_output(['zfs', 'get', '-H', ','.join(args.properties), name])
res = map(lambda a: a[2], res)
print('\n'.join(res))

Laden…
Abbrechen
Speichern