commit:     46f4adc7bdf67b69d130defbfcec9f623cbfef78
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 22 17:40:04 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Apr 22 17:40:07 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=46f4adc7

api.py: Adds prompt for user to re-add overlay after unsuccessful URL update

X-Gentoo-Bug: 547388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/547388

 layman/api.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 82436fc..12c2368 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -26,7 +26,7 @@ from layman.remotedb        import RemoteDB
 from layman.overlays.source import require_supported
 #from layman.utils import path, delete_empty_directory
 from layman.compatibility   import encode
-from layman.utils           import verify_overlay_src
+from layman.utils           import get_ans, verify_overlay_src
 from layman.mounter         import Mounter
 
 if sys.hexversion >= 0x30200f0:
@@ -499,8 +499,11 @@ class LaymanAPI(object):
                             warnings.append((ovl, url_msg))
                             update_success = db.update(ordb, available_srcs)
                             if not update_success:
-                                self.output.warn('Failed to update 
repo...readding', 2)
-                                self.readd_repos(ovl)
+                                msg = 'Failed to update source URL for 
overlay'\
+                                      '"%(ovl)s". Re-add overlay? [y/n]'\
+                                      % {'ovl': ovl}
+                                if get_ans(msg, color='yellow'):
+                                    self.readd_repos(ovl)
                 except Exception as error:
                     self.output.warn('Failed to perform overlay type or url 
updates', 2)
                     self.output.warn('    for Overlay: %s' % ovl, 2)

Reply via email to