summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/general.py
diff options
context:
space:
mode:
authorDzmitry Horbach <dim.horbach@gmail.com>2013-10-28 12:18:07 +0300
committerDzmitry Horbach <dim.horbach@gmail.com>2013-10-28 12:18:07 +0300
commitf2b10c14a9dc4eff2a69d915e35e73bd1400aebb (patch)
tree9a4623feb2e3ea354047d90059d51ba38282da91 /jenkins_jobs/modules/general.py
parentee72a9293630a31ca297cc2bce293ca3c2289d87 (diff)
downloadpython-jenkins-job-builder-f2b10c14a9dc4eff2a69d915e35e73bd1400aebb.tar.gz
python-jenkins-job-builder-f2b10c14a9dc4eff2a69d915e35e73bd1400aebb.tar.xz
python-jenkins-job-builder-f2b10c14a9dc4eff2a69d915e35e73bd1400aebb.zip
Added default value of -1 for all logrotate attributes
You don't need to specify all logrotate explicitely as -1 if you don't want to manage them. Jenkins will automatically populate them as -1 if you don't enter any value. Change-Id: Id9ee223d94e2c43cd0a1c1f5547a25858873ed92
Diffstat (limited to 'jenkins_jobs/modules/general.py')
-rw-r--r--jenkins_jobs/modules/general.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py
index 9b96516b..b349f875 100644
--- a/jenkins_jobs/modules/general.py
+++ b/jenkins_jobs/modules/general.py
@@ -17,6 +17,8 @@
The Logrotate section allows you to automatically remove old build
history. It adds the ``logrotate`` attribute to the :ref:`Job`
definition.
+All logrotate attributes have default "-1" value so you don't need to specify
+that explicitly
Example::
@@ -99,10 +101,10 @@ class General(jenkins_jobs.modules.base.Base):
lr_xml = XML.SubElement(xml, 'logRotator')
logrotate = data['logrotate']
lr_days = XML.SubElement(lr_xml, 'daysToKeep')
- lr_days.text = str(logrotate['daysToKeep'])
+ lr_days.text = str(logrotate.get('daysToKeep', -1))
lr_num = XML.SubElement(lr_xml, 'numToKeep')
- lr_num.text = str(logrotate['numToKeep'])
+ lr_num.text = str(logrotate.get('numToKeep', -1))
lr_adays = XML.SubElement(lr_xml, 'artifactDaysToKeep')
- lr_adays.text = str(logrotate['artifactDaysToKeep'])
+ lr_adays.text = str(logrotate.get('artifactDaysToKeep', -1))
lr_anum = XML.SubElement(lr_xml, 'artifactNumToKeep')
- lr_anum.text = str(logrotate['artifactNumToKeep'])
+ lr_anum.text = str(logrotate.get('artifactNumToKeep', -1))