From 7992c24da4b2a2fff81b02dcf0512d62befe8a17 Mon Sep 17 00:00:00 2001 From: april Date: Tue, 5 Jan 2016 18:01:14 +0800 Subject: Improve ceilometer alarm enabled input parameter validation strict the input parameter of enabled in the command : ceilometer alarm-threshold-update --enabled {True|False} This commit will improve the enabled value validation, if the input value is invalid such as "abde" "enabled", error info will be returned. Closes-Bug: #1531042 Change-Id: Ic553bc9ffa05a84575fc5626416c79fc84687bbe --- ceilometerclient/v2/shell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ceilometerclient/v2/shell.py b/ceilometerclient/v2/shell.py index 0041798..22f55e3 100644 --- a/ceilometerclient/v2/shell.py +++ b/ceilometerclient/v2/shell.py @@ -464,7 +464,8 @@ def common_alarm_arguments(create=False): @utils.arg('--severity', metavar='', help='Severity of the alarm, one of: ' + str(ALARM_SEVERITY)) - @utils.arg('--enabled', type=strutils.bool_from_string, + @utils.arg('--enabled', + type=lambda v: strutils.bool_from_string(v, True), metavar='{True|False}', help='True if alarm evaluation/actioning is enabled.') @utils.arg('--alarm-action', dest='alarm_actions', -- cgit v1.2.1