diff options
author | Martin Pihlak | 2011-02-09 13:08:33 +0000 |
---|---|---|
committer | Martin Pihlak | 2011-02-09 13:08:33 +0000 |
commit | 1093013c0acce01c936fd912b3aaf26355fe4d15 (patch) | |
tree | 212e8369037a6eb6cabd16bf83c2de319edd8fc6 /python/walmgr.py | |
parent | d5649a0c45de131958288ff31ebeee5a086440a5 (diff) |
Create log,pid,conf directories during --init
Diffstat (limited to 'python/walmgr.py')
-rwxr-xr-x | python/walmgr.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/python/walmgr.py b/python/walmgr.py index 9d7ca695..52eab614 100755 --- a/python/walmgr.py +++ b/python/walmgr.py @@ -347,6 +347,13 @@ class WalMgr(skytools.DBScript): self.is_master = config.has_option('master_data') + # create the log and pid files if needed + for cfk in [ "logfile", "pidfile" ]: + if config.has_option(cfk): + dirname = os.path.dirname(config.getfile(cfk)) + if not os.path.isdir(dirname): + os.makedirs(dirname) + return config def __init__(self, args): @@ -784,6 +791,12 @@ class WalMgr(skytools.DBScript): def write_walmgr_config(self, config_data): cf_name = os.path.join(os.path.expanduser(self.options.config_dir), self.cf.get("job_name") + ".ini") + + dirname = os.path.dirname(cf_name) + if not os.path.isdir(dirname): + self.log.info('Creating config directory: %s' % dirname) + os.makedirs(dirname) + self.log.info('Writing configuration file: %s' % cf_name) self.log.debug("config data:\n%s" % config_data) if not self.not_really: @@ -842,6 +855,7 @@ keep_symlinks = %(keep_symlinks)s self.write_walmgr_config(master_config) + # generate SSH key pair if requested if self.options.ssh_keygen: keyfile = os.path.expanduser("~/.ssh/id_dsa") if os.path.isfile(keyfile): |