Make --can-fail option working for make-image

There are two issues:
1) --can-fail option was ignored when passing to hub
2) when using config, can_fail was ignored as internal variable has
different name
This commit is contained in:
Tomas Kopecek 2017-02-02 12:51:05 +01:00 committed by Mike McLean
parent acf8133ec5
commit f609d8bc1f
2 changed files with 31 additions and 5 deletions

View file

@ -5778,6 +5778,9 @@ def handle_image_build(options, session, args):
if config.has_option(section, arg):
setattr(task_options, arg, config.get(section, arg).split(','))
config.remove_option(section, arg)
if config.has_option(section, 'can_fail'):
setattr(task_options, 'optional_arches', config.get(section, 'can_fail').split(','))
config.remove_option(section, 'can_fail')
# handle everything else
for k, v in config.items(section):
setattr(task_options, k, v)
@ -5865,7 +5868,7 @@ def _build_image(options, task_opts, session, args, img_type):
passthru_opts = [
'format', 'install_tree_url', 'isoname', 'ksurl',
'ksversion', 'release', 'repo', 'scratch', 'skip_tag',
'specfile', 'title', 'vcpu', 'vmem',
'specfile', 'title', 'vcpu', 'vmem', 'optional_arches',
]
for opt in passthru_opts:
val = getattr(task_opts, opt, None)
@ -5935,7 +5938,8 @@ def _build_image_oz(options, task_opts, session, args):
hub_opts = {}
for opt in ('ksurl', 'ksversion', 'kickstart', 'scratch', 'repo',
'release', 'skip_tag', 'specfile', 'distro', 'format',
'disk_size', 'ova_option', 'factory_parameter'):
'disk_size', 'ova_option', 'factory_parameter',
'optional_arches'):
val = getattr(task_opts, opt, None)
if val is not None:
hub_opts[opt] = val