示例#1
0
文件: context.py 项目: kushalred/AWS
    def __init__(self, project_path, command_path,
                 user_variables=None, options=None, output_format=None,
                 no_colour=False, ignore_dependencies=False):
        # project_path: absolute path to the base sceptre project folder
        # e.g. absolute_path/to/sceptre_directory
        self.project_path = normalise_path(project_path)

        # config_path: holds the project stack_groups
        # e.g {project_path}/config
        self.config_path = "config"  # user definable later in v2

        # command_path path to either stack group or stack
        # e.g. {project_path/config_path}/command_path
        self.command_path = normalise_path(command_path)

        self.normal_command_path = normalise_path(command_path)

        # config_file: stack group config. User definable later in v2
        # e.g. {project_path/config/command_path}/config_file
        self.config_file = "config.yaml"

        # templates_path: holds tempaltes. User definable later in v2
        # e.g. {project_path/}templates
        self.templates_path = "templates"

        self.user_variables = user_variables if user_variables else {}
        self.user_variables = user_variables\
            if user_variables is not None else {}
        self.options = options if options else {}
        self.output_format = output_format if output_format else ""
        self.no_colour = no_colour if no_colour is True else False
        self.ignore_dependencies = ignore_dependencies if ignore_dependencies is True else False
示例#2
0
 def setup(self):
     """
     Adds dependency to a Stack.
     """
     dep_stack_name, self.output_key = self.argument.split("::")
     self.dependency_stack_name = normalise_path(dep_stack_name)
     self.stack.dependencies.append(self.dependency_stack_name)
示例#3
0
文件: file.py 项目: zaro0508/sceptre
    def _resolve_template_path(self, template_path):
        """
        Return the project_path joined to template_path as
        a string.

        Note that os.path.join defers to an absolute path
        if the input is absolute.
        """
        return path.join(self.stack_group_config["project_path"], "templates",
                         normalise_path(template_path))
示例#4
0
 def test_normalise_path_with_trailing_slash(self):
     with pytest.raises(PathConversionError):
         normalise_path(
             "this/path/is/invalid/"
         )
示例#5
0
 def test_normalise_path_with_trailing_backslash(self):
     with pytest.raises(PathConversionError):
         normalise_path(
             'this\path\is\invalid\\'
         )
示例#6
0
 def test_normalise_path_with_leading_backslash(self):
     path = normalise_path('\\this\path\is\\valid')
     assert path == join("{}this".format(sep), "path", "is", "valid")
示例#7
0
 def test_normalise_path_with_leading_slash(self):
     path = normalise_path("/this/is/valid")
     assert path == join("{}this".format(sep), "is", "valid")
示例#8
0
 def test_normalise_path_with_double_backslashes_in_path(self):
     path = normalise_path('valid\\path')
     assert path == join("valid", "path")
示例#9
0
 def test_normalise_path_with_backslashes_in_path(self):
     path = normalise_path("valid\path")
     assert path == join("valid", "path")
示例#10
0
 def test_normalise_path_with_valid_path(self):
     path = normalise_path("valid/path")
     assert path == join("valid", "path")