コード例 #1
0
ファイル: stack_policies.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    try:
        stack.lock()
    except ClientError as e:
        context.error = e
コード例 #2
0
ファイル: stacks.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    try:
        stack.launch()
    except Exception as e:
        context.error = e
コード例 #3
0
 def test_construct_stack_with_valid_config(self, mock_Stack,
                                            mock_collect_s3_details):
     mock_Stack.return_value = sentinel.stack
     mock_collect_s3_details.return_value = sentinel.s3_details
     config_reader = ConfigReader(self.test_project_pathectory)
     stack = config_reader.construct_stack(
         "account/stack-group/region/vpc.yaml")
     mock_Stack.assert_called_with(
         name="account/stack-group/region/vpc",
         project_code="account_project_code",
         template_path=os.path.join(self.test_project_pathectory,
                                    "path/to/template"),
         region="region_region",
         profile="account_profile",
         parameters={"param1": "val1"},
         sceptre_user_data={},
         hooks={},
         s3_details=sentinel.s3_details,
         dependencies=["child/level", "top/level"],
         role_arn=None,
         protected=False,
         tags={},
         external_name=None,
         notifications=None,
         on_failure=None,
         stack_timeout=0)
     assert stack == sentinel.stack
コード例 #4
0
ファイル: templates.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    try:
        context.output = stack.template.body
    except Exception as e:
        context.error = e
コード例 #5
0
ファイル: templates.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    try:
        context.response = stack.template.validate()
    except ClientError as e:
        context.error = e
コード例 #6
0
ファイル: stacks.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    try:
        stack.create()
    except ClientError as e:
        if e.response['Error']['Code'] == 'AlreadyExistsException' \
          and e.response['Error']['Message'].endswith("already exists"):
            return
        else:
            raise e
コード例 #7
0
ファイル: stacks.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    try:
        stack.delete()
    except ClientError as e:
        if e.response['Error']['Code'] == 'ValidationError' \
          and e.response['Error']['Message'].endswith("does not exist"):
            return
        else:
            raise e
コード例 #8
0
ファイル: change_sets.py プロジェクト: rgitzel/sceptre
def step_impl(context, change_set_name, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    allowed_errors = {'ValidationError', 'ChangeSetNotFound'}
    try:
        stack.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
コード例 #9
0
ファイル: stacks.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")
    try:
        stack.update()
    except ClientError as e:
        message = e.response['Error']['Message']
        if e.response['Error']['Code'] == 'ValidationError' \
            and (message.endswith("does not exist")
                 or message.endswith("No updates are to be performed.")):
            return
        else:
            raise e
コード例 #10
0
ファイル: helpers.py プロジェクト: rgitzel/sceptre
def get_stack_or_stack_group(ctx, path):
    """
    Parses the path to generate relevant Stack Group and Stack object.

    :param ctx: Cli context.
    :type ctx: click.Context
    :param path: Path to either stack config or stack_group folder.
    :type path: str
    """
    stack = None
    stack_group = None

    config_reader = ConfigReader(ctx.obj["sceptre_dir"],
                                 ctx.obj["user_variables"])

    if os.path.splitext(path)[1]:
        stack = config_reader.construct_stack(path)
    else:
        stack_group = config_reader.construct_stack_group(path)

    return (stack, stack_group)
コード例 #11
0
def get_stack_or_stack_group(context):
    """
    Parses the path to generate relevant Stack Group and Stack object.

    :param context: Cli context.
    :type context: click.Context
    :param path: Path to either stack config or stack_group folder.
    :type path: str
    """
    stack = None
    stack_group = None

    config_reader = ConfigReader(
        context.project_path, context.user_variables
    )

    if os.path.splitext(context.command_path)[1]:
        stack = config_reader.construct_stack(context.command_path)
    else:
        stack_group = config_reader.construct_stack_group(context.command_path)

    return (stack, stack_group)
コード例 #12
0
ファイル: stacks.py プロジェクト: rgitzel/sceptre
def step_impl(context, stack_name):
    config_reader = ConfigReader(context.sceptre_dir)
    stack = config_reader.construct_stack(stack_name + ".yaml")

    context.output = stack.describe_resources()