[VVP] Handle intrinsic functions in prop_iterator 35/98335/1
authorLovett, Trevor <trevor.lovett@att.com>
Tue, 12 Nov 2019 21:18:58 +0000 (15:18 -0600)
committerLovett, Trevor (tl2972) <tl2972@att.com>
Tue, 12 Nov 2019 21:41:45 +0000 (15:41 -0600)
Change-Id: I68131190f84b60276c56ad140d16a3792b764fdc
Issue-ID: VVP-336
Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
ice_validator/tests/helpers.py

index 424dde1..f4a368c 100644 (file)
@@ -53,6 +53,23 @@ __path__ = [os.path.dirname(os.path.abspath(__file__))]
 DEFAULT_OUTPUT_DIR = "{}/../output".format(__path__[0])
 RE_BASE = re.compile(r"(^base$)|(^base_)|(_base_)|(_base$)")
 
+INTRINSIC_FUNCTIONS = [
+    "get_resource",
+    "get_attr",
+    "str_replace",
+    "get_param",
+    "list_join",
+    "get_file",
+    "resource_facade",
+    "Fn::Select",
+    "repeat",
+    "digest",
+    "str_split",
+    "yaql",
+    "map_replace",
+    "map_merge",
+]
+
 
 def is_base_module(template_path):
     basename = os.path.basename(template_path).lower()
@@ -321,12 +338,13 @@ def parameter_type_to_heat_type(parameter):
 
 
 def prop_iterator(resource, *props):
-    terminators = ["get_resource", "get_attr", "str_replace", "get_param"]
     if "properties" in resource:
         resource = resource.get("properties")
     props = list(props)
 
-    if isinstance(resource, dict) and any(x for x in terminators if x in resource):
+    if isinstance(resource, dict) and any(
+        x for x in INTRINSIC_FUNCTIONS if x in resource
+    ):
         yield resource
     else:
         prop = resource.get(props.pop(0))
@@ -426,5 +444,9 @@ def is_nova_server(resource):
     """
     checks resource is a nova server
     """
-    return isinstance(resource, dict) and "type" in resource and "properties" in resource and resource.get("type") == "OS::Nova::Server"
-
+    return (
+        isinstance(resource, dict)
+        and "type" in resource
+        and "properties" in resource
+        and resource.get("type") == "OS::Nova::Server"
+    )