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

Environment variables not expanded in bundles #362

Open
stub42 opened this issue Jun 1, 2020 · 3 comments
Open

Environment variables not expanded in bundles #362

stub42 opened this issue Jun 1, 2020 · 3 comments

Comments

@stub42
Copy link

stub42 commented Jun 1, 2020

Documentation claims environment variables are expanded in the jinja2 bundle overlays. However, zaza.charm_lifecycle.deploy never accesses os.environ nor passes it through to jinja2 as context.

2020-06-01 19:23:18 [ERROR] Template error. You may be missing a mandatory environment variable : 'HOME' is undefined
@gnuoy
Copy link
Contributor

gnuoy commented Jun 1, 2020

Hi @stub42,
zaza.charm_lifecycle.deploy accesses the environment variables via get_deployment_context() *1 The documentation fails to mention that not all environment variables are added to the jinja2 context, they are first filtered by prefix *2

*1 https://github.com/openstack-charmers/zaza/blob/master/zaza/charm_lifecycle/deploy.py#L71
*2 https://github.com/openstack-charmers/zaza/blob/master/zaza/utilities/deployment_env.py#L35

@gnuoy
Copy link
Contributor

gnuoy commented Jun 1, 2020

...and get_template_overlay_context is badly named too given it is used for the bundle and overlay contexts.

@stub42
Copy link
Author

stub42 commented Jun 1, 2020

Discovered the prefix whitelist in deployment_env.py. Given it is recommended to run via tox, which requires you to whitelist environment variables explicitly, the extra whitelist in deployment_env.py could be dropped.

coreycb pushed a commit to coreycb/zaza that referenced this issue Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants