molecule-plugins icon indicating copy to clipboard operation
molecule-plugins copied to clipboard

EC2 driver volumes parameter does not validate against Molecule schema.

Open isuftin opened this issue 2 years ago • 2 comments

In the platform definition of the EC2 driver, the expected type for the volumes parameter is a list of dict - https://github.com/ansible/ansible-lint/blob/main/src/ansiblelint/schemas/molecule.json

The Molecule schema definition for volumes expects a list of string - https://github.com/ansible-community/molecule/blob/main/src/molecule/data/molecule.json#L263-L268

As such, molecule errors out when attempting to create instances when volumes is defined in the platform param

An example of what a config for this might look like:

volumes:
      - device_name: /dev/sda1
        ebs:
          volume_size: 16
          delete_on_termination: true

isuftin avatar Apr 26 '23 22:04 isuftin

Ref - https://github.com/ansible-community/molecule-plugins/issues/167

isuftin avatar Apr 26 '23 22:04 isuftin

With recent PR merged in molecule (https://github.com/ansible-community/molecule/pull/3765 and https://github.com/ansible-community/molecule/pull/3898), now we can provide a schema for docker, podman, ec2 and I hope this will solve the issue (there may still be bugs or missing support).

For the record:

  • docker, podman plugins are expecting volumes to be a list of string
  • ec2 plugin is expecting volumes to be a list of dict.

That's why having a common schema is problematic.

Adding a schema is a matter of:

  • writing something like https://github.com/apatard/molecule-plugins/commit/b4b86b70799c7bd6431c44858255c50e5a6d39b3
  • having time to do it.

(... and I won't have time to do it next week.)

apatard avatar Apr 28 '23 16:04 apatard