diff options
author | Erik Skultety <eskultet@redhat.com> | 2023-05-23 13:43:06 +0200 |
---|---|---|
committer | Erik Skultety <eskultet@redhat.com> | 2023-06-22 12:05:04 +0000 |
commit | 1e8d54478179d36e5416d7d937a58ee6fbd8c744 (patch) | |
tree | 958f92d15fdcd8faccb45d918b0b052880250de6 | |
parent | 5035104d9d18e2a90aff0a63d824c8c85db9a248 (diff) | |
download | libvirt-ci-1e8d54478179d36e5416d7d937a58ee6fbd8c744.zip libvirt-ci-1e8d54478179d36e5416d7d937a58ee6fbd8c744.tar.gz libvirt-ci-1e8d54478179d36e5416d7d937a58ee6fbd8c744.tar.bz2 |
commandline: Add a CLI option to specify the template install image
Let users bring their own base image. The reason is simple, they may
need to install a bunch of packages and perform some system setup which
is an expensive procedure to do every single time when booting off of
the stripped down vendor provided cloud images.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
-rw-r--r-- | lcitool/commandline.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lcitool/commandline.py b/lcitool/commandline.py index 607b32d..0b774ed 100644 --- a/lcitool/commandline.py +++ b/lcitool/commandline.py @@ -121,6 +121,12 @@ class CommandLine: help="force download of a new image (only with --strategy=cloud)" ) + installfromtemplate = argparse.ArgumentParser(add_help=False) + installfromtemplate.add_argument( + "--template", + help="template image to instantiate (only with --strategy=template)", + ) + update_projectopt = argparse.ArgumentParser(add_help=False) update_projectopt.add_argument( "projects", @@ -244,6 +250,7 @@ class CommandLine: installhostopt, installstrategyopt, installforceopt, + installfromtemplate, ], ) installparser.set_defaults(func=Application._action_install) @@ -360,6 +367,15 @@ class CommandLine: log.error("--script is required") sys.exit(1) + @staticmethod + def _validate_install(args): + if args.strategy == "template": + if not args.template: + log.error("--template is required with with --strategy=template") + sys.exit(1) + + return + # Main CLI validating method def _validate(self, args): """ @@ -373,6 +389,9 @@ class CommandLine: if args.action == "container": self._validate_container(args) + elif args.action == "install": + self._validate_install(args) + return args def parse(self): |