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-gen/gkeygen/
Date: Thu,  1 Jan 2015 17:44:54 +0000 (UTC)	[thread overview]
Message-ID: <1420079992.198f91d769e9573f63cfcb3379c009957658f961.dolsen@gentoo> (raw)

commit:     198f91d769e9573f63cfcb3379c009957658f961
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 31 06:40:26 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan  1 02:39:52 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=198f91d7

gkeygen/actions.py: Py 3 fixes

Both downloads in py3 are byte strings.  Need to decode them.
Change the "No password given" messages.
Add a logger.eror message with the GpgmeError received.

---
 gkeys-gen/gkeygen/actions.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gkeys-gen/gkeygen/actions.py b/gkeys-gen/gkeygen/actions.py
index e329397..8ddf624 100644
--- a/gkeys-gen/gkeygen/actions.py
+++ b/gkeys-gen/gkeygen/actions.py
@@ -99,7 +99,7 @@ class Actions(object):
             shutil.copy('/usr/share/gnupg/gpg-conf.skel', newgpgconfpath)
             with open(newgpgconfpath, 'a') as conf:
                 for line in urlopen(self.config.get_key('gpg-urls', args.spec)):
-                    conf.write(_unicode(line))
+                    conf.write(_unicode(line.decode('utf-8')))
             # Key generation
             ctx = gpgme.Context()
             self.logger.info("MAIN: _action_genkey: Generating GPG key...")
@@ -109,9 +109,10 @@ class Actions(object):
                 "    This helps the random number generator work effectively"])
             try:
                 result = ctx.genkey(key_params)
-            except gpgme.GpgmeError:
-                self.logger.debug("MAIN: _action_genkey: Aborting... No given password.")
-                messages.extend(['', "Aborting... No given password."])
+            except gpgme.GpgmeError as e:
+                self.logger.error("MAIN: _action_genkey: GpgmeError: %s" % str(e))
+                self.logger.debug("MAIN: _action_genkey: Aborting... Failed to get a password.")
+                messages.extend(['', "Aborting... Failed to get a password."])
                 return (False, messages)
             key = ctx.get_key(result.fpr, True)
             self.logger.debug("MAIN: _action_genkey: Generated key: %s - %s"
@@ -139,5 +140,5 @@ class Actions(object):
         print("\nReview:\n Full Name: %s\n Email: %s\n" % (name, email))
         url = self.config.get_key('spec-urls', args.spec)
         key_properties = urlopen(url).read()
-        return _unicode(key_properties).format(name, email)
+        return _unicode(key_properties.decode('utf-8')).format(name, email)
 


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

Thread overview: 7+ 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-07-07  5:23 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-gen/gkeygen/ Brian Dolbec
2016-03-01 16:18 Brian Dolbec
2015-03-10 22:14 Brian Dolbec
2015-01-06 21:45 Brian Dolbec
2015-01-06 21:45 Brian Dolbec
2014-12-26  5:02 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=1420079992.198f91d769e9573f63cfcb3379c009957658f961.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