[PATCH 8/9] Smooth out some rough edges with base repo switching.

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

 



Remove cache dirs for "anaconda" repo when resetting since that repo
name can apply to any base repo configured manually by the user.

Disable all built-in repos when setup of user-specified base repo fails
and we were instructed not to fall back on the on-disk repo configs.
---
 pyanaconda/packaging/yumpayload.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 0c7d028..5e48e93 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -145,11 +145,17 @@ class YumPayload(PackagePayload):
 
     def _resetYum(self, root=None):
         """ Delete and recreate the payload's YumBase instance. """
+        import shutil
         if root is None:
             root = self._root_dir
 
         with _yum_lock:
             if self._yum:
+                for repo in self._yum.repos.listEnabled():
+                    if repo.name == BASE_REPO_NAME and \
+                       os.path.isdir(repo.cachedir):
+                        shutil.rmtree(repo.cachedir)
+
                 del self._yum
 
             self._yum = yum.YumBase()
@@ -317,10 +323,10 @@ reposdir=%s
         try:
             self._configureBaseRepo(storage)
         except PayloadError as e:
-            log.error("failed to set up base repo: %s" % e)
             if not fallback:
-                # XXX this leaves the configuration exactly as specified in the
-                #     on-disk yum configuration
+                for repo in self._yum.repos.repos.values():
+                    if repo.enabled:
+                        self.disableRepo(repo.id)
                 raise
 
             # this preserves the method details while disabling it
@@ -499,6 +505,8 @@ reposdir=%s
                 self._addYumRepo(BASE_REPO_NAME, url,
                                  proxy=proxy, sslverify=sslverify)
             except MetadataError as e:
+                log.error("base repo (%s/%s) not valid -- removing it"
+                          % (method.method, url))
                 self._removeYumRepo(BASE_REPO_NAME)
                 raise
 
-- 
1.7.7.6

_______________________________________________
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