This is needed for changing exclusive_storage for node groups. Signed-off-by: Bernardo Dal Seno <bdals...@google.com> --- lib/cli.py | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/lib/cli.py b/lib/cli.py index fb2ddaf..9f041df 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -632,6 +632,19 @@ def check_bool(option, opt, value): # pylint: disable=W0613 raise errors.ParameterError("Invalid boolean value '%s'" % value) +def check_maybebool(option, opt, value): # pylint: disable=W0613 + """Custom parser for yes/no/defaults options. + + This will store the parsed value as True, False or + L{constants.VALUE_DEFAULT}. + + """ + if value.lower() == constants.VALUE_DEFAULT: + return constants.VALUE_DEFAULT + else: + check_bool(option, opt, value) + + def check_list(option, opt, value): # pylint: disable=W0613 """Custom parser for comma-separated lists. @@ -691,6 +704,7 @@ class CliOption(Option): "keyval", "unit", "bool", + "maybebool", "list", "maybefloat", ) @@ -699,6 +713,7 @@ class CliOption(Option): TYPE_CHECKER["keyval"] = check_key_val TYPE_CHECKER["unit"] = check_unit TYPE_CHECKER["bool"] = check_bool + TYPE_CHECKER["maybebool"] = check_maybebool TYPE_CHECKER["list"] = check_list TYPE_CHECKER["maybefloat"] = check_maybefloat -- 1.7.7.3