diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-06-26 21:20:49 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-06-26 21:20:49 +0000 |
commit | 559e56256a4cae2b4e928f520912cccdf03a3063 (patch) | |
tree | d24820f437e385238066cc9be88f35880889ecb5 /zuul/scheduler.py | |
parent | b5910f1f903a2d041d643a0261031465c86d57ae (diff) | |
parent | 91601d788e414be3766d574c0dc67d4592de80fb (diff) | |
download | zuul-559e56256a4cae2b4e928f520912cccdf03a3063.tar.gz |
Merge "config: refactor config get default" into feature/zuulv3
Diffstat (limited to 'zuul/scheduler.py')
-rw-r--r-- | zuul/scheduler.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/zuul/scheduler.py b/zuul/scheduler.py index 207616313..c76230997 100644 --- a/zuul/scheduler.py +++ b/zuul/scheduler.py @@ -30,6 +30,7 @@ from zuul import configloader from zuul import model from zuul import exceptions from zuul import version as zuul_version +from zuul.lib.config import get_default class ManagementEvent(object): @@ -371,30 +372,21 @@ class Scheduler(threading.Thread): self.log.debug("Waiting for exit") def _get_queue_pickle_file(self): - if self.config.has_option('zuul', 'state_dir'): - state_dir = os.path.expanduser(self.config.get('zuul', - 'state_dir')) - else: - state_dir = '/var/lib/zuul' + state_dir = get_default(self.config, 'zuul', 'state_dir', + '/var/lib/zuul', expand_user=True) return os.path.join(state_dir, 'queue.pickle') def _get_time_database_dir(self): - if self.config.has_option('zuul', 'state_dir'): - state_dir = os.path.expanduser(self.config.get('zuul', - 'state_dir')) - else: - state_dir = '/var/lib/zuul' + state_dir = get_default(self.config, 'zuul', 'state_dir', + '/var/lib/zuul', expand_user=True) d = os.path.join(state_dir, 'times') if not os.path.exists(d): os.mkdir(d) return d def _get_project_key_dir(self): - if self.config.has_option('zuul', 'state_dir'): - state_dir = os.path.expanduser(self.config.get('zuul', - 'state_dir')) - else: - state_dir = '/var/lib/zuul' + state_dir = get_default(self.config, 'zuul', 'state_dir', + '/var/lib/zuul', expand_user=True) key_dir = os.path.join(state_dir, 'keys') if not os.path.exists(key_dir): os.mkdir(key_dir, 0o700) |