puppetlabs / puppetlabs/puppetlabs-docker

v10 uses docker arguments and options in the wrong order.

Open
#984 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
94
Forks
337
Avg merge
11d 15h
Merged PRs (30d)
2

Description

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

  • Version 10.0.0
  • Platform Ubuntu 20.04
  • Puppet7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the argument-array construction introduced in pull request #975 and reproduce a docker_compose resource using an option such as --project-directory. Verify the generated docker compose command places options after -p and the project name, and confirm the compose check succeeds on the reported Ubuntu/Puppet environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, ruby
Domain
cli, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.