Merge "Make the deprecated plugin config messaging clearer"

This commit is contained in:
Zuul 2018-05-31 18:38:05 +00:00 committed by Gerrit Code Review
commit e5d2ee5944
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):