From c72cf731efe985ccb4afc9f7c3c423e5090ea868 Mon Sep 17 00:00:00 2001 From: Will Soula Date: Tue, 1 Dec 2015 15:09:20 -0600 Subject: [PATCH] Fix pollscm backwards compatiblity This change https://review.openstack.org/#/c/211993/ made '' an invalid attribute value for pollscm, but that is a valid value. We use '' for pollscm with the option to build when a changed is pushed to github. This might have changed since we set it up, but you had to specify a blank poll schedule for jenkins to build on pushes to github. This changes allows '' as a valid value. Change-Id: I35c45b4619584b3358562131399fc5ef16c4c5ec --- jenkins_jobs/modules/triggers.py | 2 +- tests/triggers/fixtures/pollscm004.xml | 9 +++++++++ tests/triggers/fixtures/pollscm004.yaml | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/triggers/fixtures/pollscm004.xml create mode 100644 tests/triggers/fixtures/pollscm004.yaml diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index 4f42cc00a..f42d56407 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -632,7 +632,7 @@ def pollscm(parser, xml_parent, data): cron = data ipch = 'false' - if not cron: + if not cron and cron != '': raise InvalidAttributeError('cron', cron) scmtrig = XML.SubElement(xml_parent, 'hudson.triggers.SCMTrigger') diff --git a/tests/triggers/fixtures/pollscm004.xml b/tests/triggers/fixtures/pollscm004.xml new file mode 100644 index 000000000..239bed26e --- /dev/null +++ b/tests/triggers/fixtures/pollscm004.xml @@ -0,0 +1,9 @@ + + + + + + false + + + diff --git a/tests/triggers/fixtures/pollscm004.yaml b/tests/triggers/fixtures/pollscm004.yaml new file mode 100644 index 000000000..3d0d9d5e3 --- /dev/null +++ b/tests/triggers/fixtures/pollscm004.yaml @@ -0,0 +1,3 @@ +triggers: + - pollscm: + cron: ""