From 45b3cd55b84a6a388c92cae00d46c62151f20e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Fri, 10 Jan 2014 15:43:44 +0100 Subject: [PATCH] maven-deploy: don't require id The id element is eg. not needed for file deployment so don't make it mandatory. Change-Id: Ide83b18cbab6010033c3bd8e8264595d1d2d5fa2 --- jenkins_jobs/modules/publishers.py | 3 ++- tests/publishers/fixtures/mavendeploy001.xml | 10 ++++++++++ tests/publishers/fixtures/mavendeploy001.yaml | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/publishers/fixtures/mavendeploy001.xml create mode 100644 tests/publishers/fixtures/mavendeploy001.yaml diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index b497df584..d50d1f6cd 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -2002,7 +2002,8 @@ def maven_deploy(parser, xml_parent, data): """ p = XML.SubElement(xml_parent, 'hudson.maven.RedeployPublisher') - XML.SubElement(p, 'id').text = data['id'] + if 'id' in data: + XML.SubElement(p, 'id').text = data['id'] XML.SubElement(p, 'url').text = data['url'] XML.SubElement(p, 'uniqueVersion').text = str( data.get('unique-version', True)).lower() diff --git a/tests/publishers/fixtures/mavendeploy001.xml b/tests/publishers/fixtures/mavendeploy001.xml new file mode 100644 index 000000000..6db0030ee --- /dev/null +++ b/tests/publishers/fixtures/mavendeploy001.xml @@ -0,0 +1,10 @@ + + + + + file:///path/to/repo + true + false + + + diff --git a/tests/publishers/fixtures/mavendeploy001.yaml b/tests/publishers/fixtures/mavendeploy001.yaml new file mode 100644 index 000000000..d16b9632d --- /dev/null +++ b/tests/publishers/fixtures/mavendeploy001.yaml @@ -0,0 +1,4 @@ +publishers: + - maven-deploy: + url: file:///path/to/repo +