New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TaskCat Config Generator #820
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, a well intended review and I 💯 appreciate the thought and effort. I think this will need a few iterations before it's ready to merge. Feel free to reach out internally to discuss.
taskcat/project_config/tc_config.py
Outdated
if self.create_overrides_file: | ||
m = open(f'{self.project_root_path}/.taskcat_overrides.yml', | ||
"w+", | ||
encoding="utf-8") | ||
p_overrides = [] | ||
p_blanks = [] | ||
p_default = [] | ||
for p in parameters: | ||
if parameters[p] == 'OVERRIDE': | ||
p_overrides.append(f'{p}: OVERRIDE\r\n') | ||
elif parameters[p] == '': | ||
p_blanks.append(f'{p}: ""\r\n') | ||
else: | ||
p_default.append(f'{p}: {parameters[p]}\r\n') | ||
p_overrides.sort() | ||
p_blanks.sort() | ||
p_default.sort() | ||
m.write("# OVERRIDES\r\n") | ||
m.write(''.join(p_overrides)) | ||
m.write("# BLANKS\r\n") | ||
m.write(''.join(p_blanks)) | ||
m.write("# DEFAULTS\r\n") | ||
m.write(''.join(p_default)) | ||
m.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? If there's no config, there's nothing to overwrite; In my mind, the intended purposes of this feature is to generate a basic config given a template;
If a parameter has a default value, use that.
Overview
This change adds the ability to generate the .taskcat.yml config file based on a CloudFormation template. The tool can generate the configuration file with verbose information (-v) about the parameters.(This information is taken from the CFN)
The tool also offers the option to generate a .taskcat_overrides.yml file (-c). The tool attempts to populate empty values based on the parameter name.
Testing/Steps taken to ensure quality
How did you validate the changes in this PR?
I ran the tool against a 15 different Quick Start projects.
Notes
Optional. Caveats, Alternatives, Other relevant information.
Testing Instructions
To test this PR you will need to install Taskcat From the Originating fork. Clone the Forked repo, and from the root of the repo run:
python setup.py install
Once taskcat is installed you can run it against an existing template with: