commit:     d8b9d5d6250a4f9ebaf8db6cbab96a585c56aadd
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May  1 19:52:28 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May  1 19:52:28 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d8b9d5d6

rsync: surface key refresh exceptions early (bug 649276)

Since retry does not help for some types of errors, display errors as
soon as they occur.

Fixes: 5f29f03d0d97 ("rsync: add key refresh retry (bug 649276)")

 pym/portage/sync/modules/rsync/rsync.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/modules/rsync/rsync.py 
b/pym/portage/sync/modules/rsync/rsync.py
index 180bf8571..b2850715e 100644
--- a/pym/portage/sync/modules/rsync/rsync.py
+++ b/pym/portage/sync/modules/rsync/rsync.py
@@ -157,9 +157,21 @@ class RsyncSync(NewBase):
                                        if retry_decorator is None:
                                                openpgp_env.refresh_keys()
                                        else:
+                                               def noisy_refresh_keys():
+                                                       """
+                                                       Since retry does not 
help for some types of
+                                                       errors, display errors 
as soon as they occur.
+                                                       """
+                                                       try:
+                                                               
openpgp_env.refresh_keys()
+                                                       except Exception as e:
+                                                               
writemsg_level("%s\n" % (e,),
+                                                                       
level=logging.ERROR, noiselevel=-1)
+                                                               raise # retry
+
                                                loop = global_event_loop()
                                                func_coroutine = 
functools.partial(loop.run_in_executor,
-                                                       None, 
openpgp_env.refresh_keys)
+                                                       None, 
noisy_refresh_keys)
                                                decorated_func = 
retry_decorator(func_coroutine)
                                                
loop.run_until_complete(decorated_func())
                                        out.eend(0)

Reply via email to