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
)
This commit is contained in:
parent
f5f75c229b
commit
351bc64f4c
|
@ -111,6 +111,18 @@ class Build(command.Command):
|
||||||
"host distro. (default: %(default)s)"
|
"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(
|
parser.add_argument(
|
||||||
"--exclude",
|
"--exclude",
|
||||||
dest="excludes",
|
dest="excludes",
|
||||||
|
@ -564,6 +576,15 @@ class Build(command.Command):
|
||||||
"ansible_connection": "local",
|
"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:
|
if parsed_args.rhel_modules:
|
||||||
rhel_modules = {}
|
rhel_modules = {}
|
||||||
|
|
Loading…
Reference in New Issue