You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all! I have an idea for a new feature. I would like to know whether it would fit in the current idea of ansible-lint.
I am writing roles with an argument spec defined in meta/main.yaml (I think it can also be defined in meta/argument_spec.yaml for backwards compatibility), and when I run the role the argument spec gets validated, which is normal Ansible behaviour.
There are cases where I have written an argument spec including default values, but there is currently no way to ensure they match with the values which are actually defined in defaults/main.yaml, which is also pointed out in documentation. I am not sure whether Ansible intends to develop other features for this, but I think this could be a useful feature for ansible-lint.
I would envision something like the following:
argument_spec:
...
argument_specs:
main:
short_description: ....
description: |
...
options:
foo:
type: str
default: "i have a sane default"
description: some value which is passed to a role
defaults/main.yaml:
foo: "this is something else"
In this case the default from the argument spec, and the default values do not match. ansible-lint could parse the argument spec and check whether the default values are correctly defined in defaults/main.yaml.
Ansible lint would then tell something like: warning the default value in defaults/main.yaml does not match the value in argument_spec
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all! I have an idea for a new feature. I would like to know whether it would fit in the current idea of
ansible-lint
.I am writing roles with an argument spec defined in
meta/main.yaml
(I think it can also be defined inmeta/argument_spec.yaml
for backwards compatibility), and when I run the role the argument spec gets validated, which is normal Ansible behaviour.There are cases where I have written an argument spec including default values, but there is currently no way to ensure they match with the values which are actually defined in
defaults/main.yaml
, which is also pointed out in documentation. I am not sure whether Ansible intends to develop other features for this, but I think this could be a useful feature foransible-lint
.I would envision something like the following:
argument_spec:
defaults/main.yaml
:In this case the default from the argument spec, and the default values do not match.
ansible-lint
could parse the argument spec and check whether the default values are correctly defined indefaults/main.yaml
.Ansible lint would then tell something like:
warning the default value in defaults/main.yaml does not match the value in argument_spec
Would this be an addition to
ansible-lint
?Beta Was this translation helpful? Give feedback.
All reactions