1 |
commit: d8b9d5d6250a4f9ebaf8db6cbab96a585c56aadd |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 1 19:52:28 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 1 19:52:28 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d8b9d5d6 |
7 |
|
8 |
rsync: surface key refresh exceptions early (bug 649276) |
9 |
|
10 |
Since retry does not help for some types of errors, display errors as |
11 |
soon as they occur. |
12 |
|
13 |
Fixes: 5f29f03d0d97 ("rsync: add key refresh retry (bug 649276)") |
14 |
|
15 |
pym/portage/sync/modules/rsync/rsync.py | 14 +++++++++++++- |
16 |
1 file changed, 13 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py |
19 |
index 180bf8571..b2850715e 100644 |
20 |
--- a/pym/portage/sync/modules/rsync/rsync.py |
21 |
+++ b/pym/portage/sync/modules/rsync/rsync.py |
22 |
@@ -157,9 +157,21 @@ class RsyncSync(NewBase): |
23 |
if retry_decorator is None: |
24 |
openpgp_env.refresh_keys() |
25 |
else: |
26 |
+ def noisy_refresh_keys(): |
27 |
+ """ |
28 |
+ Since retry does not help for some types of |
29 |
+ errors, display errors as soon as they occur. |
30 |
+ """ |
31 |
+ try: |
32 |
+ openpgp_env.refresh_keys() |
33 |
+ except Exception as e: |
34 |
+ writemsg_level("%s\n" % (e,), |
35 |
+ level=logging.ERROR, noiselevel=-1) |
36 |
+ raise # retry |
37 |
+ |
38 |
loop = global_event_loop() |
39 |
func_coroutine = functools.partial(loop.run_in_executor, |
40 |
- None, openpgp_env.refresh_keys) |
41 |
+ None, noisy_refresh_keys) |
42 |
decorated_func = retry_decorator(func_coroutine) |
43 |
loop.run_until_complete(decorated_func()) |
44 |
out.eend(0) |