[Resolves #813] Fix nested config Jinja render #1083
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes nested
config.yaml
jinja substitutions (e.g{{ someKey }}
).Fixes issue: #813
Scenario
Currently, when the project structure has multiple nested config files and one of them tries to use a property from another config file sometimes works, and sometimes not, when not work the error message is
<prop> is undefined.
.Example structure:
config/prod/config.yaml
config/prod/2/config.yaml
config/prod/2/3/config.yaml
keyB
should render the valueA-B
andkeyC
should render the valueA-B-C
When running
sceptre launch prod
command theConfigReader
class doesn't follow a correct order to process the files, and sometimes the config object already has all the properties, sometimes not.Solution
Sceptre already has a concept of recursive read in the
ConfigReader
class that reads all theconfig.yaml
files recursively based on the parent path, and already has the configdict
object with all the properties in the correct place, but when call the_render
function just pass thestack_group_config
that only contains the processedstack_group_config
, which is fine when the files follow the correct order to be processed.However, if the
ConfigReader
combines the current recursive object with thestack_group_config
the_render
will have all the required properties, doesn't matter which file order will be used to process the stacks.PR Checklist
[Resolve #issue-number]
.make test
) are passing.pre-commit run --all-files
).and description in grammatically correct, complete sentences.
Approver/Reviewer Checklist
Other Information
Guide to writing a good commit