summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWayne Warren <waynr+launchpad@sdf.org>2016-01-02 16:11:21 -0800
committerWayne Warren <waynr+launchpad@sdf.org>2016-08-05 09:01:30 -0700
commitf9b3c4e6a772e5d64b96d4c057c8b666d122b149 (patch)
tree94a10948b9f4f2f10172c64d455e0e058003b47b
parent4350690b61428201fcb3f1b622f4ef0a60fdf66b (diff)
downloadpython-jenkins-job-builder-f9b3c4e6a772e5d64b96d4c057c8b666d122b149.tar.gz
python-jenkins-job-builder-f9b3c4e6a772e5d64b96d4c057c8b666d122b149.tar.xz
python-jenkins-job-builder-f9b3c4e6a772e5d64b96d4c057c8b666d122b149.zip
Remove YamlParser references from JJB modules.
Change-Id: Ia9ca686c4040fd27890dbce99fda3db3e99a1102
-rw-r--r--jenkins_jobs/modules/base.py16
-rw-r--r--jenkins_jobs/modules/zuul.py7
-rw-r--r--jenkins_jobs/parser.py2
3 files changed, 14 insertions, 11 deletions
diff --git a/jenkins_jobs/modules/base.py b/jenkins_jobs/modules/base.py
index d3c7e319..9a070237 100644
--- a/jenkins_jobs/modules/base.py
+++ b/jenkins_jobs/modules/base.py
@@ -57,14 +57,16 @@ class Base(object):
def __init__(self, registry):
self.registry = registry
- def handle_data(self, parser):
+ def handle_data(self, job_data):
"""This method is called before any XML is generated. By
- overriding this method, the module may manipulate the YAML
- data structure on the parser however it likes before any XML
- is generated. If it has changed the data structure at all, it
- must return ``True``, otherwise, it must return ``False``.
-
- :arg YAMLParser parser: the global YAML Parser
+ overriding this method, a module may arbitrarily modify a data
+ structure which will probably be the JJB YamlParser's intermediate data
+ representation. If it has changed the data structure at all, it must
+ return ``True``, otherwise, it must return ``False``.
+
+ :arg dict job_data: the intermediate representation of job data
+ loaded from JJB Yaml files without variables interpolation or other
+ yaml expansions.
:rtype: boolean
"""
diff --git a/jenkins_jobs/modules/zuul.py b/jenkins_jobs/modules/zuul.py
index 3022dc80..69de851d 100644
--- a/jenkins_jobs/modules/zuul.py
+++ b/jenkins_jobs/modules/zuul.py
@@ -135,10 +135,11 @@ ZUUL_POST_PARAMETERS = [
class Zuul(jenkins_jobs.modules.base.Base):
sequence = 0
- def handle_data(self, parser):
+ def handle_data(self, job_data):
changed = False
- jobs = itertools.chain(parser.data.get('job', {}).values(),
- parser.data.get('job-template', {}).values())
+ jobs = itertools.chain(
+ job_data.get('job', {}).values(),
+ job_data.get('job-template', {}).values())
for job in jobs:
triggers = job.get('triggers')
if not triggers:
diff --git a/jenkins_jobs/parser.py b/jenkins_jobs/parser.py
index 6ecd7404..f88d341d 100644
--- a/jenkins_jobs/parser.py
+++ b/jenkins_jobs/parser.py
@@ -226,7 +226,7 @@ class YamlParser(object):
changed = False
for module in self.registry.modules:
if hasattr(module, 'handle_data'):
- if module.handle_data(self):
+ if module.handle_data(self.data):
changed = True
for job in self.data.get('job', {}).values():