[PATCH] pygrub: extlinux parsing correctness

Roger Pau Monne
Mon, 06 Feb 2012 14:40:09 -0000

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1328539206 -3600
# Node ID 67d41a95b5a77b91b16acfe6f4540aa487b57f5d
# Parent  9e2f11af4f13e24b1bc4daab2067417d1874f4a9
pygrub: extlinux parsing correctness

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>

diff -r 9e2f11af4f13 -r 67d41a95b5a7 tools/pygrub/src/ExtLinuxConf.py
--- a/tools/pygrub/src/ExtLinuxConf.py	Mon Feb 06 12:29:59 2012 +0100
+++ b/tools/pygrub/src/ExtLinuxConf.py	Mon Feb 06 15:40:06 2012 +0100
@@ -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(" ")