1 |
commit: 59baf2fa65964e2cc8134f414d9536e7dcde5d9f |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 24 09:11:08 2016 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 24 09:40:27 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=59baf2fa |
7 |
|
8 |
gkeys base.py: Remove the auto-update code from run() |
9 |
|
10 |
This code was causing the fetch-seed action to fail with empty urls to connect to. |
11 |
This code should also not be running directly from the CliBase class. |
12 |
I'll move this code to the actions or lib class, to be determined later. |
13 |
|
14 |
gkeys/gkeys/base.py | 54 ----------------------------------------------------- |
15 |
1 file changed, 54 deletions(-) |
16 |
|
17 |
diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py |
18 |
index 28dd0b2..a67b330 100644 |
19 |
--- a/gkeys/gkeys/base.py |
20 |
+++ b/gkeys/gkeys/base.py |
21 |
@@ -358,7 +358,6 @@ class CliBase(object): |
22 |
return False |
23 |
return True |
24 |
|
25 |
- |
26 |
def run(self, args): |
27 |
'''Run the action selected |
28 |
|
29 |
@@ -366,59 +365,6 @@ class CliBase(object): |
30 |
''' |
31 |
# establish our actions instance |
32 |
self.actions = self.cli_config['Actions'](self.config, self.output_results, self.logger) |
33 |
- # check for seed update |
34 |
- from sslfetch.connections import Connector |
35 |
- connector_output = { |
36 |
- 'info': self.logger.info, |
37 |
- 'debug': self.logger.debug, |
38 |
- 'error': self.logger.error, |
39 |
- 'exception': self.logger.exception, |
40 |
- 'warning': self.warning_output, |
41 |
- 'kwargs-info': {}, |
42 |
- 'kwargs-debug': {}, |
43 |
- 'kwargs-error': {}, |
44 |
- 'kwargs-exception': {}, |
45 |
- 'kwargs-warning': {}, |
46 |
- } |
47 |
- fetcher = Connector(connector_output, None, "Gentoo Keys") |
48 |
- successes = [] |
49 |
- up_to_date = True |
50 |
- categories = list(self.config.defaults['seeds']) |
51 |
- '''Attemp to download seed and seed.sig files for each available category''' |
52 |
- for category in categories: |
53 |
- filepath = self.config.defaults['seedsdir'] + "/" + category + ".seeds" |
54 |
- timestamp_path = filepath + ".timestamp" |
55 |
- url = self.config.defaults['seedurls'][category] |
56 |
- success, signedfile, timestamp = fetcher.fetch_file( |
57 |
- url, filepath, timestamp_path) |
58 |
- if timestamp != "": |
59 |
- up_to_date = False |
60 |
- successes.append(success) |
61 |
- url += ".sig" |
62 |
- filepath += ".sig" |
63 |
- success, signedfile, timestamp = fetcher.fetch_file( |
64 |
- url, filepath, timestamp_path) |
65 |
- if timestamp != "": |
66 |
- up_to_date = False |
67 |
- successes.append(success) |
68 |
- if False not in successes and not up_to_date: |
69 |
- print("Seeds need to be updated") |
70 |
- ack = None |
71 |
- while ack not in ("y", "yes", "n", "no"): |
72 |
- ack = py_input("Would you like to update the seeds now? (y/n) ").lower() |
73 |
- if ack in ("y", "yes"): |
74 |
- custom_args = copy.copy(args) |
75 |
- for attr in GKEY._fields: |
76 |
- if attr != "debug": |
77 |
- custom_args.attr = None |
78 |
- custom_args.category = None |
79 |
- custom_args.action = "update-seed" |
80 |
- print("Updating seeds") |
81 |
- self.run(custom_args) |
82 |
- elif False not in successes: |
83 |
- print("Seeds are up to date") |
84 |
- else: |
85 |
- print("Seed update check failed, check your internet connection.") |
86 |
# run the action |
87 |
func = getattr(self.actions, '%s' |
88 |
% self.cli_config['Action_Map'][args.action]['func']) |