summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/general.py
diff options
context:
space:
mode:
authorDavid Caro <dcaroest@redhat.com>2013-08-02 22:12:56 +0200
committerDavid Caro <dcaroest@redhat.com>2013-08-02 22:12:56 +0200
commita016f0ce17890bddf03da7fb9d99415a0f8075ad (patch)
treefde87164ea6a56ac02bb006fafb80727c3398011 /jenkins_jobs/modules/general.py
parentc9695f11ab1fe6faef126bc5fe9fe5ba7f141cbd (diff)
downloadpython-jenkins-job-builder-a016f0ce17890bddf03da7fb9d99415a0f8075ad.tar.gz
python-jenkins-job-builder-a016f0ce17890bddf03da7fb9d99415a0f8075ad.tar.xz
python-jenkins-job-builder-a016f0ce17890bddf03da7fb9d99415a0f8075ad.zip
Not sending description or disabled by default
To be able to manually disable/enable a job and edit it's description I've disabled sending the description or the disabled options if they are not specifically specified. So now when no description or not disabled is specified in the yaml, they will not be changed in the job. Change-Id: Iad3e61eabd0acd057ad45df7784fa7788246172c Signed-off-by: David Caro <dcaroest@redhat.com>
Diffstat (limited to 'jenkins_jobs/modules/general.py')
-rw-r--r--jenkins_jobs/modules/general.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py
index 3552b4de..9b96516b 100644
--- a/jenkins_jobs/modules/general.py
+++ b/jenkins_jobs/modules/general.py
@@ -55,13 +55,17 @@ class General(jenkins_jobs.modules.base.Base):
if jdk:
XML.SubElement(xml, 'jdk').text = jdk
XML.SubElement(xml, 'actions')
- description = XML.SubElement(xml, 'description')
- description.text = data.get('description', '')
+ desc_text = data.get('description', None)
+ if desc_text is not None:
+ description = XML.SubElement(xml, 'description')
+ description.text = desc_text
XML.SubElement(xml, 'keepDependencies').text = 'false'
- if data.get('disabled'):
- XML.SubElement(xml, 'disabled').text = 'true'
- else:
- XML.SubElement(xml, 'disabled').text = 'false'
+ disabled = data.get('disabled', None)
+ if disabled is not None:
+ if disabled:
+ XML.SubElement(xml, 'disabled').text = 'true'
+ else:
+ XML.SubElement(xml, 'disabled').text = 'false'
if data.get('block-downstream'):
XML.SubElement(xml,
'blockBuildWhenDownstreamBuilding').text = 'true'