From 14fd4390189673b2f6700c3fcfdd5d2ac5332ba7 Mon Sep 17 00:00:00 2001 From: rajat29 Date: Thu, 25 Jan 2018 13:41:56 +0530 Subject: [PATCH] =?UTF-8?q?Not=20able=20to=20set=20threshold=20value=20to?= =?UTF-8?q?=20=E2=80=980=E2=80=99=20in=20aodh=20alarm=20creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aodh alarm creation fails when threshold value is set to '0, but it can updated to '0'. Change-Id: Ia780e6cdbea97ffe82d6136ea740a221df30469c Closes-Bug: #1743990 --- aodhclient/v2/alarm_cli.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/aodhclient/v2/alarm_cli.py b/aodhclient/v2/alarm_cli.py index 9a7071b..d94fb81 100644 --- a/aodhclient/v2/alarm_cli.py +++ b/aodhclient/v2/alarm_cli.py @@ -344,21 +344,22 @@ class CliAlarmCreate(show.ShowOne): def _validate_args(self, parsed_args): if (parsed_args.type == 'gnocchi_resources_threshold' and - not (parsed_args.metric and parsed_args.threshold and - parsed_args.resource_id and parsed_args.resource_type - and parsed_args.aggregation_method)): + not (parsed_args.metric and parsed_args.threshold is not None + and parsed_args.resource_id and parsed_args.resource_type + and parsed_args.aggregation_method)): self.parser.error('gnocchi_resources_threshold requires --metric, ' '--threshold, --resource-id, --resource-type ' 'and --aggregation-method') elif (parsed_args.type == 'gnocchi_aggregation_by_metrics_threshold' - and not (parsed_args.metrics and parsed_args.threshold and - parsed_args.aggregation_method)): + and not (parsed_args.metrics + and parsed_args.threshold is not None + and parsed_args.aggregation_method)): self.parser.error('gnocchi_aggregation_by_metrics_threshold ' 'requires --metrics, --threshold and ' '--aggregation-method') elif (parsed_args.type == 'gnocchi_aggregation_by_resources_threshold' - and not (parsed_args.metric and parsed_args.threshold and - parsed_args.query and parsed_args.resource_type and + and not (parsed_args.metric and parsed_args.threshold is not None + and parsed_args.query and parsed_args.resource_type and parsed_args.aggregation_method)): self.parser.error('gnocchi_aggregation_by_resources_threshold ' 'requires --metric, --threshold, '