How to use the sceptre.stack.Stack function in sceptre

To help you get started, we’ve selected a few sceptre examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sceptre / sceptre / tests / test_stack.py View on Github external
'parameters': {"key1": "val1"},
        'sceptre_user_data': sentinel.sceptre_user_data,
        'hooks': {},
        's3_details': None,
        'dependencies': sentinel.dependencies,
        'role_arn': sentinel.role_arn,
        'protected': False,
        'tags': {"tag1": "val1"},
        'external_name': sentinel.external_name,
        'notifications': [sentinel.notification],
        'on_failure': sentinel.on_failure,
        'stack_timeout': sentinel.stack_timeout,
        'stack_group_config': {}
    }
    call_kwargs.update(kwargs)
    return Stack(**call_kwargs)
github Sceptre / sceptre / tests / test_hooks / test_asg_scaling_processes.py View on Github external
def setup_method(self, test_method):
        self.stack = MagicMock(spec=Stack)
        self.stack.connection_manager = MagicMock(spec=ConnectionManager)
        self.stack.external_name = "external_name"
        self.asg_scaling_processes = ASGScalingProcesses(None, self.stack)
github Sceptre / sceptre / tests / test_resolvers / test_stack_output.py View on Github external
def test_resolve_with_args(self, mock_get_output_value):
        stack = MagicMock(spec=Stack)
        stack.dependencies = []
        stack._connection_manager = MagicMock(spec=ConnectionManager)
        stack_output_external_resolver = StackOutputExternal(
            "another/account-vpc::VpcId region::profile::iam_role", stack
        )
        mock_get_output_value.return_value = "output_value"
        stack_output_external_resolver.resolve()
        mock_get_output_value.assert_called_once_with(
            "another/account-vpc", "VpcId", "region", "profile", "iam_role"
        )
        assert stack.dependencies == []
github Sceptre / sceptre / tests / test_stack.py View on Github external
def setup_method(self, test_method):
        self.stack = Stack(
            name='dev/app/stack', project_code=sentinel.project_code,
            template_bucket_name=sentinel.template_bucket_name,
            template_key_prefix=sentinel.template_key_prefix,
            required_version=sentinel.required_version,
            template_path=sentinel.template_path, region=sentinel.region,
            profile=sentinel.profile, parameters={"key1": "val1"},
            sceptre_user_data=sentinel.sceptre_user_data, hooks={},
            s3_details=None, dependencies=sentinel.dependencies,
            role_arn=sentinel.role_arn, protected=False,
            tags={"tag1": "val1"}, external_name=sentinel.external_name,
            notifications=[sentinel.notification],
            on_failure=sentinel.on_failure, iam_role=sentinel.iam_role,
            stack_timeout=sentinel.stack_timeout,
            stack_group_config={}
        )
        self.stack._template = MagicMock(spec=Template)
github Sceptre / sceptre / tests / test_stack.py View on Github external
def test_initiate_stack(self):
        stack = Stack(
            name='dev/stack/app', project_code=sentinel.project_code,
            template_path=sentinel.template_path,
            template_bucket_name=sentinel.template_bucket_name,
            template_key_prefix=sentinel.template_key_prefix,
            required_version=sentinel.required_version,
            region=sentinel.region, external_name=sentinel.external_name
        )
        assert stack.name == 'dev/stack/app'
        assert stack.project_code == sentinel.project_code
        assert stack.template_bucket_name == sentinel.template_bucket_name
        assert stack.template_key_prefix == sentinel.template_key_prefix
        assert stack.required_version == sentinel.required_version
        assert stack.external_name == sentinel.external_name
        assert stack.hooks == {}
        assert stack.parameters == {}
        assert stack.sceptre_user_data == {}
github Sceptre / sceptre / tests / test_actions.py View on Github external
def setup_method(self, test_method):
        self.patcher_connection_manager = patch(
            "sceptre.plan.actions.ConnectionManager"
        )
        self.mock_ConnectionManager = self.patcher_connection_manager.start()
        self.stack = Stack(
            name='prod/app/stack', project_code=sentinel.project_code,
            template_path=sentinel.template_path, region=sentinel.region,
            profile=sentinel.profile, parameters={"key1": "val1"},
            sceptre_user_data=sentinel.sceptre_user_data, hooks={},
            s3_details=None, dependencies=sentinel.dependencies,
            role_arn=sentinel.role_arn, protected=False,
            tags={"tag1": "val1"}, external_name=sentinel.external_name,
            notifications=[sentinel.notification],
            on_failure=sentinel.on_failure,
            stack_timeout=sentinel.stack_timeout
        )
        self.actions = StackActions(self.stack)
        self.template = Template(
            "fixtures/templates", self.stack.sceptre_user_data,
            self.actions.connection_manager, self.stack.s3_details
        )
github Sceptre / sceptre / tests / test_stack.py View on Github external
def test_repr_can_eval_correctly(self):
        sceptre = importlib.import_module('sceptre')
        mock = importlib.import_module('mock')
        evaluated_stack = eval(
            repr(self.stack),
            {
                'sceptre': sceptre,
                'sentinel': mock.mock.sentinel
            }
        )
        assert isinstance(evaluated_stack, Stack)
        assert evaluated_stack.__eq__(self.stack)
github Sceptre / sceptre / tests / test_cli.py View on Github external
def setup_method(self, test_method):
        self.patcher_ConfigReader = patch("sceptre.plan.plan.ConfigReader")
        self.patcher_StackActions = patch("sceptre.plan.executor.StackActions")

        self.mock_ConfigReader = self.patcher_ConfigReader.start()
        self.mock_StackActions = self.patcher_StackActions.start()

        self.mock_config_reader = MagicMock(spec=ConfigReader)
        self.mock_stack_actions = MagicMock(spec=StackActions)

        self.mock_stack = MagicMock(spec=Stack)

        self.mock_stack.name = 'mock-stack'
        self.mock_stack.region = None
        self.mock_stack.profile = None
        self.mock_stack.external_name = None
        self.mock_stack.dependencies = []

        self.mock_config_reader.construct_stacks.return_value = \
            set([self.mock_stack]), set([self.mock_stack])

        self.mock_stack_actions.stack = self.mock_stack

        self.mock_ConfigReader.return_value = self.mock_config_reader
        self.mock_StackActions.return_value = self.mock_stack_actions

        self.runner = CliRunner()
github Sceptre / sceptre / tests / test_resolvers / test_stack_output.py View on Github external
def test_resolve_with_implicit_stack_reference_top_level(
        self, mock_get_output_value
    ):
        stack = MagicMock(spec=Stack)
        stack.dependencies = []
        stack.project_code = "project-code"
        stack.name = "stack"
        stack._connection_manager = MagicMock(spec=ConnectionManager)

        dependency = MagicMock()
        dependency.project_code = "meh"
        dependency.name = "vpc"
        dependency.profile = "dependency_profile"
        dependency.region = "dependency_region"
        dependency.iam_role = "dependency_iam_role"

        mock_get_output_value.return_value = "output_value"

        stack_output_resolver = StackOutput("vpc.yaml::VpcId", stack)
github Sceptre / sceptre / sceptre / config / reader.py View on Github external
if required_key not in config:
                raise InvalidConfigFileError(
                    "Required attribute '{0}' not found in configuration of '{1}'.".format(
                        required_key, stack_name
                    )
                )

        abs_template_path = path.join(
            self.context.project_path, self.context.templates_path,
            sceptreise_path(config["template_path"])
        )

        s3_details = self._collect_s3_details(
            stack_name, config
        )
        stack = Stack(
            name=stack_name,
            project_code=config["project_code"],
            template_path=abs_template_path,
            region=config["region"],
            template_bucket_name=config.get("template_bucket_name"),
            template_key_prefix=config.get("template_key_prefix"),
            required_version=config.get("required_version"),
            iam_role=config.get("iam_role"),
            profile=config.get("profile"),
            parameters=config.get("parameters", {}),
            sceptre_user_data=config.get("sceptre_user_data", {}),
            hooks=config.get("hooks", {}),
            s3_details=s3_details,
            dependencies=config.get("dependencies", []),
            role_arn=config.get("role_arn"),
            protected=config.get("protect", False),