mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Adding aliases for field attributes and renaming async attribute (#33141)
* Adding aliases for field attributes and renaming async attribute As of Python 3.7, the use of async raises an error, whereas before the use of the reserved word was ignored. This adds an alias field for field attrs so that both async and async_val (interally) work. This allows us to be backwards-compatible with 3rd party plugins that may still reference Task.async, but for the core engine to work on Py3.7+. * Remove files fixed for 'async' usage from the python 3.7 skip list
This commit is contained in:
committed by
Matt Clay
parent
23f8833e87
commit
d8ae4dfbf2
@@ -93,11 +93,11 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
||||
|
||||
result = {}
|
||||
|
||||
if self._task.async and not self._supports_async:
|
||||
if self._task.async_val and not self._supports_async:
|
||||
raise AnsibleActionFail('async is not supported for this task.')
|
||||
elif self._play_context.check_mode and not self._supports_check_mode:
|
||||
raise AnsibleActionSkip('check mode is not supported for this task.')
|
||||
elif self._task.async and self._play_context.check_mode:
|
||||
elif self._task.async_val and self._play_context.check_mode:
|
||||
raise AnsibleActionFail('check mode and async cannot be used on same task.')
|
||||
|
||||
return result
|
||||
@@ -159,7 +159,7 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
||||
|
||||
(module_data, module_style, module_shebang) = modify_module(module_name, module_path, module_args,
|
||||
task_vars=task_vars, module_compression=self._play_context.module_compression,
|
||||
async_timeout=self._task.async, become=self._play_context.become,
|
||||
async_timeout=self._task.async_val, become=self._play_context.become,
|
||||
become_method=self._play_context.become_method, become_user=self._play_context.become_user,
|
||||
become_password=self._play_context.become_pass,
|
||||
environment=final_environment)
|
||||
@@ -703,7 +703,7 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
||||
self._transfer_data(remote_async_module_path, async_module_data)
|
||||
remote_files.append(remote_async_module_path)
|
||||
|
||||
async_limit = self._task.async
|
||||
async_limit = self._task.async_val
|
||||
async_jid = str(random.randint(0, 999999999999))
|
||||
|
||||
# call the interpreter for async_wrapper directly
|
||||
|
||||
Reference in New Issue
Block a user