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

docker_compose: Error starting project up() got an unexpected keyword argument 'start' #180

Closed
jxs opened this issue Jul 27, 2021 · 6 comments · Fixed by #182
Closed

docker_compose: Error starting project up() got an unexpected keyword argument 'start' #180

jxs opened this issue Jul 27, 2021 · 6 comments · Fixed by #182
Labels
bug Something isn't working docker-compose-v1 Docker Compose v1

Comments

@jxs
Copy link

jxs commented Jul 27, 2021

SUMMARY

Hi, when using Ansible 4.3.0 and community.docker.docker_compose with Python 3.7.2 executing the following code:

```yaml
- name: Run `docker-compose up`
  community.docker.docker_compose:
    state: present
    project_src: "/srv/compose"

I get the following error:

TASK [docker_compose_component : Run `docker-compose up`] **********************
fatal: [dev-snap01]: FAILED! => {"changed": false, "errors": [], "module_stderr": "", "module_stdout": "", "msg": "Error starting project up() got an unexpected keyword argument 'start'"}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_compose

ANSIBLE VERSION
ansible [core 2.11.3] 
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
  jinja version = 3.0.1
  libyaml = True
COLLECTION VERSION
#  ansible-galaxy collection list community.docker
# /usr/local/lib/python3.7/dist-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 1.8.0  
OS / ENVIRONMENT

Linux 262fe73b9913 5.10.45-1-lts
minideb/minideb:latest

thanks!

@Ajpantuso
Copy link
Collaborator

What version of docker-compose is installed on the target host?
The requirements for the module say 1.7.0, but the start flag (negation of the --no-start flag from the CLI) was only added in 1.17.0.

@felixfontein
Copy link
Collaborator

I guess we could modify the project.up() call to only pass start=False if self.stopped, and not pass it otherwise. That would cause the container to start and directly be stopped again for older docker-compose versions, but that wouldn't be worse than before 859bc29.

@Ajpantuso
Copy link
Collaborator

I had thought of doing it this way and just making a note under the stopped description that docker-compose version 1.17.0 is required. But not sure if it's better to ignore or fail when using stopped with a version that doesn't support it.

                        up_kwargs = {
                            'service_names': service_names,
                            'start_deps': start_deps,
                            'strategy': converge,
                            'do_build': do_build,
                            'detached': detached,
                            'remove_orphans': self.remove_orphans,
                            'timeout': self.timeout,
                        }

                        if LooseVersion(compose_version) >= LooseVersion('1.17.0'):
                            up_kwargs['start'] = not self.stopped

                        self.project.up(**up_kwargs)

@felixfontein
Copy link
Collaborator

I think this behavior is ok, though I would emit a warning in that case (or at least if self.stopped).

@felixfontein
Copy link
Collaborator

resolved_in_pr #182

@felixfontein felixfontein added bug Something isn't working docker-compose-v1 Docker Compose v1 labels Jul 28, 2021
@jxs
Copy link
Author

jxs commented Jul 31, 2021

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker-compose-v1 Docker Compose v1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants