From 13591cab3f2844ec68bad938beb511a89efaaea2 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Fri, 24 Apr 2020 20:08:36 +0200 Subject: [PATCH] Started implementing volume commands. --- Fockerfile | 14 ++++++++------ focker.py | 27 +++++++++++++++++++++++++++ volume.py | 18 ++++++++++++++++++ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 volume.py diff --git a/Fockerfile b/Fockerfile index aa1493e..ba8436b 100644 --- a/Fockerfile +++ b/Fockerfile @@ -1,13 +1,15 @@ base: freebsd-latest steps: - - run: | - pkg -y install -y python3 && \ - pkg -y install -y py37-pip - - run: | - pkg install -y py37-yaml - copy: - [ '/tmp/x', '/etc/x' ] - [ 'focker-compose.yml', '/etc/focker-compose.yml' ] - run: | - pkg install py37-certbot + pkg install -y python3 && \ + pkg install -y py37-pip && \ + pkg install -y py37-yaml && \ + pkg install -y py37-certbot && \ + mkdir -p /persist/etc/ssh && \ + sed -i '' -e 's/\/etc\/ssh\/ssh_host_/\/persist\/etc\/ssh\/ssh_host_/g' /etc/rc.d/sshd && \ + sed -i '' -e 's/\/etc\/ssh\/ssh_host_/\/persist\/etc\/ssh\/ssh_host_/g' /etc/ssh/sshd_config && \ + sed -i '' -e 's/#HostKey/HostKey/g' /etc/ssh/sshd_config diff --git a/focker.py b/focker.py index 8759a22..9b645ee 100644 --- a/focker.py +++ b/focker.py @@ -8,6 +8,11 @@ from .image import command_image_build, \ command_image_list, \ command_image_prune, \ command_image_remove +from .volume import command_volume_create, \ + command_volume_prune, \ + command_volume_list, \ + command_volume_tag, \ + command_volume_untag import sys from .zfs import zfs_init from .jail import command_jail_run @@ -17,6 +22,7 @@ def create_parser(): parser_top = ArgumentParser() subparsers_top = parser_top.add_subparsers() + # image subparsers = subparsers_top.add_parser('image').add_subparsers() parser = subparsers.add_parser('build') parser.set_defaults(func=command_image_build) @@ -45,12 +51,33 @@ def create_parser(): # parser.add_argument('--remove-children', '-r', action='store_true') parser.add_argument('--remove-dependents', '-R', action='store_true') + # jail subparsers = subparsers_top.add_parser('jail').add_subparsers() parser = subparsers.add_parser('run') parser.set_defaults(func=command_jail_run) parser.add_argument('image', type=str) parser.add_argument('--command', '-c', type=str, default='/bin/sh') + # volume + subparsers = subparsers_top.add_parser('volume').add_subparsers() + parser = subparsers.add_parser('create') + parser.set_defaults(func=command_volume_create) + parser.add_argument('--tag', '-t', type=str, nargs='+', default=[]) + + parser = subparsers.add_parser('prune') + parser.set_defaults(func=command_volume_prune) + + parser = subparsers.add_parser('list') + parser.set_defaults(func=command_volume_list) + + parser = subparsers.add_parser('tag') + parser.set_defaults(func=command_volume_tag) + parser.add_argument('tags', type=str, nargs='+') + + parser = subparsers.add_parser('untag') + parser.set_defaults(func=command_volume_untag) + parser.add_argument('tags', type=str, nargs='+') + return parser_top diff --git a/volume.py b/volume.py new file mode 100644 index 0000000..ca0c93b --- /dev/null +++ b/volume.py @@ -0,0 +1,18 @@ +def command_volume_create(args): + raise NotImplementedError + + +def command_volume_prune(args): + raise NotImplementedError + + +def command_volume_list(args): + raise NotImplementedError + + +def command_volume_tag(args): + raise NotImplementedError + + +def command_volume_untag(args): + raise NotImplementedError