Browse Source

Allow to pass arbitrary parameters to TCIB image config

This new parameter takes key=value format, and can be passed multiple
times.

Those key/values can then be used within the image description files in
order to make them support different releases, or just use the value in
case we have a specific version (python-version for instance).

This will be useful in order to support container builds on both CS8 and
CS9 releases without too many duplications or headaches.

Note that a "tcib_" prefix is enforced for the keys.

Closes-Bug: #1942510
Change-Id: I7fe4d59f1fb76ba59d065b56c5900f4d3cfcda2e
(cherry picked from commit fb6daacedd)
(cherry picked from commit 351bc64f4c)
changes/43/813943/1
Cédric Jeanneret 5 months ago
committed by Ronelle Landy
parent
commit
d5264c6845
  1. 21
      tripleoclient/v2/tripleo_container_image.py

21
tripleoclient/v2/tripleo_container_image.py

@ -119,6 +119,18 @@ class Build(command.Command):
"host distro. (default: %(default)s)"
),
)
parser.add_argument(
"--tcib-extras",
dest="tcib_extras",
default=None,
metavar="<key=val>",
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",
@ -572,6 +584,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 = {}

Loading…
Cancel
Save