summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/reporters.py
diff options
context:
space:
mode:
authorArnaud Fabre <fabre.arnaud@gmail.com>2013-04-14 21:36:20 +0200
committerJenkins <jenkins@review.openstack.org>2013-04-24 17:50:32 +0000
commit38f57ae400abf6d3c656c6b1a8d6197d93a4157e (patch)
tree79e8ace191bbc895a461f18984342a74603e7ebf /jenkins_jobs/modules/reporters.py
parent50134954e8c61705062e98d47303c2ba7cea74f5 (diff)
downloadpython-jenkins-job-builder-38f57ae400abf6d3c656c6b1a8d6197d93a4157e.tar.gz
python-jenkins-job-builder-38f57ae400abf6d3c656c6b1a8d6197d93a4157e.tar.xz
python-jenkins-job-builder-38f57ae400abf6d3c656c6b1a8d6197d93a4157e.zip
Make reuse of builders/publishers inside other components easier.
Some Jenkins plugins depend on other plugins, and their configuration section is a mix of both plugins. For Jenkins Job Builder, that means reusing one component directly from another one. Driving the generation of XML markup is the job of Base._dispatch. Unfortunately, components do not have access to their module object, and even if their could, _dispatch would still be a non-public method. Refactor Base._dispatch into ModuleRegistry.dispatch, which can be used from any place where the parser is available. Base and ModuleRegistry are extended so that the registry can discover which entry point must be used for each module, if appropriate. ModuleRegistry.dispatch signature can be simplified by dropping component_list_type parameter. Change-Id: Ie9d090817d0c2d464745b5634a22d3cea6a47ab1 Reviewed-on: https://review.openstack.org/26051 Reviewed-by: James E. Blair <corvus@inaugust.com> Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Approved: Clark Boylan <clark.boylan@gmail.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Tested-by: Jenkins
Diffstat (limited to 'jenkins_jobs/modules/reporters.py')
-rw-r--r--jenkins_jobs/modules/reporters.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/jenkins_jobs/modules/reporters.py b/jenkins_jobs/modules/reporters.py
index 2ebbb8f1..298e912f 100644
--- a/jenkins_jobs/modules/reporters.py
+++ b/jenkins_jobs/modules/reporters.py
@@ -71,6 +71,9 @@ def email(parser, xml_parent, data):
class Reporters(jenkins_jobs.modules.base.Base):
sequence = 55
+ component_type = 'reporter'
+ component_list_type = 'reporters'
+
def gen_xml(self, parser, xml_parent, data):
if 'reporters' not in data:
return
@@ -81,5 +84,4 @@ class Reporters(jenkins_jobs.modules.base.Base):
reporters = XML.SubElement(xml_parent, 'reporters')
for action in data.get('reporters', []):
- self._dispatch('reporter', 'reporters',
- parser, reporters, action)
+ self.registry.dispatch('reporter', parser, reporters, action)