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
This commit is contained in:
@@ -464,7 +464,8 @@ def common_alarm_arguments(create=False):
|
|||||||
@utils.arg('--severity', metavar='<SEVERITY>',
|
@utils.arg('--severity', metavar='<SEVERITY>',
|
||||||
help='Severity of the alarm, one of: '
|
help='Severity of the alarm, one of: '
|
||||||
+ str(ALARM_SEVERITY))
|
+ 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}',
|
metavar='{True|False}',
|
||||||
help='True if alarm evaluation/actioning is enabled.')
|
help='True if alarm evaluation/actioning is enabled.')
|
||||||
@utils.arg('--alarm-action', dest='alarm_actions',
|
@utils.arg('--alarm-action', dest='alarm_actions',
|
||||||
|
|||||||
Reference in New Issue
Block a user