Skip to content
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

klio_core.exceptions.KlioConfigTemplatingException thrown for klio subcommands when templated values are used #178

Open
fallonchen opened this issue Mar 10, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@fallonchen
Copy link
Contributor

Environment

  • klio* version(s): latest release candidates (klio-*==21.2.0rc1) and latest from master (klio-exec==0.2.2, klio-cli==1.0.5, klio-core==0.2.2)
  • Operating System(s): OSX
  • Python version(s) (python -V): 3.6.9
  • Docker version (if relevant) (docker --version):

Description of the bug

When templated values are used in klio-job.yaml, klio subcommands also need the templated value to be passed in (e.g. you need to run klio message publish --template templated_value=MYVALUE) . Otherwise, a KlioConfigTemplatingException is thrown.

What you expected to happen

I expect the non-run subcommands to run correctly without the templated values being explicitly passed in.

How to reproduce (as minimally and precisely as possible)

Create a klio job: klio job create --use-fnapi --use-defaults --job-type streaming
Add a templated value to your klio-job.yaml:

<!--snip-->
job_config:
  api_key: ${templated_key}
<!--snip-->

Run any klio subcommand that isn't klio job run: klio message publish, klio job create, klio job verify, etc

You should then see a stacktrace like this:

(klio-current) ➜  klio-template-bug-fnapi git:(master) ✗ klio job verify --create-resources                             
Traceback (most recent call last):
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/klio_core/config/_preprocessing.py", line 159, in _apply_templates
    return template.substitute(**templates)
  File "/Users/fallon/.pyenv/versions/3.6.9/lib/python3.6/string.py", line 130, in substitute
    return self.pattern.sub(convert, self.template)
  File "/Users/fallon/.pyenv/versions/3.6.9/lib/python3.6/string.py", line 123, in convert
    return str(mapping[named])
KeyError: 'templated_value'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/fallon/.pyenv/versions/klio-current/bin/klio", line 11, in <module>
    sys.exit(main())
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/klio_core/utils.py", line 228, in wrapper
    raw_overrides=raw_overrides,
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/klio_core/config/core.py", line 101, in __init__
    raw_override_list=raw_overrides or [],
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/klio_core/config/_preprocessing.py", line 241, in process
    raw_config_data, template_dict
  File "/Users/fallon/.pyenv/versions/3.6.9/envs/klio-current/lib/python3.6/site-packages/klio_core/config/_preprocessing.py", line 161, in _apply_templates
    raise exceptions.KlioConfigTemplatingException(e)
klio_core.exceptions.KlioConfigTemplatingException: 'templated_value' missing in key template overrides.

Anthing else we need to know?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant