Merge "remove support of old plugin config format"
This commit is contained in:
commit
5d15fe7631
|
@ -360,18 +360,5 @@ class JJBConfig(object):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_plugin_config(self, plugin, key, default=None):
|
def get_plugin_config(self, plugin, key, default=None):
|
||||||
value = self.get_module_config('plugin "{}"'.format(plugin), key,
|
return self.get_module_config('plugin "{}"'.format(plugin), key,
|
||||||
default)
|
default)
|
||||||
|
|
||||||
# Backwards compatibility for users who have not switched to the new
|
|
||||||
# plugin configuration format in their config. This code should be
|
|
||||||
# removed in future versions of JJB after 2.0.
|
|
||||||
if value is default:
|
|
||||||
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(
|
|
||||||
DEPRECATED_PLUGIN_CONFIG_SECTION_MESSAGE.format(
|
|
||||||
plugin=plugin))
|
|
||||||
return value
|
|
||||||
|
|
|
@ -1,5 +1,2 @@
|
||||||
[old_plugin]
|
|
||||||
setting = some value
|
|
||||||
|
|
||||||
[plugin "new_plugin"]
|
[plugin "new_plugin"]
|
||||||
setting = some value
|
setting = some value
|
||||||
|
|
|
@ -77,33 +77,6 @@ class TestConfigs(CmdTestsBase):
|
||||||
jenkins_jobs = entry.JenkinsJobs(args)
|
jenkins_jobs = entry.JenkinsJobs(args)
|
||||||
self.assertRaises(IOError, jenkins_jobs.execute)
|
self.assertRaises(IOError, jenkins_jobs.execute)
|
||||||
|
|
||||||
def test_config_old_plugin_format_warning(self):
|
|
||||||
"""
|
|
||||||
Run test mode and check that old plugin settings result
|
|
||||||
in a warning, while ensuring that missing sections do not
|
|
||||||
trigger the same warning if a default value is provided.
|
|
||||||
"""
|
|
||||||
args = ['--conf',
|
|
||||||
os.path.join(self.fixtures_path, 'plugin_warning.ini'),
|
|
||||||
'test', 'foo']
|
|
||||||
jenkins_jobs = entry.JenkinsJobs(args)
|
|
||||||
jenkins_jobs.jjb_config.get_plugin_config(
|
|
||||||
'old_plugin', 'setting', True)
|
|
||||||
jenkins_jobs.jjb_config.get_plugin_config(
|
|
||||||
'old_plugin_no_conf', 'setting', True)
|
|
||||||
jenkins_jobs.jjb_config.get_plugin_config(
|
|
||||||
'new_plugin', 'setting')
|
|
||||||
self.assertIn(
|
|
||||||
'using a [old_plugin] section in your config file is deprecated',
|
|
||||||
self.logger.output)
|
|
||||||
self.assertNotIn(
|
|
||||||
'using a [old_plugin_no_conf] secton in your config file is '
|
|
||||||
'deprecated',
|
|
||||||
self.logger.output)
|
|
||||||
self.assertNotIn(
|
|
||||||
'using a [new_plugin] section in your config file is deprecated',
|
|
||||||
self.logger.output)
|
|
||||||
|
|
||||||
def test_config_options_not_replaced_by_cli_defaults(self):
|
def test_config_options_not_replaced_by_cli_defaults(self):
|
||||||
"""
|
"""
|
||||||
Run test mode and check config settings from conf file retained
|
Run test mode and check config settings from conf file retained
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[stash]
|
[plugin "stash"]
|
||||||
username=user
|
username=user
|
||||||
password=pass
|
password=pass
|
||||||
|
|
Loading…
Reference in New Issue