From 554e363bded371e21e65c1f97000a4cccde1fb13 Mon Sep 17 00:00:00 2001 From: Ruoyu Ying Date: Tue, 19 Feb 2019 22:41:17 +0800 Subject: Make hpa matching case-insensitive Make the value of attribute 'mandatory' case insensitive in hpa matching Change-Id: I46f5454a489507f292fcd2cc3edd6d78e2799af4 Signed-off-by: Ruoyu Ying Issue-ID: OPTFRA-441 --- conductor/conductor/data/plugins/inventory_provider/hpa_utils.py | 6 +++--- .../unit/data/plugins/inventory_provider/hpa_req_features.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'conductor') diff --git a/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py b/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py index 8af2e36..228352e 100644 --- a/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py +++ b/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py @@ -74,7 +74,7 @@ class HpaMatchProvider(object): req_filter_list = [] for capability in CapabilityDataParser.get_item(self.req_cap_list, None): - if capability.item['mandatory'] == 'True': + if capability.item['mandatory'].lower() == 'true': hpa_list = {k: capability.item[k] \ for k in hpa_keys if k in capability.item} if hpa_list not in req_filter_list: @@ -290,9 +290,9 @@ class HpaMatchProvider(object): else: req_flag = True break - if not req_flag and capability.item['mandatory'] == 'True': + if not req_flag and capability.item['mandatory'].lower() == 'true': return False, 0, None - if req_flag and capability.item['mandatory'] == 'False': + if req_flag and capability.item['mandatory'].lower() == 'false': score = score + int(capability.item['score']) return True, score, directives diff --git a/conductor/conductor/tests/unit/data/plugins/inventory_provider/hpa_req_features.json b/conductor/conductor/tests/unit/data/plugins/inventory_provider/hpa_req_features.json index ade034e..7c8a226 100644 --- a/conductor/conductor/tests/unit/data/plugins/inventory_provider/hpa_req_features.json +++ b/conductor/conductor/tests/unit/data/plugins/inventory_provider/hpa_req_features.json @@ -4,7 +4,7 @@ "hpa-feature": "basicCapabilities", "hpa-version": "v1", "architecture": "generic", - "mandatory": "True", + "mandatory": "true", "directives": [], "hpa-feature-attributes": [ { -- cgit 1.2.3-korg