-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Validate plugin option type 'dict' / 'dictionary' #71928
Conversation
…s of dicts and dicts.
/rebuild_failed |
@@ -56,7 +56,7 @@ class ModuleDocFragment(object): | |||
vars: | |||
- name: ansible_async_dir | |||
environment: | |||
type: dict | |||
type: dict or list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are for modules, handled by argspec, this change should not be part of this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are (also) used by the shell plugins (https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/shell/sh.py#L15, https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/shell/powershell.py#L16, https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/shell/cmd.py#L14), and these will stop working without this change. Without this change (and the one in shell_windows.py
) CI looks like this: https://app.shippable.com/github/ansible/ansible/runs/174226/summary/console
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Also I'm not aware of any module using these docs fragments.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: dict or list
skips validation because that isn't a known type. The convention we've used for that in the past is type: raw
. But environment should just be a list, since it's coming from the field attribute anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to type: list
as discussed in the meeting.
* Validate option type 'dict' / 'dictionary'. * Add changelog fragment. * Change type of 'environment' to list.
SUMMARY
Until now, the type
dict
/dictionary
was not validated inensure_type()
in lib/ansible/config/manager.py, even though that type is used also in plugins included with ansible/ansible (see for example https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/url.py#L39).ISSUE TYPE
COMPONENT NAME
lib/ansible/config/manager.py