David Caro has uploaded a new change for review. Change subject: Added possible json option value encoding ......................................................................
Added possible json option value encoding Sometimes mock has options that are python arrays, or dicts, before all the options were used just as strings, now if possible, it will try to decode an object using json parser. Change-Id: I66feb645fab0308b7fea9e759cdb5d88b2278a41 Signed-off-by: David Caro <dcaro...@redhat.com> --- M mock_configs/mock_genconfig 1 file changed, 11 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/jenkins refs/changes/38/35238/1 diff --git a/mock_configs/mock_genconfig b/mock_configs/mock_genconfig index 8c2bd3e..ccd62f6 100755 --- a/mock_configs/mock_genconfig +++ b/mock_configs/mock_genconfig @@ -51,9 +51,10 @@ else: keys = [key] key = '"]["'.join(keys) - result_lines.append('%s["%s"]=%s' % (dict_name, - key, - json.dumps(value))) + result_lines.append('%s["%s"]=%r' % ( + dict_name, + key, + value)) return '\n'.join(result_lines) @@ -72,7 +73,9 @@ help='extra options to set in the the config, they can ' 'have multiple levels so for example ' 'environment.MYVAR=MYVALUE will end up as ' - 'config_opts["environment"]["MYVAR"]="MYVALUE"') + 'config_opts["environment"]["MYVAR"]="MYVALUE".' + ' Note that the value will be loaded as a json encoded ' + 'string if able') parser.add_argument('--base', dest='base_config', required=True, help='path to the configuration to use as base') parser.add_argument('--name', dest='name', required=True, @@ -90,12 +93,15 @@ # load extra options passed for option in args.options: key, val = parse_option(option) + try: + val = json.loads(val) + except ValueError: + pass config_opts[key] = val # add the extra repos passed config_opts['yum.conf'] = '%s' % (config_opts.get('yum.conf', '') + get_repos(args.extra_repos)) - print dumps_dict(config_opts, 'config_opts') -- To view, visit http://gerrit.ovirt.org/35238 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66feb645fab0308b7fea9e759cdb5d88b2278a41 Gerrit-PatchSet: 1 Gerrit-Project: jenkins Gerrit-Branch: master Gerrit-Owner: David Caro <dcaro...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches