Re: [PATCH master] After cancelled stage 2 network enablement remove temporary repo (#623639)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ack.

On Thu, 12 Aug 2010, Radek Vykydal wrote:

When adding a repository requiring network enablement, we should
remove temporary repo object if the enablement failed. Otherwise
we can run into duplicate repos error (causing the traceback at the
moment) in next try.
---
pyanaconda/iw/task_gui.py |   18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/iw/task_gui.py b/pyanaconda/iw/task_gui.py
index 8f9fac0..cba030d 100644
--- a/pyanaconda/iw/task_gui.py
+++ b/pyanaconda/iw/task_gui.py
@@ -57,9 +57,6 @@ def setupRepo(anaconda, repo):
                "Please ensure that your repository has been "
                "correctly generated.\n\n%s" % str(e)),
                                type="ok", custom_icon="error")
-        repo.disable()
-        repo.close()
-        anaconda.backend.ayum.repos.delete(repo.id)
        return False

    return True
@@ -161,6 +158,12 @@ class RepoEditor:
        repo.enable()
        return True

+    def _disableAndRemoveRepo(self, repo):
+        repo.disable()
+        repo.close()
+        self.anaconda.backend.ayum.repos.delete(repo.id)
+
+
    def _validURL(self, url):
        return len(url) > 0 and (url.startswith("http://";) or
                                 url.startswith("https://";) or
@@ -365,8 +368,11 @@ class RepoEditor:
            newRepoObj.basecachedir = self.anaconda.backend.ayum.conf.cachedir

            type = self.typeComboBox.get_active()
-            if not applyFuncs[type](newRepoObj) or not self._addAndEnableRepo(newRepoObj) or not \
-                   setupRepo(self.anaconda, newRepoObj):
+            if (not applyFuncs[type](newRepoObj) or
+                not self._addAndEnableRepo(newRepoObj)):
+                continue
+            if not setupRepo(self.anaconda, newRepoObj):
+                self._disableAndRemoveRepo(newRepoObj)
                continue

            if removeOld:
@@ -589,6 +595,8 @@ class TaskWindow(InstallWindow):

            repo.enable()
            if not setupRepo(self.anaconda, repo):
+                repo.disable()
+                repo.close()
                return
        else:
            repo.disable()


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux