summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/config.py
diff options
context:
space:
mode:
authorDarragh Bailey <dbailey@hpe.com>2017-12-15 14:18:11 +0000
committerDarragh Bailey <dbailey@hpe.com>2017-12-15 14:18:11 +0000
commit630fc6e88a77c0eab1bc8dd9d4f0c9df3a58508d (patch)
treec08a70739e959c28e70cab29af60ff23425392d2 /jenkins_jobs/config.py
parentc4aab5c22d3f2834d204fae9bf01f095f2739c31 (diff)
downloadpython-jenkins-job-builder-630fc6e88a77c0eab1bc8dd9d4f0c9df3a58508d.tar.gz
python-jenkins-job-builder-630fc6e88a77c0eab1bc8dd9d4f0c9df3a58508d.tar.xz
python-jenkins-job-builder-630fc6e88a77c0eab1bc8dd9d4f0c9df3a58508d.zip
No warn on old plugin conf format not in use
Use a simple object to ensure matching against any default value is possible to distinguish been not being set by a user versus use of a negative default value passed. This prevents triggering an incorrect notification to the user when the code is querying for plugin options that could override the default behaviour and the compatibility code attempts to look up an non existing section. It would fail to distinguish between no section present and current value to return matching the default value suggested. Change-Id: I5597c2628ccb5a4282a97a4ce5d3bbe41bd9eebb
Diffstat (limited to 'jenkins_jobs/config.py')
-rw-r--r--jenkins_jobs/config.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/jenkins_jobs/config.py b/jenkins_jobs/config.py
index 58016051..5abadae6 100644
--- a/jenkins_jobs/config.py
+++ b/jenkins_jobs/config.py
@@ -51,6 +51,7 @@ query_plugins_info=True
CONFIG_REQUIRED_MESSAGE = ("A valid configuration file is required. "
"No configuration file passed.")
+_NOTSET = object()
class JJBConfig(object):
@@ -354,10 +355,13 @@ class JJBConfig(object):
# plugin configuration format in their config. This code should be
# removed in future versions of JJB after 2.0.
if value is default:
- value = self.get_module_config(plugin, key, default)
- logger.warning(
- "Defining plugin configuration using [" + plugin + "] is"
- " deprecated. The recommended way to define plugins now is by"
- " configuring [plugin \"" + plugin + "\"]")
+ old_value = self.get_module_config(plugin, key, _NOTSET)
+ # only log warning if detected a plugin config setting.
+ if old_value is not _NOTSET:
+ value = old_value
+ logger.warning(
+ "Defining plugin configuration using [" + plugin + "] is "
+ "deprecated. The recommended way to define plugins now is "
+ "by configuring [plugin \"" + plugin + "\"]")
return value