diff --git a/tripleoclient/v2/tripleo_container_image.py b/tripleoclient/v2/tripleo_container_image.py index 6050b6700..db21ca2d4 100644 --- a/tripleoclient/v2/tripleo_container_image.py +++ b/tripleoclient/v2/tripleo_container_image.py @@ -111,6 +111,18 @@ class Build(command.Command): "host distro. (default: %(default)s)" ), ) + parser.add_argument( + "--tcib-extras", + dest="tcib_extras", + default=None, + metavar="", + action='append', + help=_( + "TCIB extra variables you want to pass. They can be later " + "used within TCIB files as conditonals. Can be passed " + "multiple times(default: %(default)s)" + ), + ) parser.add_argument( "--exclude", dest="excludes", @@ -564,6 +576,15 @@ class Build(command.Command): "ansible_connection": "local", } ) + if parsed_args.tcib_extras: + for extras in parsed_args.tcib_extras: + key, value = extras.split('=') + # Enforce format in order to get some consistency + if not key.startswith('tcib_'): + raise ValueError('Wrong key format {key}. ' + 'We expect "tcib_" prefix, such as ' + 'tcib_{key}'.format(key=key)) + image_config[key] = value if parsed_args.rhel_modules: rhel_modules = {}