podman-compose
podman-compose copied to clipboard
AttributeError: 'Namespace' object has no attribute 'remove_orphans'
Describe the bug
It looks like compose_down
refers to args.remove_orphans
which is not defined if compose_run
is called. I'm using the latest podman-compose on Fedora.
To Reproduce Steps to reproduce the behavior:
- A simple compose file:
services:
dep:
image: alpine
command: false
abc:
image: alpine
command: echo hi
depends_on: ['dep']
-
podman-compose run abc
Expected behavior Not to crash.
Actual behavior
When I use podman-compose run
I get a stack trace.
Output
Traceback (most recent call last):
File "/usr/bin/podman-compose", line 33, in <module>
sys.exit(load_entry_point('podman-compose==1.0.6', 'console_scripts', 'podman-compose')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2940, in main
podman_compose.run()
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1422, in run
cmd(self, args)
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1753, in wrapped
return func(*args, **kw)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2254, in compose_run
compose.commands["up"](compose, up_args)
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1753, in wrapped
return func(*args, **kw)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2055, in compose_up
compose.commands["down"](compose, down_args)
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1753, in wrapped
return func(*args, **kw)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2168, in compose_down
if args.remove_orphans:
^^^^^^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'remove_orphans'
Environment:
- OS: Fedora 38
- podman version: 4.5.1
- podman compose version: 1.0.6
I ran into this today, but rebuilding my images seems to have gotten around it (the last time they were built was several months ago).
Hello
For information, i got the same error even after rebuilding.
Regards
A quick workaround is to replace the 2356th line in /usr/lib/python3.11/site-packages/podman_compose.py
if args.remove_orphans:
with
if hasattr(args, 'remove_orphans') and args.remove_orphans:
For now it worked, but will have to see how this workaround behaves in a longer period.
Bumping this, ran into it today.
Same here.
podman-compose run --rm common-listmonk-app ./listmonk --install
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.6.2
** excluding: {'common-listmonk-app'}
['podman', 'ps', '--filter', 'label=io.podman.compose.project=listmonk-demo', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
recreating: ...
** excluding: {'common-listmonk-app'}
podman stop -t 10 common-listmonk-db
Error: no container with name or ID "common-listmonk-db" found: no such container
exit code: 125
podman rm common-listmonk-db
Error: no container with ID or name "common-listmonk-db" found: no such container
exit code: 1
Traceback (most recent call last):
File "/usr/local/bin/podman-compose", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 2941, in main
podman_compose.run()
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 1423, in run
cmd(self, args)
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 1754, in wrapped
return func(*args, **kw)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 2255, in compose_run
compose.commands["up"](compose, up_args)
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 1754, in wrapped
return func(*args, **kw)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 2056, in compose_up
compose.commands["down"](compose, down_args)
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 1754, in wrapped
return func(*args, **kw)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/podman_compose.py", line 2169, in compose_down
if args.remove_orphans:
^^^^^^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'remove_orphans'