stacklio / stackl

An open source, end-to-end application orchestration platform.
https://stackl.io
GNU General Public License v3.0
5 stars 4 forks source link

Allow for no "params" field in stack instance config document #193

Open stgrace opened 3 years ago

stgrace commented 3 years ago

Expected Result

When the params field is not specified, the stackl-cli should not try to merge the params from the command line with the params from the document.

Actual Result

Traceback (most recent call last):
  File "/opt/venv/bin/stackl", line 11, in <module>
    load_entry_point('stackl-cli==0.2.2', 'console_scripts', 'stackl')()
  File "/opt/venv/lib64/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/venv/lib64/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/venv/lib64/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/venv/lib64/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/venv/lib64/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/venv/lib64/python3.8/site-packages/commands/apply.py", line 26, in apply
    apply_stack_instance(config_file, params, tags, secrets,
  File "/opt/venv/lib64/python3.8/site-packages/commands/apply.py", line 37, in apply_stack_instance
    final_params = {**config_doc['params'], **final_params}
KeyError: 'params'

Steps To Reproduce

stackl apply -c config.yml instance-name

---
stack_infrastructure_template: sit-template
stack_application_template: sat-template

Potential Causes, Fixes or Additional Information

A check should be added to ensure that params is filled in in the document before trying to merge