Merge "jclouds: Utilize convert_mapping_to_xml"

This commit is contained in:
Zuul 2018-09-04 19:13:04 +00:00 committed by Gerrit Code Review
commit 3e4c4afa29
1 changed files with 7 additions and 6 deletions

View File

@ -1203,6 +1203,11 @@ def jclouds(registry, xml_parent, data):
:language: yaml
"""
mapping = [
('cloud-name', 'cloudName', ''),
('count', 'count', '1'),
('stop-on-terminate', 'suspendOrTerminate', False),
]
if 'instances' in data:
buildWrapper = XML.SubElement(
xml_parent, 'jenkins.plugins.jclouds.compute.JCloudsBuildWrapper')
@ -1213,12 +1218,8 @@ def jclouds(registry, xml_parent, data):
'jenkins.plugins.jclouds.compute.'
'InstancesToRun')
XML.SubElement(instance, 'templateName').text = template
XML.SubElement(instance, 'cloudName').text = \
params.get('cloud-name', '')
XML.SubElement(instance, 'count').text = \
str(params.get('count', 1))
XML.SubElement(instance, 'suspendOrTerminate').text = \
str(params.get('stop-on-terminate', False)).lower()
helpers.convert_mapping_to_xml(
instance, params, mapping, fail_required=False)
if data.get('single-use'):
XML.SubElement(xml_parent,
'jenkins.plugins.jclouds.compute.'