You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The variable interpolation does not work properly and sends a stack trace when parsing a template that has a variable using the construction: ${VARIABLE:?err}
The variable interpolation as described in and also here confirms this should be a valid construction, and this does in fact work in the latest version of docker-compose but it sends a stack trace when tested on podman-compose
please try to reproduce the bug in latest devel branch: This has been tested in both the latest stable release and in the current devel version (at the time, devel version is podman-compose version 1.0.7)
To Reproduce
Steps to reproduce the behavior:
have a compose template that uses interpolation with missing values. I used:
#compose.yml
services:
foo:
image: ${FOO:?}
run a command that needs to interact with the template like: podman-compose -f compose.yml ps or simply podman-compose ps if your template is named "compose.yml"
Expected behavior
docker-compose handles the error and displays a message appropriately, podman-compose should behave similarly:
$ docker-compose ps
ERROR: Missing mandatory value for "image" option interpolating ${FOO:?} in service "foo": FOO
$ echo $?
1
Actual behavior
podman-compose yields an exception and a stack trace
Output
$ podman-compose version
podman-compose version 1.0.7
podman version 4.9.3
$ podman-compose -f compose.yml ps
Traceback (most recent call last):
File "/tmp/foo/.venv/bin/podman-compose", line 8, in <module>
sys.exit(main())
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 3224, in main
asyncio.run(async_main())
File "/usr/lib64/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 3220, in async_main
await podman_compose.run()
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 1548, in run
self._parse_compose_file()
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 1634, in _parse_compose_file
content = rec_subs(content, self.environ)
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 266, in rec_subs
value = {k: rec_subs(v, subs_dict) for k, v in value.items()}
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 266, in <dictcomp>
value = {k: rec_subs(v, subs_dict) for k, v in value.items()}
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 266, in rec_subs
value = {k: rec_subs(v, subs_dict) for k, v in value.items()}
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 266, in <dictcomp>
value = {k: rec_subs(v, subs_dict) for k, v in value.items()}
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 266, in rec_subs
value = {k: rec_subs(v, subs_dict) for k, v in value.items()}
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 266, in <dictcomp>
value = {k: rec_subs(v, subs_dict) for k, v in value.items()}
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 282, in rec_subs
value = var_re.sub(convert, value)
File "/tmp/foo/.venv/lib64/python3.9/site-packages/podman_compose.py", line 279, in convert
raise RuntimeError(m.group("err"))
RuntimeError
Describe the bug
The variable interpolation does not work properly and sends a stack trace when parsing a template that has a variable using the construction:
${VARIABLE:?err}
The variable interpolation as described in and also here confirms this should be a valid construction, and this does in fact work in the latest version of
docker-compose
but it sends a stack trace when tested onpodman-compose
please try to reproduce the bug in latest devel branch: This has been tested in both the latest stable release and in the current devel version (at the time, devel version is
podman-compose version 1.0.7
)To Reproduce
Steps to reproduce the behavior:
podman-compose -f compose.yml ps
or simplypodman-compose ps
if your template is named "compose.yml"please use minimal reproducible example for example give me a small busybox-based compose yaml
Expected behavior
docker-compose handles the error and displays a message appropriately, podman-compose should behave similarly:
Actual behavior
podman-compose yields an exception and a stack trace
Output
Environment:
Additional context
N/A
The text was updated successfully, but these errors were encountered: