How to use sceptre - 10 common examples

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_config_reader.py View on Github external
def test_read_reads_config_file(self, filepaths, target):
        project_path, config_dir = self.create_project()

        for rel_path in filepaths:
            config = {"filepath": rel_path}
            abs_path = os.path.join(config_dir, rel_path)
            self.write_config(abs_path, config)

        self.context.project_path = project_path
        config = ConfigReader(self.context).read(target)

        assert config == {
            "project_path": project_path,
            "stack_group_path": os.path.split(target)[0],
            "filepath": target
        }
github Sceptre / sceptre / integration-tests / steps / stack_groups.py View on Github external
def step_impl(context, stack_group_name):
    sceptre_context = SceptreContext(
        command_path=stack_group_name,
        project_path=context.sceptre_dir,
        ignore_dependencies=True
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    sceptre_plan.delete()
github Sceptre / sceptre / integration-tests / steps / change_sets.py View on Github external
def step_impl(context, change_set_name, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir,
        ignore_dependencies=True
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    allowed_errors = {'ValidationError', 'ChangeSetNotFound'}

    try:
        sceptre_plan.execute_change_set(change_set_name)
    except ClientError as e:
        if e.response['Error']['Code'] in allowed_errors:
            context.error = e
            return
        else:
            raise e
github Sceptre / sceptre / integration-tests / steps / stacks.py View on Github external
def step_impl(context, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir,
        ignore_dependencies=True
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    try:
        sceptre_plan.update()
    except ClientError as e:
        message = e.response['Error']['Message']
        if e.response['Error']['Code'] == 'ValidationError' \
                and message.endswith("does not exist"):
            return
        else:
            raise e
github Sceptre / sceptre / integration-tests / steps / change_sets.py View on Github external
def step_impl(context, change_set_name, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    allowed_errors = {'ValidationError', 'ChangeSetNotFound'}

    try:
        responses = sceptre_plan.describe_change_set(change_set_name)
    except ClientError as e:
        if e.response['Error']['Code'] in allowed_errors:
            context.error = e
            return
        else:
            raise e
    context.output = responses
github Sceptre / sceptre / integration-tests / steps / templates.py View on Github external
def step_impl(context, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir
    )
    sceptre_plan = SceptrePlan(sceptre_context)
    try:
        context.output = sceptre_plan.generate()
    except Exception as e:
        context.error = e
github Sceptre / sceptre / tests / test_plan.py View on Github external
def setup_method(self, test_method):
        self.patcher_SceptrePlan = patch("sceptre.plan.plan.SceptrePlan")
        self.stack = Stack(
            name='dev/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.mock_context = MagicMock(spec=SceptreContext)
        self.mock_config_reader = MagicMock(spec=ConfigReader)
        self.mock_context.project_path = sentinel.project_path
        self.mock_context.command_path = sentinel.command_path
        self.mock_context.config_file = sentinel.config_file
        self.mock_context.full_config_path.return_value =\
            sentinel.full_config_path
        self.mock_context.user_variables = {}
        self.mock_context.options = {}
        self.mock_context.no_colour = True
        self.mock_config_reader.context = self.mock_context
github Sceptre / sceptre / integration-tests / steps / change_sets.py View on Github external
def step_impl(context, change_set_name, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir,
        ignore_dependencies=True
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    allowed_errors = {'ValidationError', 'ChangeSetNotFound'}
    sceptre_plan.delete_change_set(change_set_name)

    try:
        sceptre_plan.delete_change_set(change_set_name)
    except ClientError as e:
        if e.response['Error']['Code'] in allowed_errors:
            context.error = e
            return
        else:
github Sceptre / sceptre / integration-tests / steps / change_sets.py View on Github external
def step_impl(context, change_set_name, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    allowed_errors = {'ValidationError', 'ChangeSetNotFound'}
    try:
        sceptre_plan.create_change_set(change_set_name)
    except ClientError as e:
        if e.response['Error']['Code'] in allowed_errors:
            context.error = e
            return
        else:
            raise e

    wait_for_final_state(context, stack_name, change_set_name)
github Sceptre / sceptre / integration-tests / steps / templates.py View on Github external
def set_template_path(context, stack_name, template_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + ".yaml",
        project_path=context.sceptre_dir
    )

    config_path = sceptre_context.full_config_path()

    template_path = os.path.join(
        sceptre_context.project_path,
        sceptre_context.templates_path,
        template_name
    )
    with open(os.path.join(config_path, stack_name + '.yaml')) as config_file:
        stack_config = yaml.safe_load(config_file)

    stack_config["template_path"] = template_path