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
This commit is contained in:
Daniel Watkins 2018-05-30 16:27:07 -04:00
parent 307c09cff3
commit 3e72803eec
2 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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):