Merge "Ensure flush cache option obeyed"
This commit is contained in:
commit
d2de06a38a
@ -84,6 +84,7 @@ class JenkinsJobs(object):
|
||||
def _parse_additional(self):
|
||||
|
||||
self._set_config(self.jjb_config.builder, 'ignore_cache')
|
||||
self._set_config(self.jjb_config.builder, 'flush_cache')
|
||||
self._set_config(self.jjb_config.yamlparser, 'allow_empty_variables')
|
||||
self._set_config(self.jjb_config.jenkins, 'user')
|
||||
self._set_config(self.jjb_config.jenkins, 'password')
|
||||
|
@ -50,7 +50,7 @@ def create_parser():
|
||||
'--flush-cache',
|
||||
action='store_true',
|
||||
dest='flush_cache',
|
||||
default=False,
|
||||
default=None,
|
||||
help='''flush all the cache entries before updating''')
|
||||
parser.add_argument(
|
||||
'--version',
|
||||
|
@ -160,8 +160,7 @@ class JJBConfig(object):
|
||||
|
||||
logger.debug("Config: {0}".format(config))
|
||||
|
||||
# check the ignore_cache setting: first from command line,
|
||||
# if not present check from ini file
|
||||
# check the ignore_cache setting
|
||||
if config.has_option('jenkins', 'ignore_cache'):
|
||||
logging.warn('''ignore_cache option should be moved to the
|
||||
[job_builder] section in the config file, the one
|
||||
@ -172,6 +171,10 @@ class JJBConfig(object):
|
||||
self.ignore_cache = config.getboolean('job_builder',
|
||||
'ignore_cache')
|
||||
|
||||
# check the flush_cache setting
|
||||
if config.has_option('job_builder', 'flush_cache'):
|
||||
self.flush_cache = config.getboolean('job_builder', 'flush_cache')
|
||||
|
||||
# Jenkins supports access as an anonymous user, which can be used to
|
||||
# ensure read-only behaviour when querying the version of plugins
|
||||
# installed for test mode to generate XML output matching what will be
|
||||
|
@ -5,3 +5,4 @@ password=jenkins_password
|
||||
[job_builder]
|
||||
allow_empty_variables=True
|
||||
ignore_cache=True
|
||||
flush_cache=True
|
||||
|
@ -87,6 +87,7 @@ class TestConfigs(CmdTestsBase):
|
||||
self.assertEqual(jjb_config.jenkins['user'], "jenkins_user")
|
||||
self.assertEqual(jjb_config.jenkins['password'], "jenkins_password")
|
||||
self.assertEqual(jjb_config.builder['ignore_cache'], True)
|
||||
self.assertEqual(jjb_config.builder['flush_cache'], True)
|
||||
self.assertEqual(
|
||||
jjb_config.yamlparser['allow_empty_variables'], True)
|
||||
|
||||
@ -96,12 +97,13 @@ class TestConfigs(CmdTestsBase):
|
||||
when non of the global CLI options are set.
|
||||
"""
|
||||
args = ['--user', 'myuser', '--password', 'mypassword',
|
||||
'--ignore-cache', '--allow-empty-variables',
|
||||
'--ignore-cache', '--flush-cache', '--allow-empty-variables',
|
||||
'test', 'dummy.yaml']
|
||||
jenkins_jobs = entry.JenkinsJobs(args)
|
||||
jjb_config = jenkins_jobs.jjb_config
|
||||
self.assertEqual(jjb_config.jenkins['user'], "myuser")
|
||||
self.assertEqual(jjb_config.jenkins['password'], "mypassword")
|
||||
self.assertEqual(jjb_config.builder['ignore_cache'], True)
|
||||
self.assertEqual(jjb_config.builder['flush_cache'], True)
|
||||
self.assertEqual(
|
||||
jjb_config.yamlparser['allow_empty_variables'], True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user