Use convert_mapping_to_xml helper function

'primaryView' and 'healthMetrics' attributes are generated in XML
code with the help of convert_mapping_to_xml helper function.

Change-Id: Ic68c22dfc49872c304f1540120deae237f479273
This commit is contained in:
Veluri Mithun 2018-05-30 11:15:59 +05:30
parent 307c09cff3
commit 71523ec35c
1 changed files with 7 additions and 2 deletions

View File

@ -36,6 +36,7 @@ Job template example:
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
class Folder(jenkins_jobs.modules.base.Base):
@ -50,7 +51,11 @@ class Folder(jenkins_jobs.modules.base.Base):
XML.SubElement(xml_parent, 'views')
attributes = {"class": "hudson.views.DefaultViewsTabBar"}
XML.SubElement(xml_parent, 'viewsTabBar', attrib=attributes)
XML.SubElement(xml_parent, 'primaryView').text = 'All'
XML.SubElement(xml_parent, 'healthMetrics')
mappings = [
('', 'primaryView', 'All'),
('', 'healthMetrics', ''),
]
convert_mapping_to_xml(xml_parent, data, mappings, True)
return xml_parent