diff options
author | Yolande Amate <yolandeamate@gmail.com> | 2017-06-23 03:05:56 +0100 |
---|---|---|
committer | Yolande Amate <yolandeamate@gmail.com> | 2017-07-05 18:24:07 +0100 |
commit | 1e41803bad17be4fc0fcf03a0f9201dbe1f0381b (patch) | |
tree | 2bd8c010dff3a664abf6ce872c57b95394e9bb28 /jenkins_jobs/modules/properties.py | |
parent | de631d49d3505597d65fb18785a2e65fcfde9211 (diff) | |
download | python-jenkins-job-builder-1e41803bad17be4fc0fcf03a0f9201dbe1f0381b.tar.gz python-jenkins-job-builder-1e41803bad17be4fc0fcf03a0f9201dbe1f0381b.tar.xz python-jenkins-job-builder-1e41803bad17be4fc0fcf03a0f9201dbe1f0381b.zip |
Update slave_utilization use of convert_mapping_to_xml()
Change-Id: Ifa489ad11f5825b254dd8602cdbd1ff0014736a4
Diffstat (limited to 'jenkins_jobs/modules/properties.py')
-rw-r--r-- | jenkins_jobs/modules/properties.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index 8eee680f..44366d27 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -642,13 +642,16 @@ def slave_utilization(registry, xml_parent, data): """ utilization = XML.SubElement( xml_parent, 'com.suryagaddipati.jenkins.SlaveUtilizationProperty') + percent = int(data.get('slave-percentage', 0)) - XML.SubElement(utilization, 'needsExclusiveAccessToNode' - ).text = 'true' if percent else 'false' - XML.SubElement(utilization, 'slaveUtilizationPercentage' - ).text = str(percent) - XML.SubElement(utilization, 'singleInstancePerSlave').text = str( - data.get('single-instance-per-slave', False)).lower() + exclusive_node_access = True if percent else False + + mapping = [ + ('', 'needsExclusiveAccessToNode', exclusive_node_access), + ('', 'slaveUtilizationPercentage', percent), + ('single-instance-per-slave', 'singleInstancePerSlave', False)] + helpers.convert_mapping_to_xml( + utilization, data, mapping, fail_required=True) def delivery_pipeline(registry, xml_parent, data): |