From 3e72803eec840e582ac526b99344475d758de38e Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Wed, 30 May 2018 16:27:07 -0400 Subject: [PATCH] Make the deprecated plugin config messaging clearer At the moment, if you don't know that you have configuration for the given plugin in your config file, there's nothing that actually suggests that's where you should start looking to fix this. Change-Id: I32481eb9b1a4feafc8b8ca2cec63e4b9a0b29441 Story: 2001735 Task: 12090 --- jenkins_jobs/config.py | 11 +++++++---- tests/cmd/test_config.py | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/jenkins_jobs/config.py b/jenkins_jobs/config.py index 7b0c2a1d8..c4e638078 100644 --- a/jenkins_jobs/config.py +++ b/jenkins_jobs/config.py @@ -51,6 +51,11 @@ query_plugins_info=False CONFIG_REQUIRED_MESSAGE = ("A valid configuration file is required. " "No configuration file passed.") +DEPRECATED_PLUGIN_CONFIG_SECTION_MESSAGE = ( + "Defining plugin configuration using a [{plugin}] section in your config" + " file is deprecated. The recommended way to define plugins now is by" + " using a [plugin \"{plugin}\"] section" +) _NOTSET = object() @@ -353,8 +358,6 @@ class JJBConfig(object): 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 + "\"]") - + DEPRECATED_PLUGIN_CONFIG_SECTION_MESSAGE.format( + plugin=plugin)) return value diff --git a/tests/cmd/test_config.py b/tests/cmd/test_config.py index d1cae5874..0bb36a6b7 100644 --- a/tests/cmd/test_config.py +++ b/tests/cmd/test_config.py @@ -94,14 +94,14 @@ class TestConfigs(CmdTestsBase): jenkins_jobs.jjb_config.get_plugin_config( 'new_plugin', 'setting') self.assertIn( - 'Defining plugin configuration using [old_plugin] is deprecated', + 'using a [old_plugin] section in your config file is deprecated', self.logger.output) self.assertNotIn( - 'Defining plugin configuration using [old_plugin_no_conf] is ' + 'using a [old_plugin_no_conf] secton in your config file is ' 'deprecated', self.logger.output) self.assertNotIn( - 'Defining plugin configuration using [new_plugin] is deprecated', + 'using a [new_plugin] section in your config file is deprecated', self.logger.output) def test_config_options_not_replaced_by_cli_defaults(self):