diff options
author | Ruoyu Ying <ruoyu.ying@intel.com> | 2019-02-19 22:41:17 +0800 |
---|---|---|
committer | Ruoyu Ying <ruoyu.ying@intel.com> | 2019-02-19 23:01:39 +0800 |
commit | 554e363bded371e21e65c1f97000a4cccde1fb13 (patch) | |
tree | c9a33293162c62d301eec669255c9ab6c42c9fc8 /conductor | |
parent | 8794f07cf11c768876b62ba6628f88f723536eec (diff) |
Make hpa matching case-insensitive
Make the value of attribute 'mandatory' case insensitive in hpa matching
Change-Id: I46f5454a489507f292fcd2cc3edd6d78e2799af4
Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>
Issue-ID: OPTFRA-441
Diffstat (limited to 'conductor')
-rw-r--r-- | conductor/conductor/data/plugins/inventory_provider/hpa_utils.py | 6 | ||||
-rw-r--r-- | conductor/conductor/tests/unit/data/plugins/inventory_provider/hpa_req_features.json | 2 |
2 files changed, 4 insertions, 4 deletions
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": [ { |