public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/
Date: Thu,  1 Jan 2015 17:44:54 +0000 (UTC)	[thread overview]
Message-ID: <1420079977.51f847f29ddfb4af33df09eb495781850bdcb293.dolsen@gentoo> (raw)

commit:     51f847f29ddfb4af33df09eb495781850bdcb293
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 30 19:06:19 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan  1 02:39:37 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=51f847f2

gkeys: Remove the need to import gkeys seed.py and lib.py

Pass in the logger to GkeysGPG initialization.
Pass in logger to Seeds class initialization.
This removes the need to import and set the logger in base.py.
It can then be used in gkeys-gen and gkeys-ldap without those imports.
Remove no longer needed imports.

---
 gkeys/gkeys/actions.py     | 16 ++++-----
 gkeys/gkeys/base.py        | 26 +++++++--------
 gkeys/gkeys/lib.py         | 82 +++++++++++++++++++++++-----------------------
 gkeys/gkeys/seed.py        | 23 ++++++-------
 gkeys/gkeys/seedhandler.py |  4 +--
 5 files changed, 75 insertions(+), 76 deletions(-)

diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
index 9b44cc8..7682dd2 100644
--- a/gkeys/gkeys/actions.py
+++ b/gkeys/gkeys/actions.py
@@ -243,7 +243,7 @@ class Actions(object):
         keyring = self.config.get_key('keyring')
         catdir = os.path.join(keyring, args.category)
         self.logger.debug("ACTIONS: listkey; catdir = %s" % catdir)
-        self.gpg = GkeysGPG(self.config, catdir)
+        self.gpg = GkeysGPG(self.config, catdir, self.logger)
         handler = SeedHandler(self.logger, self.config)
         if args.keydir:
             self.gpg.set_keydir(args.keydir, "list-keys")
@@ -338,7 +338,7 @@ class Actions(object):
             keyring = self.config.get_key('keyring')
             catdir = os.path.join(keyring, args.category)
             self.logger.debug("ACTIONS: installkey; catdir = %s" % catdir)
-            self.gpg = GkeysGPG(self.config, catdir)
+            self.gpg = GkeysGPG(self.config, catdir, self.logger)
             results = {}
             failed = []
             for key in gkey:
@@ -374,7 +374,7 @@ class Actions(object):
         keyring = self.config.get_key('keyring')
         catdir = os.path.join(keyring, args.category)
         self.logger.debug("ACTIONS: checkkey; catdir = %s" % catdir)
-        self.gpg = GkeysGPG(self.config, catdir)
+        self.gpg = GkeysGPG(self.config, catdir, self.logger)
         results = {}
         failed = defaultdict(list)
         kwargs = handler.build_gkeydict(args)
@@ -422,7 +422,7 @@ class Actions(object):
         keyring = self.config.get_key('keyring')
         catdir = os.path.join(keyring, args.category)
         self.logger.debug("ACTIONS: speccheck; catdir = %s" % catdir)
-        self.gpg = GkeysGPG(self.config, catdir)
+        self.gpg = GkeysGPG(self.config, catdir, self.logger)
         results = {}
         failed = defaultdict(list)
         kwargs = handler.build_gkeydict(args)
@@ -588,7 +588,7 @@ class Actions(object):
             catdir = os.path.join(keyring, args.category)
             keyring_dir = self.config.get_key("keyring")
             self.logger.debug("ACTIONS: importkey; catdir = %s" % catdir)
-            self.gpg = GkeysGPG(self.config, catdir)
+            self.gpg = GkeysGPG(self.config, catdir, self.logger)
             success, gkeys = self.listseed(args)[1]
             results = {}
             failed = []
@@ -692,7 +692,7 @@ class Actions(object):
         keyrings = self.config.get_key('keyring')
         catdir = os.path.join(keyrings, args.category)
         self.logger.debug("ACTIONS: verify; catdir = %s" % catdir)
-        self.gpg = GkeysGPG(self.config, catdir)
+        self.gpg = GkeysGPG(self.config, catdir, self.logger)
         return self._verify(args, handler, key, messages)
 
 
@@ -827,7 +827,7 @@ class Actions(object):
 
         self.logger.debug("ACTIONS: sign; keydir = %s" % keydir)
 
-        self.gpg = GkeysGPG(self.config, basedir)
+        self.gpg = GkeysGPG(self.config, basedir, self.logger)
         self.gpg.set_keydir(keydir, task)
         if keyring not in ['', None]:
             self.gpg.set_keyring(keyring, task)
@@ -862,7 +862,7 @@ class Actions(object):
         keyring = self.config.get_key('keyring')
         catdir = os.path.join(keyring, args.category)
         self.logger.debug("ACTIONS: refreshkey; catdir = %s" % catdir)
-        self.gpg = GkeysGPG(self.config, catdir)
+        self.gpg = GkeysGPG(self.config, catdir, self.logger)
         results = {}
         kwargs = handler.build_gkeydict(args)
         keyresults = seeds.list(**kwargs)

diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py
index c9faf0e..d03efc4 100644
--- a/gkeys/gkeys/base.py
+++ b/gkeys/gkeys/base.py
@@ -17,7 +17,7 @@ from __future__ import print_function
 import argparse
 import sys
 
-from gkeys import fileops, seed, lib
+from gkeys import fileops
 from gkeys.log import log_levels, set_logger
 
 
@@ -43,6 +43,7 @@ class CliBase(object):
         self.args = None
         self.seeds = None
         self.actions = None
+        self.logger = None
 
 
     @staticmethod
@@ -190,7 +191,7 @@ class CliBase(object):
         @param args: list
         @returns argparse.Namespace object
         '''
-        #logger.debug('CliBase: parse_args; args: %s' % args)
+        #self.logger.debug('CliBase: parse_args; args: %s' % args)
         parser = argparse.ArgumentParser(
             prog=self.cli_config['prog'],
             description=self.cli_config['description'],
@@ -245,7 +246,6 @@ class CliBase(object):
 
         @param args: list or argparse.Namespace object
         '''
-        global logger
         message = None
         if not args:
             message = "Main: run; invalid args argument passed in"
@@ -257,20 +257,18 @@ class CliBase(object):
         self.config.read_config()
 
         # establish our logger and update it in the imported files
-        logger = set_logger(self.cli_config['prog'], self.config['logdir'], args.debug,
+        self.logger = set_logger(self.cli_config['prog'], self.config['logdir'], args.debug,
             dirmode=int(self.config.get_key('permissions', 'directories'),0),
             filemask=int(self.config.get_key('permissions', 'files'),0))
-        self.config.logger = logger
-        fileops.logger = logger
-        seed.logger = logger
-        lib.logger = logger
+        self.config.logger = self.logger
+        fileops.logger = self.logger
 
         if message:
-            logger.error(message)
+            self.logger.error(message)
 
         # now that we have a logger, record the alternate config setting
         if args.config:
-            logger.debug("Main: run; Found alternate config request: %s"
+            self.logger.debug("Main: run; Found alternate config request: %s"
                 % args.config)
 
         # check if a -C, --category was input
@@ -282,12 +280,12 @@ class CliBase(object):
             return False
 
         # establish our actions instance
-        self.actions = self.cli_config['Actions'](self.config, self.output_results, logger)
+        self.actions = self.cli_config['Actions'](self.config, self.output_results, self.logger)
 
         # run the action
         func = getattr(self.actions, '%s'
             % self.cli_config['Action_Map'][args.action])
-        logger.debug('Main: run; Found action: %s' % args.action)
+        self.logger.debug('Main: run; Found action: %s' % args.action)
         success, results = func(args)
         if not results:
             print("No results found.  Check your configuration and that the",
@@ -328,7 +326,7 @@ class CliBase(object):
         '''
         available_cats = list(self.config.defaults['seeds'])
         if category and category not in available_cats:
-            self.config.logger.error("Invalid category or seedfile entered: %s" % category)
-            self.config.logger.error("Available categories or seedfiles: %s" % ', '.join(sorted(available_cats)))
+            self.logger.error("Invalid category or seedfile entered: %s" % category)
+            self.logger.error("Available categories or seedfiles: %s" % ', '.join(sorted(available_cats)))
             return False
         return True

diff --git a/gkeys/gkeys/lib.py b/gkeys/gkeys/lib.py
index 724abfc..6bb3d5b 100644
--- a/gkeys/gkeys/lib.py
+++ b/gkeys/gkeys/lib.py
@@ -26,14 +26,13 @@ from os.path import join as pjoin
 from pyGPG.gpg import GPG
 from gkeys.checks import KeyChecks
 from gkeys.fileops import ensure_dirs
-from gkeys.log import logger
 from gkeys.seed import Seeds
 
 class GkeysGPG(GPG):
     '''Gentoo-keys primary gpg class'''
 
 
-    def __init__(self, config, basedir):
+    def __init__(self, config, basedir, logger):
         '''class init function
 
         @param config: GKeysConfig config instance to use
@@ -43,6 +42,7 @@ class GkeysGPG(GPG):
         GPG.__init__(self, config, logger)
         self.config = config
         self.basedir = basedir
+        self.logger = logger
         self.keydir = None
         self.server = None
 
@@ -54,10 +54,10 @@ class GkeysGPG(GPG):
             return
         self.server = server or self.config['keyserver']
         self.config.options['gpg_defaults'] = self.config.defaults['gpg_defaults'][:]
-        logger.debug("keyserver: %s" % (self.server))
+        self.logger.debug("keyserver: %s" % (self.server))
         server_value = ['--keyserver', self.server]
         self.config.options['gpg_defaults'].extend(server_value)
-        logger.debug("self.config.options['gpg_defaults']: %s"
+        self.logger.debug("self.config.options['gpg_defaults']: %s"
             % (self.config.options['gpg_defaults']))
         return
 
@@ -65,7 +65,7 @@ class GkeysGPG(GPG):
     def set_keyring(self, keyring, task, importkey=False, reset=True):
         '''Sets the keyring to use as well as related task options
         '''
-        logger.debug("keydir: %s, keyring: %s" % (self.keydir, keyring))
+        self.logger.debug("keydir: %s, keyring: %s" % (self.keydir, keyring))
         if reset:
             self.config.options['tasks'][task] =  self.config.defaults['tasks'][task][:]
         # --keyring file |  Note that this adds a keyring to the current list.
@@ -79,12 +79,12 @@ class GkeysGPG(GPG):
                 mode=int(self.config.get_key('permissions', 'directories'),0))
         task_value = ['--no-default-keyring', '--keyring', keyring]
         self.config.options['tasks'][task].extend(task_value)
-        logger.debug("set_keyring: New task options: %s" %str(self.config.options['tasks'][task]))
+        self.logger.debug("set_keyring: New task options: %s" %str(self.config.options['tasks'][task]))
         return
 
 
     def set_keydir(self, keydir, task, fingerprint=True, reset=True):
-        logger.debug("basedir: %s, keydir: %s" % (self.basedir, keydir))
+        self.logger.debug("basedir: %s, keydir: %s" % (self.basedir, keydir))
         self.keydir = pjoin(self.basedir, keydir)
         self.task = task
         if reset:
@@ -94,7 +94,7 @@ class GkeysGPG(GPG):
             task_value.append('--fingerprint')
         task_value.extend(['--homedir', self.keydir])
         self.config.options['tasks'][task].extend(task_value)
-        logger.debug("set_keydir: New task options: %s" %str(self.config.options['tasks'][task]))
+        self.logger.debug("set_keydir: New task options: %s" %str(self.config.options['tasks'][task]))
         return
 
 
@@ -109,13 +109,13 @@ class GkeysGPG(GPG):
         self.set_keydir(keydir, 'import', reset=True)
         self.set_keyring(keyring, 'import', importkey=True, reset=False)
         results = []
-        logger.debug("LIB: import_to_keyring; name: " + gkey.name)
-        logger.debug("** Calling runGPG with Running: gpg %s --import' for: %s"
+        self.logger.debug("LIB: import_to_keyring; name: " + gkey.name)
+        self.logger.debug("** Calling runGPG with Running: gpg %s --import' for: %s"
                      % (' '.join(self.config.get_key('tasks', 'import')),
                         gkey.name))
         pubring_path = pjoin(self.keydir, gkey.keydir, 'pubring.gpg')
         result = self.runGPG(task='import', inputfile=pubring_path)
-        logger.info('GPG return code: ' + str(result.returncode))
+        self.logger.info('GPG return code: ' + str(result.returncode))
         results.append(result)
         print(result.stderr_out)
         return results
@@ -131,32 +131,32 @@ class GkeysGPG(GPG):
         self.set_keyserver()
         self.set_keydir(gkey.keydir, 'recv-keys', reset=True)
         self.set_keyring('pubring.gpg', 'recv-keys', reset=False)
-        logger.debug("LIB: add_key; ensure dirs: " + self.keydir)
+        self.logger.debug("LIB: add_key; ensure dirs: " + self.keydir)
         mode = int(self.config.get_key('permissions', 'directories'),0)
         ensure_dirs(str(self.keydir), mode=mode)
         self.set_keyseedfile(trap_errors=False)
         results = []
         for fingerprint in gkey.fingerprint:
-            logger.debug("LIB: add_key; adding fingerprint " + fingerprint)
-            logger.debug("** Calling runGPG with Running 'gpg %s --recv-keys %s' for: %s"
+            self.logger.debug("LIB: add_key; adding fingerprint " + fingerprint)
+            self.logger.debug("** Calling runGPG with Running 'gpg %s --recv-keys %s' for: %s"
                 % (' '.join(self.config.get_key('tasks', 'recv-keys')),
                     fingerprint, gkey.name))
             result = self.runGPG(task='recv-keys', inputfile=fingerprint)
-            logger.info('GPG return code: ' + str(result.returncode))
+            self.logger.info('GPG return code: ' + str(result.returncode))
             if result.fingerprint in gkey.fingerprint:
                 result.failed = False
                 message = "Fingerprints match... Import successful: "
                 message += "%s, fingerprint: %s" % (gkey.nick, fingerprint)
                 message += "\n result len: %s, %s" % (len(result.fingerprint), result.fingerprint)
                 message += "\n gkey len: %s, %s" % (len(gkey.fingerprint[0]), gkey.fingerprint[0])
-                logger.info(message)
+                self.logger.info(message)
             else:
                 result.failed = True
                 message = "Fingerprints do not match... Import failed for "
                 message += "%s, fingerprint: %s" % (gkey.nick, fingerprint)
                 message += "\n result: %s" % (result.fingerprint)
                 message += "\n gkey..: %s" % (str(gkey.fingerprint))
-                logger.error(message)
+                self.logger.error(message)
             # Save the gkey seed to the installed db
             success = self.update_gkey(gkey, save=True)
             if not success:
@@ -190,11 +190,11 @@ class GkeysGPG(GPG):
         self.set_keydir(gkey.keydir, 'refresh-keys', reset=True)
         self.set_keyring('pubring.gpg', 'refresh-keys', reset=False)
         self.set_keyseedfile(refresh=True)
-        logger.debug("LIB: refresh_key, gkey: %s" % str(gkey))
-        logger.debug("** Calling runGPG with Running 'gpg %s --refresh-keys' for: %s"
+        self.logger.debug("LIB: refresh_key, gkey: %s" % str(gkey))
+        self.logger.debug("** Calling runGPG with Running 'gpg %s --refresh-keys' for: %s"
             % (' '.join(self.config.get_key('tasks', 'refresh-keys')), str(gkey)))
         result = self.runGPG(task='refresh-keys', inputfile='')
-        logger.info('GPG return code: ' + str(result.returncode))
+        self.logger.info('GPG return code: ' + str(result.returncode))
         self.update_gkey(gkey, save=True)
         return result
 
@@ -211,7 +211,7 @@ class GkeysGPG(GPG):
             lresults.append(self.list_keys(gkey.keydir, fpr, colons=True))
         self.seedfile.update(gkey.update(lresults))
         if save and not self.seedfile.save():
-            logger.error("GkeysGPG.refresh_key(); failed to save seed: " + gkey.nick)
+            self.logger.error("GkeysGPG.refresh_key(); failed to save seed: " + gkey.nick)
             return False
         return True
 
@@ -225,7 +225,7 @@ class GkeysGPG(GPG):
         @param colons: bool to enable colon listing
         '''
         if not keydir:
-            logger.debug("LIB: list_keys(), invalid keydir parameter: %s"
+            self.logger.debug("LIB: list_keys(), invalid keydir parameter: %s"
                 % str(keydir))
             return []
         if fingerprint:
@@ -239,11 +239,11 @@ class GkeysGPG(GPG):
         if colons:
             task_value = ['--with-colons']
             self.config.options['tasks'][task].extend(task_value)
-        logger.debug("** Calling runGPG with Running 'gpg %s --%s %s'"
+        self.logger.debug("** Calling runGPG with Running 'gpg %s --%s %s'"
             % (' '.join(self.config['tasks'][task]), task, keydir)
             )
         result = self.runGPG(task=task, inputfile=target)
-        logger.info('GPG return code: ' + str(result.returncode))
+        self.logger.info('GPG return code: ' + str(result.returncode))
         return result
 
 
@@ -257,7 +257,7 @@ class GkeysGPG(GPG):
         '''
         if not result:
             result = self.list_keys(keydir, fingerprint=keyid, colons=True)
-        checker = KeyChecks(logger, qualified_id_check=True)
+        checker = KeyChecks(self.logger, qualified_id_check=True)
         return checker.validity_checks(keydir, keyid, result)
 
 
@@ -272,7 +272,7 @@ class GkeysGPG(GPG):
         '''
         if not result:
             result = self.list_keys(keydir, fingerprint=keyid, colons=True)
-        checker = KeyChecks(logger, qualified_id_check=True)
+        checker = KeyChecks(self.logger, qualified_id_check=True)
         specchecks = checker.spec_check(keydir, keyid, result)
         return specchecks
 
@@ -306,29 +306,29 @@ class GkeysGPG(GPG):
         '''
         if signature:
             self.set_keydir(gkey.keydir, 'verify', reset=True)
-            logger.debug("** Calling runGPG with Running 'gpg %s --verify %s and %s'"
+            self.logger.debug("** Calling runGPG with Running 'gpg %s --verify %s and %s'"
                     % (' '.join(self.config['tasks']['verify']), signature, filepath))
             results = self.runGPG(task='verify', inputfile=[signature,filepath])
         else:
             self.set_keydir(gkey.keydir, 'decrypt', reset=True)
-            logger.debug("** Calling runGPG with Running 'gpg %s --decrypt %s and %s'"
+            self.logger.debug("** Calling runGPG with Running 'gpg %s --decrypt %s and %s'"
                     % (' '.join(self.config['tasks']['decrypt']), filepath))
             results = self.runGPG(task='decrypt', inputfile=filepath)
         keyid = gkey.keyid[0]
         if results.verified[0]:
-            logger.info("GPG verification succeeded. Name: %s / Key: %s" % (gkey.name, keyid))
-            logger.info("\tSignature result:" + str(results.verified))
+            self.logger.info("GPG verification succeeded. Name: %s / Key: %s" % (gkey.name, keyid))
+            self.logger.info("\tSignature result:" + str(results.verified))
         else:
-            logger.debug("GPG verification failed. Name: %s / Key: %s" % (gkey.name, keyid))
-            logger.debug("\t Signature result:"+ str(results.verified))
-            logger.debug("LIB: verify; stderr_out:" + str(results.stderr_out))
+            self.logger.debug("GPG verification failed. Name: %s / Key: %s" % (gkey.name, keyid))
+            self.logger.debug("\t Signature result:"+ str(results.verified))
+            self.logger.debug("LIB: verify; stderr_out:" + str(results.stderr_out))
         return results
 
 
     def set_keyseedfile(self, trap_errors=True, refresh=False):
         if not self.keydir:
-            logger.debug("GkeysGPG.set_keyseedfile(); self.keydir error")
-        self.seedfile = Seeds(pjoin(self.keydir, 'gkey.seeds'), self.config)
+            self.logger.debug("GkeysGPG.set_keyseedfile(); self.keydir error")
+        self.seedfile = Seeds(pjoin(self.keydir, 'gkey.seeds'), self.config, self.logger)
         self.seedfile.load(trap_errors=trap_errors, refresh=refresh)
 
 
@@ -342,15 +342,15 @@ class GkeysGPG(GPG):
         '''
         keyid = gkey.keyid[0]
         self.set_keydir(gkey.keydir, mode, reset=True)
-        logger.debug("** Calling runGPG with Running 'gpg %s --%s %s %s'"
+        self.logger.debug("** Calling runGPG with Running 'gpg %s --%s %s %s'"
                 % (' '.join(self.config['tasks'][mode]), mode, fingerprint, filepath))
         results = self.runGPG(task=mode, inputfile=filepath)
 
         if results.verified[0]:
-            logger.info("GPG signing succeeded. Name: %s / Key: %s" % (str(gkey.name), str(keyid)))
-            logger.info("\tSignature result:" + str(results.verified))
+            self.logger.info("GPG signing succeeded. Name: %s / Key: %s" % (str(gkey.name), str(keyid)))
+            self.logger.info("\tSignature result:" + str(results.verified))
         else:
-            logger.debug("GPG signing failed. Name: %s / Key: %s" % (str(gkey.name), str(keyid)))
-            logger.debug("\t Signature result:"+ str(results.verified))
-            logger.debug("LIB: sign; stderr_out:" + str(results.stderr_out))
+            self.logger.debug("GPG signing failed. Name: %s / Key: %s" % (str(gkey.name), str(keyid)))
+            self.logger.debug("\t Signature result:"+ str(results.verified))
+            self.logger.debug("LIB: sign; stderr_out:" + str(results.stderr_out))
         return results

diff --git a/gkeys/gkeys/seed.py b/gkeys/gkeys/seed.py
index 1a2bae2..15c9e2c 100644
--- a/gkeys/gkeys/seed.py
+++ b/gkeys/gkeys/seed.py
@@ -29,13 +29,14 @@ class Seeds(object):
     '''Handles all seed key file operations'''
 
 
-    def __init__(self, filepath=None, config=None):
+    def __init__(self, filepath=None, config=None, _logger=None):
         '''Seeds class init function
 
         @param filepath: string of the file to load
         '''
         self.filename = filepath
         self.config = config
+        self.logger = _logger or logger
         self.seeds = {}
 
 
@@ -44,16 +45,16 @@ class Seeds(object):
         if filename:
             self.filename = filename
         if not self.filename:
-            logger.debug("Seed: load; Not a valid filename: '%s'" % str(self.filename))
+            self.logger.debug("Seed: load; Not a valid filename: '%s'" % str(self.filename))
             return False
-        logger.debug("Seeds: load; Begin loading seed file %s" % self.filename)
+        self.logger.debug("Seeds: load; Begin loading seed file %s" % self.filename)
         seedlines = None
         self.seeds = {}
         try:
             with open(self.filename, "r+") as seedfile:
                 seedlines = json.load(seedfile)
         except IOError as err:
-            logger.debug("Seed: load; IOError occurred while loading file")
+            self.logger.debug("Seed: load; IOError occurred while loading file")
             if trap_errors:
                 self._error(err)
             return False
@@ -71,10 +72,10 @@ class Seeds(object):
             #try:
             self.seeds[seed[0]] = GKEY(**seed[1])
             #except Exception as err:
-                #logger.debug("Seed: load; Error splitting seed: %s" % seed)
-                #logger.debug("Seed: load; ...............parts: %s" % str(parts))
+                #self.logger.debug("Seed: load; Error splitting seed: %s" % seed)
+                #self.logger.debug("Seed: load; ...............parts: %s" % str(parts))
                 #self._error(err)
-        logger.debug("Seed: load; Completed loading seed file %s" % self.filename)
+        self.logger.debug("Seed: load; Completed loading seed file %s" % self.filename)
         return True
 
 
@@ -83,9 +84,9 @@ class Seeds(object):
         if filename:
             self.filename = filename
         if not self.filename:
-            logger.debug("Seed: save; Not a valid filename: '%s'" % str(self.filename))
+            self.logger.debug("Seed: save; Not a valid filename: '%s'" % str(self.filename))
             return False
-        logger.debug("Seed: save; Begin saving seed file %s" % self.filename)
+        self.logger.debug("Seed: save; Begin saving seed file %s" % self.filename)
         ensure_dirs(os.path.split(self.filename)[0],
             mode=int(self.config.get_key('permissions', "directories"),0),
             fatal=True)
@@ -217,8 +218,8 @@ class Seeds(object):
 
     def _error(self, err):
         '''Class error logging function'''
-        logger.error("Seed: Error processing seed file %s" % self.filename)
-        logger.error("Seed: Error was: %s" % str(err))
+        self.logger.error("Seed: Error processing seed file %s" % self.filename)
+        self.logger.error("Seed: Error was: %s" % str(err))
 
 
     def _seeds2json(self, seeds):

diff --git a/gkeys/gkeys/seedhandler.py b/gkeys/gkeys/seedhandler.py
index 5ddccbe..9540ee0 100644
--- a/gkeys/gkeys/seedhandler.py
+++ b/gkeys/gkeys/seedhandler.py
@@ -77,7 +77,7 @@ class SeedHandler(object):
             self.logger.error("SeedHandler: load_seeds; No filepath to load")
         self.logger.debug("SeedHandler: load_seeds; seeds filepath to load: "
             "%s" % filepath)
-        seeds = Seeds(config=self.config)
+        seeds = Seeds(config=self.config, _logger=self.logger)
         seeds.load(filepath, refresh=refresh)
         self.seeds = seeds
         return seeds
@@ -89,7 +89,7 @@ class SeedHandler(object):
         @param nicks: list of string nick ids to load
         @return Seeds class object
         '''
-        seeds = Seeds(config=self.config)
+        seeds = Seeds(config=self.config, _logger=self.logger)
         if category == 'sign':
             catdir = self.config.get_key('sign-keydir')
         else:


             reply	other threads:[~2015-01-01 17:44 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01 17:44 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-08-15 16:15 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/ Brian Dolbec
2018-08-15  1:51 Brian Dolbec
2018-08-15  1:05 Brian Dolbec
2018-07-07 15:10 Brian Dolbec
2018-07-07 15:10 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-12-24  0:38 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-12-24  0:38 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-10-27 21:49 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-10-27 18:41 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  4:52 Brian Dolbec
2016-06-01 15:16 Brian Dolbec
2016-06-01 15:16 Brian Dolbec
2016-01-23 23:33 Brian Dolbec
2016-01-23 23:33 Brian Dolbec
2016-01-23 19:04 Brian Dolbec
2015-12-25 17:03 Brian Dolbec
2015-12-13  0:51 Brian Dolbec
2015-08-25 14:10 Brian Dolbec
2015-08-25 14:10 Brian Dolbec
2015-08-09 22:52 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-06-22 13:41 Brian Dolbec
2015-06-01  1:56 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-03-18 15:32 Brian Dolbec
2015-03-17 19:51 Brian Dolbec
2015-03-08 15:09 Brian Dolbec
2015-03-06 21:04 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-08  4:13 Brian Dolbec
2015-01-07 23:39 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-01 22:32 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-25 22:07 Brian Dolbec
2014-12-25 22:07 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-23  2:50 Brian Dolbec
2014-12-23  2:50 Brian Dolbec
2014-12-23  0:13 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420079977.51f847f29ddfb4af33df09eb495781850bdcb293.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox