podman-compose icon indicating copy to clipboard operation
podman-compose copied to clipboard

Unable to merge 'list' depends_on dependency with 'dict' ones

Open hedayat opened this issue 1 year ago • 3 comments

Describe the bug I've two compose files, which are designed to be used together. One of them is a 'base' compose file and another a 'test' one to be used for testing. The 'base' one uses depends_on in dict format, used with startup conditions, while the 'test' one uses a list of dependencies in depends_on for that service.

Now, podman-compose complains about this:

ValueError: can't merge value of depends_on of type <class 'dict'> and <class 'list'>

To Reproduce Steps to reproduce the behavior:

  1. Consider files with service srv1 with following depends_on sections: part of 'base' compose file:
  srv1:
    image: folan/bahman
    depends_on:
      redis:
        condition: service_started
      my-service:
        condition: service_healthy

and 'test' one:

  srv1:
    image: folan/bahman
    restart: on-failure
    depends_on:
      - redis
      - selenium
      - my-service
  1. Run podman-compose -f docker-compose.base.yml -f docker-compose.test.yml -p my_test up

Expected behavior Run successfully

Actual behavior Prints an error message and terminates

Output

podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.5.1
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 1420, in run
    self._parse_compose_file()
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1498, in _parse_compose_file
    rec_merge(compose, content)
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1277, in rec_merge
    ret = rec_merge_one(target, source)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1266, in rec_merge_one
    rec_merge_one(value, value2)
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1266, in rec_merge_one
    rec_merge_one(value, value2)
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1248, in rec_merge_one
    raise ValueError(
ValueError: can't merge value of depends_on of type <class 'dict'> and <class 'list'>

Environment:

  • OS: Fedora Linux
  • podman version: 4.5.1
  • podman compose version: 1.0.6 release

hedayat avatar Jul 07 '23 12:07 hedayat

@muayyad-alsadi

Hi, I wonder if there is anything wrong with the purposed fix?

hedayat avatar Aug 21 '23 12:08 hedayat

Has this been fixed ? Experiencing the same issue and raised a bug for it

tmaus avatar Mar 01 '24 16:03 tmaus

Has this been fixed ? Experiencing the same issue and raised a bug for it

There is a PR already, but no answer from @muayyad-alsadi

Well, actually probably we should wait for the new to-be maintainer: https://github.com/containers/podman-compose/issues/825

hedayat avatar Mar 01 '24 18:03 hedayat