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
Role arg spec validation implementation #73152
Conversation
The test
The test
The test
The test
|
The test
|
040b677
to
3d30166
Compare
@@ -255,6 +255,9 @@ def _load_role_data(self, role_include, parent_role=None): | |||
self.collections.append(default_append_collection) | |||
|
|||
task_data = self._load_role_yaml('tasks', main=self._from_files.get('tasks')) | |||
|
|||
self._prepend_validation_task(task_data) |
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.
Should there be a way for a user to opt out of this? They may be using a 3rd party role that has an argspec, and if they don't want this to run they'd need to create their own version of the role. I also noticed that the yaml
callback blows up on the msg
field for failed validation.
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.
Hrm, yes, I think there should be. Would we want to disable globally for all roles, or per role?
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.
Very good point. Probably should be per role.
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.
meta/ parameter + include/import_role option. Allows both for role author to handle manually as for role consumers to 'know better' and override default behaviour.
options: | ||
argument_spec: | ||
description: | ||
- A dictionary like AnsibleModule argument_spec |
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.
this should really go into detail using suboptions to describe the spec
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.
The spec is described in good detail in the .rst file in this change. I think we should have 1 source describing the spec, otherwise they will go out of sync for certain.
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.
why i would keep in in the module (closer to the actual code) as any updates will come here naturally but not to the docs page (which can just point at module). Also would help with arg_spec/docs validation.
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.
but not a blocker for this PR, can be addressed afterwards
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.
👍
Co-authored-by: Sam Doran <sdoran@redhat.com>
Co-authored-by: Sam Doran <sdoran@redhat.com>
SUMMARY
This is a modified version of the solution provided by @alikins in PR #44983, but updated for the latest engineering spec and core code changes.
Still needed:
module_utils
.ISSUE TYPE
COMPONENT NAME
core
roles
ADDITIONAL INFORMATION