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

[PATCH 3/3] Support enabling repos listed but disabled in /etc/yum.repos.d (#663992).



Without this, there is no good way to enable those repos.  Adding a new repo
line with the same name and the baseurl leads to an error about duplicate
repos.  The only way is to add a new repo line with a made up name and the
baseurl.

With this, you can just do "repo --name=updates" and anaconda will enable the
repo found in /etc/yum.repos.d with whatever configuration it already has.
---
 pyanaconda/yuminstall.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 86ea22c..bd6fff8 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -796,6 +796,18 @@ class AnacondaYum(yum.YumBase):
 
         if self.anaconda.ksdata:
             for ksrepo in self.anaconda.ksdata.repo.repoList:
+                # If no location was given, this must be a repo pre-configured
+                # through /etc/yum.repos.d that we just want to enable.
+                if not ksrepo.baseurl and not ksrepo.mirrorlist:
+                    try:
+                        repo = self.repos.getRepo(ksrepo.name)
+                        repo.enable()
+                        log.info("enabled repository %s with URL %s" % (repo.name, repo.mirrorlist or repo.baseurl[0]))
+                    except RepoError:
+                        log.error("Could not find the pre-configured repo %s, skipping" % ksrepo.name)
+
+                    continue
+
                 anacondaBaseURLs = [ksrepo.baseurl]
 
                 # yum doesn't understand nfs:// and doesn't want to.  We need
-- 
1.7.1.1


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