diff options
author | april <xiaolixu@cn.ibm.com> | 2016-01-05 18:01:14 +0800 |
---|---|---|
committer | april <xiaolixu@cn.ibm.com> | 2016-01-05 07:29:23 +0000 |
commit | 7992c24da4b2a2fff81b02dcf0512d62befe8a17 (patch) | |
tree | 339fdc5f54b7c528889b2e9a296f358ac76b3902 | |
parent | 6097b0ce2ed80651f2e49c47adf7c0b5a11f5431 (diff) | |
download | python-ceilometerclient-7992c24da4b2a2fff81b02dcf0512d62befe8a17.tar.gz |
Improve ceilometer alarm enabled input parameter validation
strict the input parameter of enabled in the command :
ceilometer alarm-threshold-update <alarm-id> --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
-rw-r--r-- | ceilometerclient/v2/shell.py | 3 |
1 files changed, 2 insertions, 1 deletions
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='<SEVERITY>', 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', |