def match()

in qs_cfn_lint_rules/stack/ParameterNotInChild.py [0:0]


    def match(self, cfn):
        """Basic Matching"""
        matches = []
        # try:
        resources = cfn.get_resources(
            resource_type=['AWS::CloudFormation::Stack']
        )

        for r_name, r_values in resources.items():
            properties = r_values.get('Properties')
            child_template_url = properties.get('TemplateURL')

            child_template_parameters = properties.get('Parameters')
            if child_template_parameters is None:
                child_template_parameters = {}

            not_passed_to_child = self.missing_in_child_check(
                current_template_path=os.path.abspath(cfn.filename),
                resource_parameters=child_template_parameters,
                child_template_url=child_template_url,
                mappings=cfn.get_mappings()
            )

            for e in not_passed_to_child:
                path = ['Resources', r_name, 'Properties', 'Parameters', e]
                message = 'Parameter {} not present in child template {}'.format(e, r_name)
                matches.append(RuleMatch(path, message))
        return matches