diff --git a/lib/cli.py b/lib/cli.py index c10dd78d599f9f4397a863798165d7f75cc327c2..e3abe3a56d81c466814024f04fbcaa3622047a00 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -241,6 +241,7 @@ def _SplitKeyVal(opt, data): """ NO_PREFIX = "no_" + UN_PREFIX = "-" kv_dict = {} for elem in data.split(","): if "=" in elem: @@ -248,6 +249,8 @@ def _SplitKeyVal(opt, data): else: if elem.startswith(NO_PREFIX): key, val = elem[len(NO_PREFIX):], False + elif elem.startswith(UN_PREFIX): + key, val = elem[len(UN_PREFIX):], None else: key, val = elem, True if key in kv_dict: diff --git a/test/ganeti.cli_unittest.py b/test/ganeti.cli_unittest.py index 99877279edf3f2fa8b67dd9a154248181c308992..cb3b788ae29ad99c63eb9b0286c7b9ed25ced995 100755 --- a/test/ganeti.cli_unittest.py +++ b/test/ganeti.cli_unittest.py @@ -61,8 +61,8 @@ class TestParseTimespec(unittest.TestCase): class TestSplitKeyVal(unittest.TestCase): """Testing case for cli._SplitKeyVal""" - DATA = "a=b,c,no_d" - RESULT = {"a": "b", "c": True, "d": False} + DATA = "a=b,c,no_d,-e" + RESULT = {"a": "b", "c": True, "d": False, "e": None} def testSplitKeyVal(self): """Test splitting"""