summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-04-26 02:33:15 +0000
committerGerrit Code Review <review@openstack.org>2018-04-26 02:33:15 +0000
commit53523f9727eff9b8d1f292f790a6e9e3e250f131 (patch)
treecde591b72902590eec4a8afbe9824f196f64fea4
parent96f112e915977afd25be1a1e8d3c257a4c768297 (diff)
parent7ebe78979166e36a038a116788c33383878ced20 (diff)
Merge "Update build_blocker to make use of convert_mapping_to_xml()"
-rw-r--r--jenkins_jobs/modules/properties.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py
index f5f0df1..ab521ea 100644
--- a/jenkins_jobs/modules/properties.py
+++ b/jenkins_jobs/modules/properties.py
@@ -558,28 +558,19 @@ def build_blocker(registry, xml_parent, data):
558 raise JenkinsJobsException('blocking-jobs field is missing') 558 raise JenkinsJobsException('blocking-jobs field is missing')
559 elif data.get('blocking-jobs', None) is None: 559 elif data.get('blocking-jobs', None) is None:
560 raise JenkinsJobsException('blocking-jobs list must not be empty') 560 raise JenkinsJobsException('blocking-jobs list must not be empty')
561 XML.SubElement(blocker, 'useBuildBlocker').text = str( 561
562 data.get('use-build-blocker', True)).lower()
563 jobs = '' 562 jobs = ''
564 for value in data['blocking-jobs']: 563 for value in data['blocking-jobs']:
565 jobs = jobs + value + '\n' 564 jobs = jobs + value + '\n'
566 XML.SubElement(blocker, 'blockingJobs').text = jobs 565 mapping = [
567 566 ('use-build-blocker', 'useBuildBlocker', True),
568 block_level_list = ('GLOBAL', 'NODE') 567 ('', 'blockingJobs', jobs),
569 block_level = data.get('block-level', 'GLOBAL') 568 ('blocking-level', 'blockLevel', 'GLOBAL', ('GLOBAL', 'NODE')),
570 if block_level not in block_level_list: 569 ('queue-scanning', 'scanQueueFor', 'DISABLED',
571 raise InvalidAttributeError('block-level', 570 ('DISABLED', 'ALL', 'BUILDABLE')),
572 block_level, 571 ]
573 block_level_list) 572 helpers.convert_mapping_to_xml(
574 XML.SubElement(blocker, 'blockLevel').text = block_level 573 blocker, data, mapping, fail_required=True)
575
576 queue_scanning_list = ('DISABLED', 'ALL', 'BUILDABLE')
577 queue_scanning = data.get('queue-scanning', 'DISABLED')
578 if queue_scanning not in queue_scanning_list:
579 raise InvalidAttributeError('queue-scanning',
580 queue_scanning,
581 queue_scanning_list)
582 XML.SubElement(blocker, 'scanQueueFor').text = queue_scanning
583 574
584 575
585def copyartifact(registry, xml_parent, data): 576def copyartifact(registry, xml_parent, data):