Fix unknown instance type (#3710)
* Use apiname when comparing unknown instance ids * Use get_instance_types API to populate instance_types.json * Fix scope of instances array when retrieving instance types
This commit is contained in:
parent
442fcd4e51
commit
a0d7a943ee
6 changed files with 46 additions and 154 deletions
|
|
@ -1156,9 +1156,11 @@ class InstanceTypeBackend(object):
|
|||
def describe_instance_types(self, instance_types=None):
|
||||
matches = INSTANCE_TYPES.values()
|
||||
if instance_types:
|
||||
matches = [t for t in matches if t.get("apiname") in instance_types]
|
||||
matches = [t for t in matches if t.get("InstanceType") in instance_types]
|
||||
if len(instance_types) > len(matches):
|
||||
unknown_ids = set(instance_types) - set(matches)
|
||||
unknown_ids = set(instance_types) - set(
|
||||
t.get("InstanceType") for t in matches
|
||||
)
|
||||
raise InvalidInstanceTypeError(unknown_ids)
|
||||
return matches
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue