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

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

Closed
hedayat opened this issue Jul 7, 2023 · 3 comments · Fixed by #724
Closed

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

hedayat opened this issue Jul 7, 2023 · 3 comments · Fixed by #724
Labels
bug Something isn't working

Comments

@hedayat
Copy link
Contributor

hedayat commented Jul 7, 2023

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 hedayat added the bug Something isn't working label Jul 7, 2023
hedayat added a commit to hedayat/podman-compose that referenced this issue Jul 8, 2023
hedayat added a commit to hedayat/podman-compose that referenced this issue Jul 20, 2023
maurerle pushed a commit to maurerle/podman-compose that referenced this issue Aug 7, 2023
@hedayat
Copy link
Contributor Author

hedayat commented Aug 21, 2023

@muayyad-alsadi

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

maurerle pushed a commit to maurerle/podman-compose that referenced this issue Jan 24, 2024
@tmaus
Copy link

tmaus commented Mar 1, 2024

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

@hedayat
Copy link
Contributor Author

hedayat commented Mar 1, 2024

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: #825

hedayat added a commit to hedayat/podman-compose that referenced this issue May 7, 2024
muayyad-alsadi added a commit that referenced this issue May 8, 2024
Fixes #723: merge short & long syntax of depends_on dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants