[VVP] pseudo-parameters nested parameters 42/77742/2
authorstark, steven <steven.stark@att.com>
Fri, 1 Feb 2019 21:02:56 +0000 (13:02 -0800)
committerstark, steven <steven.stark@att.com>
Fri, 1 Feb 2019 21:15:47 +0000 (13:15 -0800)
Change-Id: Iff7630a6f62fa8b83c80048d6efc12d187037412
Issue-ID: VVP-157
Signed-off-by: stark, steven <steven.stark@att.com>
ice_validator/tests/test_nested_parameters.py
ice_validator/tests/utils/nested_iterables.py

index 251e7c1..12b5768 100644 (file)
@@ -43,6 +43,7 @@ import pytest
 from tests import cached_yaml as yaml
 from tests.structures import Resource
 from .helpers import validates
+from .utils.nested_iterables import is_pseudo_param
 
 VERSION = "1.0.0"
 
@@ -57,7 +58,6 @@ def check_nested_parameter_doesnt_change(yaml_file):
         pytest.skip("No resources specified in the heat template")
 
     invalid_parameters = []
-
     """
     checking if property: { get_param: parameter }, then property == parameter
 
@@ -95,6 +95,9 @@ def check_nested_parameter_doesnt_change(yaml_file):
                     if isinstance(parameter, list):
                         parameter = parameter[0]
 
+                    if is_pseudo_param(parameter):
+                        continue
+
                     if k1 != parameter:
                         invalid_parameters.append(
                             {
index 5966201..44ca2bc 100644 (file)
 #
 
 
+def is_pseudo_param(parameter):
+    pseudo_parameters = ["OS::stack_name", "OS::stack_id", "OS::project_id"]
+    return parameter in pseudo_parameters
+
+
 def parse_nested_dict(d, key=""):
     """
     parse the nested dictionary and return values of
@@ -63,13 +68,12 @@ def find_all_get_param_in_yml(yml):
     Recursively find all referenced parameters in a parsed yaml body
     and return a list of parameters
     """
-    os_pseudo_parameters = ["OS::stack_name", "OS::stack_id", "OS::project_id"]
 
     if not hasattr(yml, "items"):
         return []
     params = []
     for k, v in yml.items():
-        if k == "get_param" and v not in os_pseudo_parameters:
+        if k == "get_param" and not is_pseudo_param(v):
             if isinstance(v, list) and not isinstance(v[0], dict):
                 params.append(v[0])
             elif not isinstance(v, dict) and isinstance(v, str):