diff options
author | 2015-07-28 21:39:37 -0700 | |
---|---|---|
committer | 2015-08-02 20:59:36 -0700 | |
commit | 79b95d1d05ed9ce82b94167074b068e63cfa2cb8 (patch) | |
tree | f125be15b7b4eca6132aa64067c5886a3c2c53e5 | |
parent | gkeys/base.py: Add missing action and timestamp attributes (diff) | |
download | gentoo-keys-79b95d1d05ed9ce82b94167074b068e63cfa2cb8.tar.gz gentoo-keys-79b95d1d05ed9ce82b94167074b068e63cfa2cb8.tar.bz2 gentoo-keys-79b95d1d05ed9ce82b94167074b068e63cfa2cb8.zip |
gkeys: Fix the user config location and operation
Move the config to ~/.config/gkeys/ along with the logs.
Fix the improper ensure_dirs() call in base.py.
-rw-r--r-- | gkeys/gkeys/base.py | 5 | ||||
-rw-r--r-- | gkeys/gkeys/config.py | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py index 7fd9908..970ad7c 100644 --- a/gkeys/gkeys/base.py +++ b/gkeys/gkeys/base.py @@ -299,8 +299,8 @@ class CliBase(object): if not self.config.defaults['homedir']: self.config.defaults['homedir'] = os.path.expanduser('~') if not os.access(self.config['logdir'], os.W_OK): - self.config['logdir'] = ensure_dirs( - os.path.join(self.config['user-dir'], 'logs')) + self.config.options['logdir'] = os.path.join(self.config['userconfigdir'], 'logs') + ensure_dirs(self.config.options['logdir']) # establish our logger and update it in the imported files self.logger = set_logger(self.cli_config['prog'], self.config['logdir'], args.debug, dirmode=int(self.config.get_key('permissions', 'directories'),0), @@ -314,6 +314,7 @@ class CliBase(object): if args.config: self.logger.debug("Main: run; Found alternate config request: %s" % args.config) + self.logger.debug("Main: run; Using config: %s" % self.config['config']) # check if a -C, --category was input # if it was, check if the category is listed in the [seeds] diff --git a/gkeys/gkeys/config.py b/gkeys/gkeys/config.py index 7cd856a..592aad6 100644 --- a/gkeys/gkeys/config.py +++ b/gkeys/gkeys/config.py @@ -54,10 +54,11 @@ class GKeysConfig(GPGConfig): def _set_default_config(self): self.defaults['homedir'] = os.path.expanduser('~') - self.defaults['configdir'] = os.path.join( - self.defaults['homedir'], '.gkeys') + self.defaults['userconfigdir'] = os.path.join( + self.defaults['homedir'], '.config', 'gkeys') + self.defaults['configdir'] = self.defaults['userconfigdir'] self.defaults['config']= os.path.join( - self.defaults['configdir'], 'gkeys.conf') + self.defaults['userconfigdir'], 'gkeys.conf') if not os.path.exists(self.defaults['config']): self.defaults['configdir'] = path([self.root, EPREFIX, '/etc/gkeys']) self.defaults['config'] = '%(configdir)s/gkeys.conf' @@ -101,6 +102,9 @@ class GKeysConfig(GPGConfig): defaults[key] = self.defaults[key] if filename == None: filename = self.defaults['config'] + if "foo-bar'd" in filename: + print("Config: read_config(); Configuration ERROR: filename: %s, access: %s" + % (filename, os.access(filename, os.R_OK))) self.configparser = SaneConfigParser(defaults) self.configparser.read(filename) if self.configparser.has_section('base'): |