summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/reporters.py
diff options
context:
space:
mode:
authorWayne Warren <waynr+launchpad@sdf.org>2016-01-02 18:52:48 -0800
committerThanh Ha <thanh.ha@linuxfoundation.org>2016-08-18 22:42:24 -0400
commitae1fb60f16fe4910d1c1e480368aa756eff4befa (patch)
treee5817999779e744931aae0510f8b8f33e82fe06e /jenkins_jobs/modules/reporters.py
parent8c9c50b1f68774fc563fc17a9cfff501a1a7b812 (diff)
downloadpython-jenkins-job-builder-ae1fb60f16fe4910d1c1e480368aa756eff4befa.tar.gz
python-jenkins-job-builder-ae1fb60f16fe4910d1c1e480368aa756eff4befa.tar.xz
python-jenkins-job-builder-ae1fb60f16fe4910d1c1e480368aa756eff4befa.zip
Disentangle YamlParser and ModuleRegistry classes
Create the ModuleRegistry anywhere other than inside the YamlParser class. This will make it slightly easier to factor a XmlGenerator out of YamlParser, but I also want to work toward eliminating the circular references between YamlParser and ModuleRegistry which have been making it difficult to understand overall program flow. This commit also replaces all YamlParser instances being passed to Jenkins job config generating functions with a ModuleRegistry. Mostly it seems like the parser was only needed to call the ModuleRegistry's 'dispatch' method which to be honest I don't fully understand. This is where the circular references mentioned in previously come in...it seems like the "dispatch" function needs access to the (mostly) raw data contained by the parser, so it took that as a parameter. The need for the YamlParser's job data can be satisfied by assigning it to a property on the ModuleRegistry object before Yaml expansion or XML generation begins; by doing this, we allow the ModuleRegistry to avoid referencing the parser. Change-Id: I4b571299b81e708540392ad963163fe092acf1d9
Diffstat (limited to 'jenkins_jobs/modules/reporters.py')
-rw-r--r--jenkins_jobs/modules/reporters.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/jenkins_jobs/modules/reporters.py b/jenkins_jobs/modules/reporters.py
index d562e938..86ab179b 100644
--- a/jenkins_jobs/modules/reporters.py
+++ b/jenkins_jobs/modules/reporters.py
@@ -39,7 +39,7 @@ from jenkins_jobs.modules.helpers import build_trends_publisher
from jenkins_jobs.modules.helpers import findbugs_settings
-def email(parser, xml_parent, data):
+def email(registry, xml_parent, data):
"""yaml: email
Email notifications on build failure.
@@ -71,7 +71,7 @@ def email(parser, xml_parent, data):
XML.SubElement(mailer, 'perModuleEmail').text = 'true'
-def findbugs(parser, xml_parent, data):
+def findbugs(registry, xml_parent, data):
"""yaml: findbugs
FindBugs reporting for builds
@@ -142,7 +142,7 @@ class Reporters(jenkins_jobs.modules.base.Base):
component_type = 'reporter'
component_list_type = 'reporters'
- def gen_xml(self, parser, xml_parent, data):
+ def gen_xml(self, xml_parent, data):
if 'reporters' not in data:
return
@@ -153,4 +153,4 @@ class Reporters(jenkins_jobs.modules.base.Base):
reporters = XML.SubElement(xml_parent, 'reporters')
for action in data.get('reporters', []):
- self.registry.dispatch('reporter', parser, reporters, action)
+ self.registry.dispatch('reporter', reporters, action)