From 5a4c87e06159d80b0465238691a4dc87c5e8b22e Mon Sep 17 00:00:00 2001 From: Yolande Amate Date: Mon, 3 Jul 2017 20:53:15 +0100 Subject: [PATCH] Update release to make use of convert_mapping_to_xml() Change-Id: I6dd64fe0ca084af283ba980b2a110a5fa920e825 Signed-off-by: Sorin Sbarnea --- jenkins_jobs/modules/wrappers.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index 08903492c..b7c7772bd 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -1195,20 +1195,19 @@ def release(registry, xml_parent, data): 'hudson.plugins.release.ReleaseWrapper') # For 'keep-forever', the sense of the XML flag is the opposite of # the YAML flag. - no_keep_forever = 'false' - if str(data.get('keep-forever', True)).lower() == 'false': - no_keep_forever = 'true' - XML.SubElement(relwrap, 'doNotKeepLog').text = no_keep_forever - XML.SubElement(relwrap, 'overrideBuildParameters').text = str( - data.get('override-build-parameters', False)).lower() - XML.SubElement(relwrap, 'releaseVersionTemplate').text = data.get( - 'version-template', '') + mapping = [ + ('do-not-keep-log', + 'doNotKeepLog', + not data.get('keep-forever', True)), + ('override-build-parameters', 'overrideBuildParameters', False), + ('version-template', 'releaseVersionTemplate', '')] + convert_mapping_to_xml(relwrap, data, mapping, fail_required=True) + parameters = data.get('parameters', []) if parameters: pdef = XML.SubElement(relwrap, 'parameterDefinitions') for param in parameters: registry.dispatch('parameter', pdef, param) - builder_steps = { 'pre-build': 'preBuildSteps', 'post-build': 'postBuildSteps',