[PATCH] Always ignore hostname-only network lines in kickstart (#968034)

David Shea dshea at redhat.com
Mon Mar 3 19:07:51 UTC 2014


A kickstart containing, for example, something like:

  network <actual network stuff>
  network --hostname=whatever.example.com

results in an error message being printed by dracut that looks a lot
more dire than it actually is. Quietly ignore the second line instead of
loudly ignoring it.
---
 dracut/parse-kickstart | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index 67255d5..194720d 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -122,11 +122,22 @@ class Network(commands.network.F20_Network):
         '''
         netline = None
 
+        # If the only argument is a hostname, skip this line
+        hostname_state = False
+        for arg in args[1:]:
+            # If this argument is --hostname without the '=', the hostname is the
+            # the next argument, so set the state to skip that one too
+            if arg == '--hostname':
+                hostname_state = True
+            elif hostname_state:
+                hostname_state = False
+            elif not arg.startswith('--hostname='):
+                break
+        else:
+            return None
+
         # first 'network' line
         if len(self.network) == 1:
-            # Setting only hostname in kickstart
-            if not net.device and net.hostname and not self.handler.ksdevice:
-                return None
             net.activate = True
             if net.device == "link" or not net.device:
                 # NOTE: this might still be empty (e.g. 'ks=file:...')
-- 
1.9.0



More information about the anaconda-patches mailing list