puppetlabs / puppetlabs-docker

The Puppet Docker repository
Apache License 2.0
91 stars 311 forks source link

v10 uses docker arguments and options in the wrong order. #984

Open augustocarvalho opened 4 months ago

augustocarvalho commented 4 months ago

Describe the Bug

v10 breaks puppet during the docker compose check if exists. The argument array is adding the docker options between the -p and project_name.

Commit that added the issue: https://github.com/puppetlabs/puppetlabs-docker/pull/975/files#diff-0b884d248175f3ad6cf5342c74d8d766c5b6ab28ffdb31f369c614b67b5f36dd

The array has now 5 elements and it inserts in a wrong position (3): args = ['compose', compose_files, '-p', name, 'config'].insert(3, resource[:options]).compact

Puppet debug:

Info: Checking for compose project portainer Debug: Executing: '/usr/bin/docker compose -f /var/docker/portainer/docker-compose.yml -p --project-directory=/var/docker/portainer portainer config' Error: /Stage[main]/Profiles::System::Docker_server/Apps::Docker::Portainer[portainer]/Apps::Docker::Webapp[portainer]/Apps::Docker::App[portainer]/Docker_compose[portainer]: Could not evaluate: (): could not find expected ':' while scanning a simple key at line 4 column 1 Wrapped exception: (): could not find expected ':' while scanning a simple key at line 4 column 1

Expected Behavior

Arguments array should insert the docker options after the -p . (Array position is now 4.) args = ['compose', compose_files, '-p', name, 'config'].insert(4, resource[:options]).compact

Puppet debug:

Info: Checking for compose project portainer Debug: Executing: '/usr/bin/docker compose -f /var/docker/portainer/docker-compose.yml -p portainer --project-directory=/var/docker/portainer config'

Steps to Reproduce

Declare a docker_compose resource with options (for example --project-directory)

Environment