import pytest
from tests import cached_yaml as yaml
-from .helpers import validates
+from .helpers import validates, get_param
+
VERSION = "1.0.0"
Return error message string or None if no errors.
"""
for value in metadata.values():
- if isinstance(value, dict):
- if "get_param" in value:
- if value["get_param"] == "environment_context":
- wc = parameters.get("environment_context", {})
- if wc.get("type") == "string":
- break
- else:
- return (
- 'must have parameter "environment_context"'
- ' of type "string"'
- )
- break
- else:
- return None
+ if get_param(value) == "environment_context" and parameters.get("environment_context", {}).get("type", "") != "string":
+ return 'must have parameter "environment_context" of type "string"'
from tests import cached_yaml as yaml
-from .helpers import validates
+from .helpers import validates, is_nova_server
from .utils.vm_types import get_vm_types_for_resource, get_vm_types
invalid_nova_servers = []
for k, v in yml["resources"].items():
- if not isinstance(v, dict):
- continue
- if v.get("type") != "OS::Nova::Server":
+ if not is_nova_server(v):
continue
- if "properties" not in v:
- continue
-
vm_types = get_vm_types_for_resource(v)
if len(vm_types) != 1:
invalid_nova_servers.append(k)