- continue
- vm_type = vm_type.lower()
-
- if vm_type+"_" not in k1.lower():
- invalid_nova_servers.append(k1)
+ # could not determine vm_type
+ invalid_nova_servers.append({"resource": k1, "vm_type": "none found"})
+ else:
+ k1_split = k1.split("_server_")
+ k1_prefix = k1_split[0]
+ if k1_prefix != vm_type:
+ # vm_type on server doesn't match
+ invalid_nova_servers.append({"resource": k1, "vm_type": vm_type})
+ else:
+ if len(k1_split) == 2:
+ k1_suffix = k1_split[1]
+ try:
+ int(k1_suffix)
+ except ValueError:
+ # vm_type_index is not an integer
+ invalid_nova_servers.append(
+ {
+ "resource": k1,
+ "vm_type": vm_type,
+ "vm_type_index": k1_suffix,
+ }
+ )
+ else:
+ # vm_type_index not found
+ invalid_nova_servers.append(
+ {
+ "resource": k1,
+ "vm_type": vm_type,
+ "vm_type_index": "none found",
+ }
+ )