[rhel7-branch 1/1] network: Don't set --device link default for hostname only network cmd (#1272274)

rvykydal installerbot-noreply at redhat.com
Fri Oct 16 12:30:35 UTC 2015


From: Radek Vykydal <rvykydal at redhat.com>

network --hostname=blah

used in %pre section could override a device configuration with dhcp which is a
regression caused by commit 7473be3d9c5f0c2b434e4c86231b73e72ffe64f9

Resolves: rhbz#1272274
---
 pyanaconda/kickstart.py | 13 +++++++++++++
 pyanaconda/network.py   |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index e3f956a..4f0da22 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1070,6 +1070,19 @@ def execute(self, *args):
             logger.updateRemote(remote_server)
 
 class Network(commands.network.RHEL7_Network):
+    def parse(self, args):
+        nd = commands.network.RHEL7_Network.parse(self, args)
+        setting_only_hostname = nd.hostname and len(args) <= 2
+        if not setting_only_hostname:
+            if not nd.device:
+                ksdevice = flags.cmdline.get('ksdevice')
+                if ksdevice:
+                    log.info('network: setting %s from ksdevice for missing kickstart --device')
+                    nd.device = ksdevice
+                else:
+                    log.info('network: setting "link" for missing --device specification in kickstart')
+                    nd.device = "link"
+        return nd
     def execute(self, storage, ksdata, instClass):
         network.write_network_config(storage, ksdata, instClass, iutil.getSysroot())
 
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 5d8e6c3..93dde9d 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -1181,7 +1181,7 @@ def update_hostname_data(ksdata, hostname):
 
 def get_device_name(network_data):
 
-    ksspec = network_data.device or flags.cmdline.get('ksdevice') or "link"
+    ksspec = network_data.device or ""
     dev_name = ks_spec_to_device_name(ksspec)
     if not dev_name:
         return ""


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/32edc768d8d8f8babde0c4b189f053b5ed93f1f7


More information about the anaconda-patches mailing list