]> xenbits.xensource.com Git - xen.git/commitdiff
pygrub: extlinux parsing correctness
authorRoger Pau Monne <roger.pau@entel.upc.edu>
Tue, 7 Feb 2012 17:21:27 +0000 (17:21 +0000)
committerRoger Pau Monne <roger.pau@entel.upc.edu>
Tue, 7 Feb 2012 17:21:27 +0000 (17:21 +0000)
The "in" operator should be used instead of the find method, since
we are only interested in knowing whether the line contains "initrd=",
but we don't care about it's position. Also fixes an error that
happens when initrd= it's at the start of the line, since find returns
0 and is evaluated as False.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/pygrub/src/ExtLinuxConf.py

index 9d77b9f9bba15b0f4c13bfd07f7de6bc93d757d5..19776a3c925117ec4bfeee211a86a28eba83ffc1 100644 (file)
@@ -60,7 +60,7 @@ class ExtLinuxImage(object):
 
                 # Bypass regular self.commands handling
                 com = None
-            elif arg.find("initrd="):
+            elif "initrd=" in arg:
                 # find initrd image in append line
                 args = arg.strip().split(" ")
                 for a in args: