diff options
Diffstat (limited to 'conductor')
-rw-r--r-- | conductor/conductor/data/plugins/inventory_provider/aai.py | 5 | ||||
-rw-r--r-- | conductor/conductor/data/plugins/inventory_provider/hpa_utils.py | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/conductor/conductor/data/plugins/inventory_provider/aai.py b/conductor/conductor/data/plugins/inventory_provider/aai.py index f37a40a..bde5b03 100644 --- a/conductor/conductor/data/plugins/inventory_provider/aai.py +++ b/conductor/conductor/data/plugins/inventory_provider/aai.py @@ -1607,7 +1607,10 @@ class AAI(base.InventoryProviderBase): def match_hpa(self, candidate, features): """Match HPA features requirement with the candidate flavors """ hpa_provider = hpa_utils.HpaMatchProvider(candidate, features) - directives = hpa_provider.match_flavor() + if hpa_provider.init_verify(): + directives = hpa_provider.match_flavor() + else: + directives = None return directives diff --git a/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py b/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py index 84d4c87..8af2e36 100644 --- a/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py +++ b/conductor/conductor/data/plugins/inventory_provider/hpa_utils.py @@ -53,10 +53,20 @@ def match_all_operator(big_list, small_list): class HpaMatchProvider(object): def __init__(self, candidate, req_cap_list): - self.flavors_list = candidate['flavors']['flavor'] + self.flavors_list = None + if isinstance(candidate.get('flavors'), dict) \ + and candidate.get('flavors').get('flavor'): + self.flavors_list = candidate.get('flavors').get('flavor') self.req_cap_list = req_cap_list self.m_vim_id = candidate.get('vim-id') + # Find out whether there is flavor info inside the candidate + def init_verify(self): + if self.flavors_list is not None: + return True + else: + return False + # Find the flavor which has all the required capabilities def match_flavor(self): # Keys to find capability match |