From bb489e668649a5829f66bae1b526ec1d12092e86 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Sun, 22 Oct 2006 20:30:55 +0000 Subject: [PATCH] * If addrepo operation fails, remove the repository that is left behind. (fixes 3743) --- pisi/cli/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 0ecdfd93..763b5900 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -1161,7 +1161,11 @@ NB: We support only local files (e.g., /a/b/c) and http:// URIs at the moment indexuri = 'http://paketler.pardus.org.tr/pardus-1-test/pisi-index.xml.bz2' pisi.api.add_repo(name, indexuri, ctx.get_option('at')) if ctx.ui.confirm(_('Update PiSi database for repository %s?') % name): - pisi.api.update_repo(name) + try: + pisi.api.update_repo(name) + except pisi.fetcher.FetchError: + ctx.ui.warning(_("%s repository could not be reached. Removing %s from system.") % (name, name)) + pisi.api.remove_repo(name) self.finalize() else: self.help()