コード例 #1
0
ファイル: stacks.py プロジェクト: TWinsnes/sceptre
def step_impl(context, stack_name, desired_status):
    full_name = get_cloudformation_stack_name(context, stack_name)

    status = get_stack_status(context, full_name)
    if status != desired_status:
        delete_stack(context, full_name)
        if desired_status == "CREATE_COMPLETE":
            body = read_template_file(context, "valid_template.json")
            create_stack(context, full_name, body)
        elif desired_status == "CREATE_FAILED":
            body = read_template_file(context, "invalid_template.json")
            kwargs = {"OnFailure": "DO_NOTHING"}
            create_stack(context, full_name, body, **kwargs)
        elif desired_status == "UPDATE_COMPLETE":
            body = read_template_file(context, "valid_template.json")
            create_stack(context, full_name, body)
            body = read_template_file(context, "updated_template.json")
            update_stack(context, full_name, body)
        elif desired_status == "ROLLBACK_COMPLETE":
            body = read_template_file(context, "invalid_template.json")
            kwargs = {"OnFailure": "ROLLBACK"}
            create_stack(context, full_name, body, **kwargs)

    status = get_stack_status(context, full_name)
    assert (status == desired_status)
コード例 #2
0
def step_impl(context, stack_name, desired_status):
    full_name = get_cloudformation_stack_name(context, stack_name)

    status = get_stack_status(context, full_name)
    if status != desired_status:
        delete_stack(context, full_name)
        if desired_status == "CREATE_COMPLETE":
            body = read_template_file(context, "valid_template.json")
            create_stack(context, full_name, body)
        elif desired_status == "CREATE_FAILED":
            body = read_template_file(context, "invalid_template.json")
            kwargs = {"OnFailure": "DO_NOTHING"}
            create_stack(context, full_name, body, **kwargs)
        elif desired_status == "UPDATE_COMPLETE":
            body = read_template_file(context, "valid_template.json")
            create_stack(context, full_name, body)
            body = read_template_file(context, "updated_template.json")
            update_stack(context, full_name, body)
        elif desired_status == "ROLLBACK_COMPLETE":
            body = read_template_file(context, "invalid_template.json")
            kwargs = {"OnFailure": "ROLLBACK"}
            create_stack(context, full_name, body, **kwargs)

    status = get_stack_status(context, full_name)
    assert (status == desired_status)
コード例 #3
0
def step_impl(context, stack_name, change_set_name, filename):
    full_name = get_cloudformation_stack_name(context, stack_name)
    retry_boto_call(context.client.create_change_set,
                    StackName=full_name,
                    ChangeSetName=change_set_name,
                    TemplateBody=read_template_file(context, filename))
    wait_for_final_state(context, stack_name, change_set_name)
コード例 #4
0
def step_impl(context, stack_name, template_name):
    full_name = get_cloudformation_stack_name(context, stack_name)

    status = get_stack_status(context, full_name)
    if status != "CREATE_COMPLETE":
        delete_stack(context, full_name)
        body = read_template_file(context, template_name)
        create_stack(context, full_name, body)

    status = get_stack_status(context, full_name)
    assert (status == "CREATE_COMPLETE")
コード例 #5
0
ファイル: change_sets.py プロジェクト: kushalred/AWS
def step_impl(context, stack_name, change_set_name, filename):
    full_name = get_cloudformation_stack_name(context, stack_name)
    retry_boto_call(context.client.create_change_set,
                    StackName=full_name,
                    Capabilities=[
                        'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM',
                        'CAPABILITY_AUTO_EXPAND'
                    ],
                    ChangeSetName=change_set_name,
                    TemplateBody=read_template_file(context, filename))
    wait_for_final_state(context, stack_name, change_set_name)
コード例 #6
0
ファイル: stacks.py プロジェクト: TWinsnes/sceptre
def step_impl(context, stack_name, template_name):
    full_name = get_cloudformation_stack_name(context, stack_name)

    status = get_stack_status(context, full_name)
    if status != "CREATE_COMPLETE":
        delete_stack(context, full_name)
        body = read_template_file(context, template_name)
        create_stack(context, full_name, body)

    status = get_stack_status(context, full_name)
    assert (status == "CREATE_COMPLETE")
コード例 #7
0
ファイル: stack_groups.py プロジェクト: kushalred/AWS
def create_stacks(context, stack_names):
    body = read_template_file(context, "valid_template.json")
    for stack_name in stack_names:
        time.sleep(1)
        try:
            retry_boto_call(context.client.create_stack,
                            StackName=stack_name,
                            TemplateBody=body)
        except ClientError as e:
            if e.response['Error']['Code'] == 'AlreadyExistsException' \
                    and e.response['Error']['Message'].endswith("already exists"):
                pass
            else:
                raise e
    for stack_name in stack_names:
        wait_for_final_state(context, stack_name)
コード例 #8
0
ファイル: environments.py プロジェクト: TWinsnes/sceptre
def create_stacks(context, stack_names):
    body = read_template_file(context, "valid_template.json")
    for stack_name in stack_names:
        time.sleep(1)
        try:
            retry_boto_call(
                context.client.create_stack,
                StackName=stack_name,
                TemplateBody=body
            )
        except ClientError as e:
            if e.response['Error']['Code'] == 'AlreadyExistsException' \
              and e.response['Error']['Message'].endswith("already exists"):
                pass
            else:
                raise e
    for stack_name in stack_names:
        wait_for_final_state(context, stack_name)