Code Duplication    Length = 13-13 lines in 2 locations

utils/render-policy.py 1 location

@@ 49-61 (lines=13) @@
46
            rules_dict[rule.id_] = rule
47
        return rules_dict
48
49
    def get_env_yaml(self, product, build_dir):
50
        product_yaml = self.project_directory / product / "product.yml"
51
        build_config_yaml = pathlib.Path(build_dir) / "build_config.yml"
52
        if not (product_yaml.exists() and build_config_yaml.exists()):
53
            msg = (
54
                "No product yaml and/or build config found in "
55
                "'{product_yaml}' and/or '{build_config_yaml}', respectively, please make sure "
56
                "that you got the product right, and that it is built."
57
                .format(product_yaml=product_yaml, build_config_yaml=build_config_yaml)
58
            )
59
            raise ValueError(msg)
60
        env_yaml = ssg.yaml.open_environment(build_config_yaml, product_yaml)
61
        return env_yaml
62
63
    def get_result(self):
64
        subst_dict = dict(rules=self.rules_dict, product=self.product, policy=self.policy)

utils/template_renderer.py 1 location

@@ 60-72 (lines=13) @@
57
58
        self.template_data = dict()
59
60
    def get_env_yaml(self, build_dir):
61
        product_yaml = self.project_directory / self.product / "product.yml"
62
        build_config_yaml = pathlib.Path(build_dir) / "build_config.yml"
63
        if not (product_yaml.exists() and build_config_yaml.exists()):
64
            msg = (
65
                "No product yaml and/or build config found in "
66
                "'{product_yaml}' and/or '{build_config_yaml}', respectively, please make sure "
67
                "that you got the product right, and that it is built."
68
                .format(product_yaml=product_yaml, build_config_yaml=build_config_yaml)
69
            )
70
            raise ValueError(msg)
71
        env_yaml = ssg.yaml.open_environment(build_config_yaml, product_yaml)
72
        return env_yaml
73
74
    def _set_rule_relative_definition_location(self, rule):
75
        rule.relative_definition_location = (