-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# Description Proposed implementation of #1318 * This introduces a `dump template` command that behaves similarly to `generate` but also writes output docs to files. * The behaviour of `dump config` is changed here not to print multi-doc output to screen similar to `dump config`. * The `write` helper function is modified to optionally write to a `file_path`. * This also deprecates the generate command in favor of dump command Writes files in a naming convention for `dump config` and `dump template` respectively: ``` f".dump/{stack_name}/config.yaml" f".dump/{stack_name}/template.yaml" ``` # Usage example ## Dump config ``` % sceptre --merge-vars --dir=emr --var-file=/app/sceptre-environment/nonprod/datalake-nonprod/common-env.yaml --var-file=/app/sceptre-environment/common-env.yaml --var-file=/app/sceptre-environment/nonprod/datalake-nonprod/emr/streaming-nonprod-6100/cluster.yaml dump config emr.yaml > /dev/null ``` ## Dump template ``` % sceptre --merge-vars --dir=emr --var-file=/app/sceptre-environment/nonprod/datalake-nonprod/common-env.yaml --var-file=/app/sceptre-environment/common-env.yaml --var-file=/app/sceptre-environment/nonprod/datalake-nonprod/emr/streaming-nonprod-6100/cluster.yaml dump template emr.yaml > /dev/null ``` ## File structure created ``` % tree .dump/ .dump/ ├── streaming-nonprod-6100-efs-pvt │ ├── config.yaml │ └── template.yaml ├── streaming-nonprod-6100-emr │ ├── config.yaml │ └── template.yaml ├── streaming-nonprod-6100-emr-profile │ ├── config.yaml │ └── template.yaml └── streaming-nonprod-6100-emr-sg-pvt ├── config.yaml └── template.yaml 4 directories, 8 files ``` ## File content ```yaml % head .dump/streaming-nonprod-6100-emr/config.yaml --- dependencies: - emr-profile.yaml hooks: after_create: - !!python/object:hook.stack_termination_protection.StackTerminationProtection _argument: enabled _argument_is_resolved: false logger: &id001 !!python/object/apply:logging.getLogger - hook.stack_termination_protection ``` ```yaml % head .dump/streaming-nonprod-6100-emr/template.yaml --- AWSTemplateFormatVersion: '2010-09-09' Parameters: MasterInstanceType: Type: String CoreInstantType: Type: String CoreInstantCount: Type: String ```
- Loading branch information
1 parent
ef9dc21
commit dcae1a9
Showing
13 changed files
with
199 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...sts/features/generate-template-s3.feature → ...n-tests/features/dump-template-s3.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
@s3-template-handler | ||
Feature: Generate template s3 | ||
Feature: Dump template s3 | ||
|
||
Scenario: Generating static templates with S3 template handler | ||
Scenario: Dumping static templates with S3 template handler | ||
Given the template for stack "13/B" is "valid_template.json" | ||
When the user generates the template for stack "13/B" | ||
When the user dumps the template for stack "13/B" | ||
Then the output is the same as the contents of "valid_template.json" template | ||
|
||
Scenario: Render jinja templates with S3 template handler | ||
Given the template for stack "13/C" is "jinja/valid_template.j2" | ||
When the user generates the template for stack "13/C" | ||
When the user dumps the template for stack "13/C" | ||
Then the output is the same as the contents of "valid_template.json" template | ||
|
||
Scenario: Render python templates with S3 template handler | ||
Given the template for stack "13/D" is "python/valid_template.py" | ||
When the user generates the template for stack "13/D" | ||
When the user dumps the template for stack "13/D" | ||
Then the output is the same as the contents of "valid_template.json" template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.