opsview/opsview-ansible-modules

Support Python 3.7

Opened this issue · 1 comments

jpgxs commented

From Python 3.7 async is a reserved keyword.

This causes an exception in the opsview_reload module:

Traceback (most recent call last):
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 140, in run
res = self._execute()
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 612, in _execute
result = self._handler.run(task_vars=variables)
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/plugins/action/normal.py", line 46, in run
result = merge_hash(result, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/plugins/action/init.py", line 742, in _execute_module
(module_style, shebang, module_data, module_path) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/plugins/action/init.py", line 178, in _configure_module
environment=final_environment)
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/executor/module_common.py", line 973, in modify_module
environment=environment)
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/executor/module_common.py", line 791, in _find_module_utils
recursive_finder(module_name, b_module_data, py_module_names, py_module_cache, zf)
File "/usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible/executor/module_common.py", line 538, in recursive_finder
tree = ast.parse(data)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "", line 165
opsview_client.reload(async=True)
^
SyntaxError: invalid syntax

Has anyone looked at this or is there any plans to fix this for newer verions of python?

Best i can tell i just changed the following in opwview_reload so that it uses the full word asynchronous and it works now.

# requires a reload
opsview_client.reload(asynchronous=True)