summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/general.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/general.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/general.py')
-rw-r--r--jenkins_jobs/modules/general.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py
index b1268c13..62b5626a 100644
--- a/jenkins_jobs/modules/general.py
+++ b/jenkins_jobs/modules/general.py
@@ -117,7 +117,7 @@ class General(jenkins_jobs.modules.base.Base):
sequence = 10
logrotate_warn_issued = False
- def gen_xml(self, parser, xml, data):
+ def gen_xml(self, xml, data):
jdk = data.get('jdk', None)
if jdk:
XML.SubElement(xml, 'jdk').text = jdk
@@ -190,10 +190,10 @@ class General(jenkins_jobs.modules.base.Base):
lr_anum.text = str(logrotate.get('artifactNumToKeep', -1))
if 'raw' in data:
- raw(parser, xml, data['raw'])
+ raw(self.registry, xml, data['raw'])
-def raw(parser, xml_parent, data):
+def raw(registry, xml_parent, data):
# documented in definition.rst since includes and docs is not working well
# For cross cutting method like this
root = XML.fromstring(data.get('xml'))