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

validate_args_spec, use combine vars and in precedence #75471

Merged
merged 8 commits into from
Aug 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/ansible/plugins/action/validate_argument_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils.common.arg_spec import ArgumentSpecValidator
from ansible.module_utils.errors import AnsibleValidationErrorMultiple

from ansible.utils.vars import combine_vars

class ActionModule(ActionBase):
''' Validate an arg spec'''
Expand Down Expand Up @@ -77,10 +77,8 @@ def run(self, tmp=None, task_vars=None):
raise AnsibleError('Incorrect type for provided_arguments, expected dict and got %s' % type(provided_arguments))

args_from_vars = self.get_args_from_task_vars(argument_spec_data, task_vars)
provided_arguments.update(args_from_vars)

validator = ArgumentSpecValidator(argument_spec_data)
validation_result = validator.validate(provided_arguments)
validation_result = validator.validate(combine_vars(args_from_vars, provided_arguments))

if validation_result.error_messages:
result['failed'] = True
Expand Down