[PATCH rhel7-branch] Check also ipv6 default routes when looking for onboot=yes device (#1185280)

Radek Vykydal rvykydal at redhat.com
Mon Jun 15 12:29:27 UTC 2015


Resolves: rhbz#1185280
---
 pyanaconda/installclasses/rhel.py | 3 ++-
 pyanaconda/network.py             | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
index be9135b..e1ca310 100644
--- a/pyanaconda/installclasses/rhel.py
+++ b/pyanaconda/installclasses/rhel.py
@@ -58,7 +58,8 @@ class RHELBaseInstallClass(BaseInstallClass):
             return
         # choose the device used during installation
         # (ie for majority of cases the one having the default route)
-        dev = network.default_route_device()
+        dev = network.default_route_device() \
+              or network.default_route_device(family="inet6")
         if not dev:
             return
         # ignore wireless (its ifcfgs would need to be handled differently)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 079946d..1b7607a 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -893,10 +893,10 @@ def ifaceForHostIP(host):
 
     return routeInfo[routeInfo.index("dev") + 1]
 
-def default_route_device():
-    routes = iutil.execWithCapture("ip", ["route", "show"])
+def default_route_device(family="inet"):
+    routes = iutil.execWithCapture("ip", [ "-f", family, "route", "show"])
     if not routes:
-        log.error("Could not get default route device")
+        log.debug("Could not get default %s route device", family)
         return None
 
     for line in routes.split("\n"):
@@ -905,7 +905,7 @@ def default_route_device():
             if len(parts) >= 5 and parts[3] == "dev":
                 return parts[4]
             else:
-                log.error("Could not parse default route device: %s", line)
+                log.debug("Could not parse default %s route device", family)
                 return None
 
     return None
-- 
1.9.3



More information about the anaconda-patches mailing list