mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Fixing filter plugins directory from switch
This commit is contained in:
parent
249fd2a7e1
commit
803fb397f3
14 changed files with 1166 additions and 33 deletions
|
@ -180,7 +180,8 @@ class TaskExecutor:
|
|||
final_items = []
|
||||
for item in items:
|
||||
variables['item'] = item
|
||||
if self._task.evaluate_conditional(variables):
|
||||
templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=variables)
|
||||
if self._task.evaluate_conditional(templar, variables):
|
||||
final_items.append(item)
|
||||
return [",".join(final_items)]
|
||||
else:
|
||||
|
@ -208,13 +209,13 @@ class TaskExecutor:
|
|||
|
||||
# get the connection and the handler for this execution
|
||||
self._connection = self._get_connection(variables)
|
||||
self._handler = self._get_action_handler(connection=self._connection)
|
||||
self._handler = self._get_action_handler(connection=self._connection, templar=templar)
|
||||
|
||||
# Evaluate the conditional (if any) for this task, which we do before running
|
||||
# the final task post-validation. We do this before the post validation due to
|
||||
# the fact that the conditional may specify that the task be skipped due to a
|
||||
# variable not being present which would otherwise cause validation to fail
|
||||
if not self._task.evaluate_conditional(variables):
|
||||
if not self._task.evaluate_conditional(templar, variables):
|
||||
debug("when evaulation failed, skipping this task")
|
||||
return dict(changed=False, skipped=True, skip_reason='Conditional check failed')
|
||||
|
||||
|
@ -268,7 +269,7 @@ class TaskExecutor:
|
|||
return dict(failed=True, msg="The async task did not return valid JSON: %s" % str(e))
|
||||
|
||||
if self._task.poll > 0:
|
||||
result = self._poll_async_result(result=result)
|
||||
result = self._poll_async_result(result=result, templar=templar)
|
||||
|
||||
# update the local copy of vars with the registered value, if specified,
|
||||
# or any facts which may have been generated by the module execution
|
||||
|
@ -284,15 +285,15 @@ class TaskExecutor:
|
|||
# FIXME: make sure until is mutually exclusive with changed_when/failed_when
|
||||
if self._task.until:
|
||||
cond.when = self._task.until
|
||||
if cond.evaluate_conditional(vars_copy):
|
||||
if cond.evaluate_conditional(templar, vars_copy):
|
||||
break
|
||||
elif (self._task.changed_when or self._task.failed_when) and 'skipped' not in result:
|
||||
if self._task.changed_when:
|
||||
cond.when = [ self._task.changed_when ]
|
||||
result['changed'] = cond.evaluate_conditional(vars_copy)
|
||||
result['changed'] = cond.evaluate_conditional(templar, vars_copy)
|
||||
if self._task.failed_when:
|
||||
cond.when = [ self._task.failed_when ]
|
||||
failed_when_result = cond.evaluate_conditional(vars_copy)
|
||||
failed_when_result = cond.evaluate_conditional(templar, vars_copy)
|
||||
result['failed_when_result'] = result['failed'] = failed_when_result
|
||||
if failed_when_result:
|
||||
break
|
||||
|
@ -315,7 +316,7 @@ class TaskExecutor:
|
|||
debug("attempt loop complete, returning result")
|
||||
return result
|
||||
|
||||
def _poll_async_result(self, result):
|
||||
def _poll_async_result(self, result, templar):
|
||||
'''
|
||||
Polls for the specified JID to be complete
|
||||
'''
|
||||
|
@ -339,6 +340,7 @@ class TaskExecutor:
|
|||
connection=self._connection,
|
||||
connection_info=self._connection_info,
|
||||
loader=self._loader,
|
||||
templar=templar,
|
||||
shared_loader_obj=self._shared_loader_obj,
|
||||
)
|
||||
|
||||
|
@ -391,7 +393,7 @@ class TaskExecutor:
|
|||
|
||||
return connection
|
||||
|
||||
def _get_action_handler(self, connection):
|
||||
def _get_action_handler(self, connection, templar):
|
||||
'''
|
||||
Returns the correct action plugin to handle the requestion task action
|
||||
'''
|
||||
|
@ -411,6 +413,7 @@ class TaskExecutor:
|
|||
connection=connection,
|
||||
connection_info=self._connection_info,
|
||||
loader=self._loader,
|
||||
templar=templar,
|
||||
shared_loader_obj=self._shared_loader_obj,
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue