From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8FA311386F3 for ; Sun, 9 Aug 2015 01:09:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27F9DE088D; Sun, 9 Aug 2015 01:09:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 55D57E088D for ; Sun, 9 Aug 2015 01:09:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5D731340AE1 for ; Sun, 9 Aug 2015 01:09:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6A0CA133 for ; Sun, 9 Aug 2015 01:09:33 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1438574376.3fd82a0c97b291da10ca116fb80f24c0d3bcef90.dolsen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys/gkeys/lib.py X-VCS-Directories: gkeys/gkeys/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 3fd82a0c97b291da10ca116fb80f24c0d3bcef90 X-VCS-Branch: master Date: Sun, 9 Aug 2015 01:09:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 311f7e6c-9307-4869-bc30-2c433e5c2c15 X-Archives-Hash: 009f6d0717eaf0b42b8c625c535bb136 commit: 3fd82a0c97b291da10ca116fb80f24c0d3bcef90 Author: Brian Dolbec gentoo org> AuthorDate: Wed Jul 29 05:59:39 2015 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Mon Aug 3 03:59:36 2015 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=3fd82a0c gkeys/lib.py: Split out _log_result() Split out common code to be used for all veritf_* functions. gkeys/gkeys/lib.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/gkeys/gkeys/lib.py b/gkeys/gkeys/lib.py index bce4e55..838ebf0 100644 --- a/gkeys/gkeys/lib.py +++ b/gkeys/gkeys/lib.py @@ -338,14 +338,7 @@ class GkeysGPG(GPG): self.logger.debug("** Calling runGPG with Running 'gpg %s --decrypt %s'" % (' '.join(self.config['tasks']['decrypt']), filepath)) results = self.runGPG(task='decrypt', inputfile=filepath) - keyid = gkey.keyid[0] - if results.verified[0]: - self.logger.info("GPG verification succeeded. Name: %s / Key: %s" % (gkey.name, keyid)) - self.logger.info("\tSignature result:" + str(results.verified)) - else: - 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)) + self._log_result('verification', gkey, results) return results @@ -369,12 +362,20 @@ class GkeysGPG(GPG): 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) + self._log_result('signing', gkey, results) + return results + + def _log_result(self, mode, gkey, results): if results.verified[0]: - self.logger.info("GPG signing succeeded. Name: %s / Key: %s" % (str(gkey.name), str(keyid))) + self.logger.info("GPG %s succeeded. Name: %s / Key: %s" + % (mode, gkey.name, gkey.keyid[0])) self.logger.info("\tSignature result:" + str(results.verified)) else: - self.logger.debug("GPG signing failed. Name: %s / Key: %s" % (str(gkey.name), str(keyid))) + self.logger.debug("GPG %s failed. Name: %s / Key: %s" + % (mode, gkey.name, gkey.keyid[0])) self.logger.debug("\t Signature result:"+ str(results.verified)) - self.logger.debug("LIB: sign; stderr_out:" + str(results.stderr_out)) - return results + self.logger.debug("LIB: verify; stderr_out:" + + str(results.stderr_out)) + +