From eb3a0778bc26729c04d91f637dd09f5310e7f979 Mon Sep 17 00:00:00 2001 From: Yolande Amate Date: Tue, 13 Jun 2017 01:50:39 +0100 Subject: [PATCH] Update Ant Plugin to make use of convert_mapping_to_xml() Change-Id: I0ad5241d6ffcebf9ad563a4c97dc0beb3ae0be5d --- jenkins_jobs/modules/builders.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index ed559c1ca..c325e0207 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -283,30 +283,28 @@ def ant(registry, xml_parent, data): """ ant = XML.SubElement(xml_parent, 'hudson.tasks.Ant') + mappings = [] if type(data) is str: # Support for short form: -ant: "target" data = {'targets': data} for setting, value in sorted(data.items()): if setting == 'targets': - targets = XML.SubElement(ant, 'targets') - targets.text = value + mappings.append(('', 'targets', value)) if setting == 'buildfile': - buildfile = XML.SubElement(ant, 'buildFile') - buildfile.text = value + mappings.append(('', 'buildFile', value)) if setting == 'properties': - properties = data['properties'] + properties = value prop_string = '' for prop, val in properties.items(): prop_string += "%s=%s\n" % (prop, val) - prop_element = XML.SubElement(ant, 'properties') - prop_element.text = prop_string + mappings.append(('', 'properties', prop_string)) if setting == 'java-opts': - javaopts = data['java-opts'] - jopt_string = ' '.join(javaopts) - jopt_element = XML.SubElement(ant, 'antOpts') - jopt_element.text = jopt_string + jopt_string = ' '.join(value) + mappings.append(('', 'antOpts', jopt_string)) - XML.SubElement(ant, 'antName').text = data.get('ant-name', 'default') + mappings.append(('ant-name', 'antName', 'default')) + + convert_mapping_to_xml(ant, data, mappings, fail_required=True) def trigger_remote(registry, xml_parent, data):