ansible-community / ansible-community/molecule-plugins

Docker driver schema rejects valid list-form command

Open Beginner friendly
#372 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
164
Forks
113
Avg merge
4d 20h
Merged PRs (30d)
1

Description

The Docker driver schema added in `molecule-plugins` PR [#340](https://github.com/ansible-community/molecule-plugins/pull/340) rejects `platforms[].command` when it is supplied as a YAML list.

This configuration previously worked (in version 26.7.8):

```yaml
driver:
name: docker

platforms:
- name: namenode
image: example/hdfs:latest
command:
- hdfs
- namenode
```

Version 26.7.15 fails during Molecule configuration validation with an error similar to:

```text
ERROR Failed to validate molecule/default/molecule.yml

is not of type 'string'"]
```
(as a sidenote - this is not a helpful error message and requires commenting out line by line to identify the issue)

However, the underlying `community.docker.docker_container` module accepts `command` in either string or list form. List form is also useful because it preserves argument boundaries and avoids shell parsing and quoting issues.

## Steps to reproduce

1. Install a current version of Molecule and `molecule-plugins` with the Docker driver.
2. Create a scenario containing:

```yaml
driver:
name: docker

platforms:
- name: test
image: example/image:latest
command:
- hdfs
- namenode
```

3. Run:

```console
molecule syntax
```

## Actual behaviour

Molecule fails before execution because the Docker driver schema requires `command` to be a string.

## Expected behaviour

The Docker driver schema should accept either:

```yaml
command: "hdfs namenode"
```

or:

```yaml
command:
- hdfs
- namenode
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with the Docker driver configuration and `molecule syntax`, then trace the Docker driver schema validation for `platforms[].command`. Done means both string and YAML list forms pass validation, while the existing string form continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.