From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E1CD4139085 for ; Fri, 23 Dec 2016 08:37:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4E716E0E32; Fri, 23 Dec 2016 08:37:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1293EE0E31 for ; Fri, 23 Dec 2016 08:37:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B269B341149 for ; Fri, 23 Dec 2016 08:37:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3127B24ED for ; Fri, 23 Dec 2016 08:37:14 +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: <1482479405.575b6441a5554c977534a41242be0b552fef0a85.dolsen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:gsoc-2016 commit in: gkeys/gkeys/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys/gkeys/action_map.py gkeys/gkeys/actions.py X-VCS-Directories: gkeys/gkeys/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 575b6441a5554c977534a41242be0b552fef0a85 X-VCS-Branch: gsoc-2016 Date: Fri, 23 Dec 2016 08:37:14 +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: 4e738bc7-0a9f-4e08-be9b-a6827fab8904 X-Archives-Hash: 14121cd28ec7deddf30e1bdffe4c214f commit: 575b6441a5554c977534a41242be0b552fef0a85 Author: aeroniero33 gmail com> AuthorDate: Sun Jun 12 14:19:35 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Fri Dec 23 07:50:05 2016 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=575b6441 gkeys/actions: Update the update-seed function Update descriptions. Update operations to current library code usage. Replace print() use with self.output(). Expand commit message gkeys/gkeys/action_map.py | 7 ++++--- gkeys/gkeys/actions.py | 41 +++++++++++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/gkeys/gkeys/action_map.py b/gkeys/gkeys/action_map.py index 1bd0625..5433297 100644 --- a/gkeys/gkeys/action_map.py +++ b/gkeys/gkeys/action_map.py @@ -385,8 +385,8 @@ Found Failures: 'func': 'updateseed', 'options': ['category', 'nick', '1file', 'dest', 'signature', 'timestamp'], - 'desc': '''Update the selected seed file(s)''', - 'long_desc': '''Update the selected seed file(s)''', + 'desc': '''Update the selected seed file(s) or all categories if no arguments are given''', + 'long_desc': '''Update the selected seed file(s) or all categories if no arguments are given''', 'example': '''$ gkeys update-seed -C gentoo-devs Gkey task results: @@ -394,7 +394,8 @@ Found Failures: Key info...............: Gentoo-Linux Gentoo-keys Project Signing Key , 0xA41DBBD9151C3FC7 category, nick.....: gentoo gkeys - Update operation completed + Fetch operation completed + Completed ''', }), ('list-seed', { diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py index 0720079..3ff8d8e 100644 --- a/gkeys/gkeys/actions.py +++ b/gkeys/gkeys/actions.py @@ -1,4 +1,4 @@ -# + #-*- coding:utf-8 -*- """ @@ -95,19 +95,41 @@ class Actions(ActionBase): messages.append("") messages.append("Fetch operation completed") return (False not in success, messages) - + def updateseed(self, args): - '''Updates seeds of a selected file''' + '''Updates seeds of a selected file or all categories if no args are given''' self.logger.debug(_unicode("ACTIONS: updateseed; args: %s") % _unicode(args)) + messages = [] + success = True + if not args.category: + '''Update all available categories''' + seed_categories = list(self.config.defaults['seeds']) + category_msgs = [] + for seed_category in seed_categories: + self.seeds = None + custom_args = args + custom_args.category = seed_category + category_success, messages = self.updateseed(custom_args) + category_msgs.extend(messages) + return (True, category_msgs) + self.output('', "Fetching seeds for %s category.\n" %args.category) fetch_success, fetch_messages = self.fetchseed(args) if fetch_success is not True: - return (False, fetch_messages) - install_success, install_messages = self.installkey(args) - if install_success is not True: - return (False, install_messages) - messages = fetch_messages + [install_messages] - return (True, messages) + success = False + messages = fetch_messages + self.output('', "Fetch failed.\n") + else: + self.output('', "Fetch succeeded.\n") + self.output('', "Installing or Refreshing keys for %s category." %args.category) + install_success, install_messages = self.installkey(args) + if install_success is not True: + self.output('', "Update failed.\n") + success = False + else: + self.output('', "Update succeeded.\n") + messages = fetch_messages + ["Update operation:"] + [install_messages] + return (success, messages) def addseed(self, args): '''Add or replace a key in the selected seed file''' @@ -311,7 +333,6 @@ class Actions(ActionBase): self.gpg.set_keydir(gkey.keydir, "recv-keys") self.gpg.set_keyseedfile() seeds = self.gpg.seedfile.seeds - #print(seeds) if seeds: self.logger.debug("ACTIONS: installkey; found installed seeds:" "\n %s" % seeds)