Update openstack to use convert_mapping_to_xml()
Change-Id: I29fdc553512f19c73aef88c42d72f8b5c3d9f003
This commit is contained in:
parent
e3e5a8aabe
commit
828baa7d3e
@ -1144,23 +1144,17 @@ def openstack(registry, xml_parent, data):
|
||||
instances_to_run = XML.SubElement(
|
||||
instances_wrapper, tag_prefix + 'InstancesToRun')
|
||||
|
||||
try:
|
||||
cloud_name = instance['cloud-name']
|
||||
template_name = instance['template-name']
|
||||
except KeyError as exception:
|
||||
raise MissingAttributeError(exception.args[0])
|
||||
|
||||
XML.SubElement(instances_to_run, 'cloudName').text = cloud_name
|
||||
instance_mapping = [('cloud-name', 'cloudName', None),
|
||||
('count', 'count', 1)]
|
||||
|
||||
if instance.get('manual-template', False):
|
||||
XML.SubElement(instances_to_run,
|
||||
'manualTemplateName').text = template_name
|
||||
instance_mapping.append(('template-name',
|
||||
'manualTemplateName', None))
|
||||
else:
|
||||
XML.SubElement(instances_to_run,
|
||||
'templateName').text = template_name
|
||||
|
||||
XML.SubElement(instances_to_run, 'count').text = str(
|
||||
instance.get('count', 1))
|
||||
instance_mapping.append(('template-name',
|
||||
'templateName', None))
|
||||
convert_mapping_to_xml(instances_to_run,
|
||||
instance, instance_mapping, fail_required=True)
|
||||
|
||||
if data.get('single-use', False):
|
||||
XML.SubElement(xml_parent, tag_prefix + 'JCloudsOneOffSlave')
|
||||
|
@ -5,13 +5,13 @@
|
||||
<instancesToRun>
|
||||
<jenkins.plugins.openstack.compute.InstancesToRun>
|
||||
<cloudName>mycloud1</cloudName>
|
||||
<templateName>jenkins-dev-slave</templateName>
|
||||
<count>1</count>
|
||||
<templateName>jenkins-dev-slave</templateName>
|
||||
</jenkins.plugins.openstack.compute.InstancesToRun>
|
||||
<jenkins.plugins.openstack.compute.InstancesToRun>
|
||||
<cloudName>mycloud2</cloudName>
|
||||
<manualTemplateName>jenkins-test-slave</manualTemplateName>
|
||||
<count>2</count>
|
||||
<manualTemplateName>jenkins-test-slave</manualTemplateName>
|
||||
</jenkins.plugins.openstack.compute.InstancesToRun>
|
||||
</instancesToRun>
|
||||
</jenkins.plugins.openstack.compute.JCloudsBuildWrapper>
|
||||
|
@ -5,8 +5,8 @@
|
||||
<instancesToRun>
|
||||
<jenkins.plugins.openstack.compute.InstancesToRun>
|
||||
<cloudName>mycloud1</cloudName>
|
||||
<templateName>jenkins-dev-slave</templateName>
|
||||
<count>1</count>
|
||||
<templateName>jenkins-dev-slave</templateName>
|
||||
</jenkins.plugins.openstack.compute.InstancesToRun>
|
||||
</instancesToRun>
|
||||
</jenkins.plugins.openstack.compute.JCloudsBuildWrapper>
|
||||
|
Loading…
Reference in New Issue
Block a user