Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve module argument handling #1880

Closed
decentral1se opened this issue Mar 26, 2019 · 3 comments
Closed

Improve module argument handling #1880

decentral1se opened this issue Mar 26, 2019 · 3 comments

Comments

@decentral1se
Copy link
Contributor

decentral1se commented Mar 26, 2019

The current situation is that we are increasingly getting requests to add keys from our schema definition in the molecule.yml that correspond to the default Docker driver create.yml. See #1879 and #1878 for more recent examples. This stands for all the driver plays that we maintain.

The problem here is that we are duplicating the effort of what Ansible is doing. We are defining a schema using http://docs.python-cerberus.org/en/stable/ and validating what we get as input. Ansible already does this with the argspec validation. Our schema's can always be be behind in terms of what key/vals they offer ...

Following the idea from ansible/proposals#39 (comment), I would propose the idea for discussion: we somehow move to replace the Cerberus schema definitions with Ansible argspec validation (yet to be finished for external use, but fine to discuss for now).

This would allow us to:

  • Not maintain schemas for Ansible module key/vals
  • Not maintain validation for these schemas
  • Rely on Ansible module argument validation all the way down ...

Questions:

  • Is it feasible to use this argspec validation API here in Molecule?
  • How to manage importing and multiple Ansible versions!?

I'm writing this a bit fast and off the cuff but hopefully it's clear ...

@decentral1se
Copy link
Contributor Author

decentral1se commented Mar 26, 2019

Example of our Molecule schema: https://github.com/ansible/molecule/blob/master/molecule/model/schema_v2.py#L601. Example of what Ansible is doing: https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/docker/docker_container.py#L2859. It will be a never ending task trying to duplicate our schema validation here, looks like!

@rockandska
Copy link

Not really related as discuss on IRC but think it is complementary, please find an example here of how i see a docker molecule.yml who is:

Hope you will find some interesting ideas here.

@decentral1se decentral1se changed the title Replace cerberus with Ansible argspec validation Improve the way molecule handles Ansible module arguments Mar 28, 2019
@decentral1se decentral1se changed the title Improve the way molecule handles Ansible module arguments Improve module argument handling Mar 28, 2019
@decentral1se
Copy link
Contributor Author

Won't have time to chase this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants