From 61ef2c337e3c7980b4460383b0b3b6d287faee95 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Mon, 12 Jul 2021 19:31:06 +0200 Subject: [PATCH] Fix creation of hashmap mapping with a zero cost A cost of 0.0 was interpreted as a False value, making the check think the cost argument was missing. Change-Id: I5f86540221b80667fc63b8b54659092c637b7353 Story: 2009047 Task: 42814 --- cloudkittyclient/v1/rating/hashmap.py | 2 +- .../notes/fix-zero-cost-mapping-7a4247cf1c6815f8.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-zero-cost-mapping-7a4247cf1c6815f8.yaml diff --git a/cloudkittyclient/v1/rating/hashmap.py b/cloudkittyclient/v1/rating/hashmap.py index 85c02ca..ba56dc2 100644 --- a/cloudkittyclient/v1/rating/hashmap.py +++ b/cloudkittyclient/v1/rating/hashmap.py @@ -172,7 +172,7 @@ class HashmapManager(base.BaseManager): :param value: Value of the mapping :type value: str """ - if not kwargs.get('cost'): + if kwargs.get('cost') is None: raise exc.ArgumentRequired("'cost' argument is required") if not kwargs.get('value'): if not kwargs.get('service_id'): diff --git a/releasenotes/notes/fix-zero-cost-mapping-7a4247cf1c6815f8.yaml b/releasenotes/notes/fix-zero-cost-mapping-7a4247cf1c6815f8.yaml new file mode 100644 index 0000000..c73d1a5 --- /dev/null +++ b/releasenotes/notes/fix-zero-cost-mapping-7a4247cf1c6815f8.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixes creation of hashmap mappings with a zero cost.