ansible-community / ansible-community/molecule-plugins

Docker plugin does not expand variable for "privileged"

Open
#104 5 comments 0 reactions 0 assignees View on GitHub
docker
Dominant language
Python
Stars
164
Forks
113
Avg merge
4d 20h
Merged PRs (30d)
1

Description

I'd like to pass a variable for the `privileged` part e.g.,

```yaml
platforms:
- name: arch-instance
image: arch-ansible
platform: ${DOCKER_DEFAULT_PLATFORM:-linux/amd64}
dockerfile: ../docker/Dockerfile
build_image: true
...
privileged: ${DOCKER_PRIVILEGED:-False}
```

During `TASK [Discover local Docker images]` the variable seems to be expanded correctly:

```
TASK [Discover local Docker images] ********************************************
ok: [localhost] => (item={'diff': [], '... 'platform': 'linux/amd64', 'privileged': False, ...
```

But then it fails later:

```
TASK [Wait for instance(s) creation to complete] *******************************
failed: ...
"msg": "argument 'privileged' is of type and we were unable to convert to bool:
The value '${DOCKER_PRIVILEGED:-False}' is not a valid boolean.
Valid booleans include: 'on', 'yes', 1, 0, '0', 'false', 'no', '1', 'f', 'off', 'y', 'true', 't', 'n'"...
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Docker plugin configuration shown in the issue and trace the handling of `privileged` between `Discover local Docker images` and `Wait for instance(s) creation to complete`. Done means `${DOCKER_PRIVILEGED:-False}` is resolved to a boolean before the latter task, while preserving the existing behavior for literal boolean values.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.