Merge "TCIB: add --rhel-modules argument"

This commit is contained in:
Zuul 2020-08-20 15:46:15 +00:00 committed by Gerrit Code Review
commit 3d8ffb7348
1 changed files with 25 additions and 0 deletions

View File

@ -45,6 +45,7 @@ DEFAULT_AUTHFILE = "{}/containers/auth.json".format(
DEFAULT_ENV_AUTHFILE = os.environ.get("REGISTRY_AUTH_FILE", DEFAULT_AUTHFILE)
DEFAULT_CONFIG = "tripleo_containers.yaml"
DEFAULT_TCIB_CONFIG_BASE = "tcib"
SUPPORTED_RHEL_MODULES = ['container-tools', 'mariadb', 'redis', 'virt']
class Build(command.Command):
@ -207,6 +208,14 @@ class Build(command.Command):
"(default: %(default)s)"
),
)
parser.add_argument(
"--rhel-modules",
dest="rhel_modules",
metavar="<rhel-modules>",
default=None,
help=_("A comma separated list of RHEL modules to enable with "
"their version. Example: 'mariadb:10.3,virt:8.3'."),
)
return parser
def imagename_to_regex(self, imagename):
@ -460,6 +469,22 @@ class Build(command.Command):
}
)
if parsed_args.rhel_modules:
rhel_modules = {}
for module in parsed_args.rhel_modules.split(','):
try:
name, version = module.split(':', 1)
except Exception:
raise ValueError('Wrong format for --rhel-modules, '
'must be a comma separated list of '
'<module>:<version>')
if name not in SUPPORTED_RHEL_MODULES:
raise ValueError('{} is not part of supported modules'
' {}'.format(name,
SUPPORTED_RHEL_MODULES))
rhel_modules.update({name: version})
image_config['tcib_rhel_modules'] = rhel_modules
# NOTE(cloudnull): Check if the reference config has a valid
# "from" option. If the reference "from"
# option is valid, it will be used.