mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
test-module: define ansible_version attribute
Executed command: ./hacking/test-module -m lib/ansible/modules/cloud/scaleway/scaleway_security_group.py -a ... Fix this exception found while testing scaleway_security_group module: Traceback (most recent call last): File "~/debug_dir/__main__.py", line 240, in <module> main() File "~/debug_dir/__main__.py", line 236, in main core(module) File "~/debug_dir/__main__.py", line 209, in core api = Scaleway(module=module) File "~/debug_dir/ansible/module_utils/scaleway.py", line 58, in __init__ 'User-Agent': self.get_user_agent_string(module), File "~/debug_dir/ansible/module_utils/scaleway.py", line 99, in get_user_agent_string return "ansible %s Python %s" % (module.ansible_version, sys.version.split(' ')[0]) AttributeError: 'AnsibleModule' object has no attribute 'ansible_version'
This commit is contained in:
parent
7231f7da84
commit
92103bf5d0
1 changed files with 2 additions and 0 deletions
|
@ -35,6 +35,7 @@ import sys
|
|||
import traceback
|
||||
import shutil
|
||||
|
||||
from ansible.release import __version__
|
||||
import ansible.utils.vars as utils_vars
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.parsing.utils.jsonify import jsonify
|
||||
|
@ -124,6 +125,7 @@ def boilerplate_module(modfile, args, interpreters, check, destfile):
|
|||
complex_args['_ansible_selinux_special_fs'] = C.DEFAULT_SELINUX_SPECIAL_FS
|
||||
complex_args['_ansible_tmpdir'] = C.DEFAULT_LOCAL_TMP
|
||||
complex_args['_ansible_keep_remote_files'] = C.DEFAULT_KEEP_REMOTE_FILES
|
||||
complex_args['_ansible_version'] = __version__
|
||||
|
||||
if args.startswith("@"):
|
||||
# Argument is a YAML file (JSON is a subset of YAML)
|
||||
|
|
Loading…
Reference in a new issue