podman-compose
podman-compose copied to clipboard
compose.yml parser issue
Describe the bug
Script breaks on some typo in compose.yml
To Reproduce
use this wrong compose file:
services:
web:
build: .
ports:
- "8000:80"
volumes:
- .:/var/www/html
depends_on:exit
- db
db:
image: postgres:12.14-alpine
environment:
POSTGRES_DB: postgres
POSTGRES_USER: simu
POSTGRES_PASSWORD: test
volumes:
- pgdata:/var/lib/postgresql/data
node:
image: node:16
working_dir: /var/www/html
volumes:
- .:/var/www/html
command: sleep infinity
volumes:
pgdata:
Expected behavior
Do not print trackeback, just the incorrect line in the file.
Actual behavior
podman-compose -f compose.yml --build
usage: podman-compose [-h] [-v] [--in-pod in_pod] [--pod-args pod_args] [--env-file env_file] [-f file] [--profile profile] [-p PROJECT_NAME] [--podman-path PODMAN_PATH] [--podman-args args]
[--podman-pull-args args] [--podman-push-args args] [--podman-build-args args] [--podman-inspect-args args] [--podman-run-args args] [--podman-start-args args]
[--podman-stop-args args] [--podman-rm-args args] [--podman-volume-args args] [--no-ansi] [--no-cleanup] [--dry-run] [--parallel PARALLEL] [--verbose]
{help,version,wait,systemd,pull,push,build,up,down,ps,run,exec,start,stop,restart,logs,config,port,pause,unpause,kill,stats,images} ...
podman-compose: error: unrecognized arguments: --build
landsman@m2 simuportfolio % podman-compose -f compose.yml up --build
Traceback (most recent call last):
File "/opt/homebrew/bin/podman-compose", line 8, in <module>
sys.exit(main())
~~~~^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 3711, in main
asyncio.run(async_main())
~~~~~~~~~~~^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 194, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 720, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 3707, in async_main
await podman_compose.run()
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 1859, in run
self._parse_compose_file()
~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 1955, in _parse_compose_file
content = yaml.safe_load(f)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/__init__.py", line 125, in safe_load
return load(stream, SafeLoader)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/__init__.py", line 81, in load
return loader.get_single_data()
~~~~~~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 133, in compose_mapping_node
item_value = self.compose_node(node, item_key)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 133, in compose_mapping_node
item_value = self.compose_node(node, item_key)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 133, in compose_mapping_node
item_value = self.compose_node(node, item_key)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 82, in compose_node
node = self.compose_sequence_node(anchor)
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/composer.py", line 110, in compose_sequence_node
while not self.check_event(SequenceEndEvent):
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
~~~~~~~~~~^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/parser.py", line 382, in parse_block_sequence_entry
if self.check_token(BlockEntryToken):
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/scanner.py", line 115, in check_token
while self.need_more_tokens():
~~~~~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/scanner.py", line 152, in need_more_tokens
self.stale_possible_simple_keys()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/podman-compose/1.3.0/libexec/lib/python3.13/site-packages/yaml/scanner.py", line 291, in stale_possible_simple_keys
raise ScannerError("while scanning a simple key", key.mark,
"could not find expected ':'", self.get_mark())
yaml.scanner.ScannerError: while scanning a simple key
in "compose.yml", line 8, column 5
could not find expected ':'
in "compose.yml", line 10, column 3
Environment:
- OS: Mac
- podman version:
5.3.2 - podman compose version:
1.3.0