From c522ea0284881355f9cf5ade15dcdcf0473f77c7 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 30 Nov 2007 10:22:56 +0000 Subject: [PATCH] Fix parsing of drbdsetup show output This fixes the parsing of integers in the drbdsetup show output with newer pyparsing versions. Basically, the convert-to-int action that we use was taken from the example documentation of an older pyparsing version that automatically uses only the second element if the result is returned as a tuple, but this was deprecated for a while and removed in 1.4.3. Based on a nice report by Jorge Cabello <jorge@aspl.es>, and confirmation about pyparsing behaviour from its author. Thanks! Reviewed-by: imsnah --- lib/bdev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bdev.py b/lib/bdev.py index 29a90ad46..5069bb2fe 100644 --- a/lib/bdev.py +++ b/lib/bdev.py @@ -1702,7 +1702,7 @@ class DRBD8(BaseDRBD): rbrace = pyp.Literal("}").suppress() semi = pyp.Literal(";").suppress() # this also converts the value to an int - number = pyp.Word(pyp.nums).setParseAction(lambda s, l, t:(l, [int(t[0])])) + number = pyp.Word(pyp.nums).setParseAction(lambda s, l, t: int(t[0])) comment = pyp.Literal ("#") + pyp.Optional(pyp.restOfLine) defa = pyp.Literal("_is_default").suppress() -- GitLab