mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-05 12:52:48 +00:00
fix missing attribs with dirct module execution (#53875)
* fix missing attribs with dirct module execution * also make remote tmp handling smarter update tests * set default if attrib does not exist * add simple test
This commit is contained in:
1
test/integration/targets/run_modules/aliases
Normal file
1
test/integration/targets/run_modules/aliases
Normal file
@@ -0,0 +1 @@
|
||||
shippable/posix/group3
|
||||
1
test/integration/targets/run_modules/args.json
Normal file
1
test/integration/targets/run_modules/args.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "ANSIBLE_MODULE_ARGS": {} }
|
||||
7
test/integration/targets/run_modules/library/test.py
Normal file
7
test/integration/targets/run_modules/library/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
module = AnsibleModule(argument_spec=dict())
|
||||
|
||||
module.exit_json(**{'tempdir': module._remote_tmp})
|
||||
6
test/integration/targets/run_modules/runme.sh
Executable file
6
test/integration/targets/run_modules/runme.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
# test running module directly
|
||||
python.py library/test.py args.json
|
||||
@@ -20,7 +20,7 @@ def patch_ansible_module(request, mocker):
|
||||
if '_ansible_remote_tmp' not in request.param['ANSIBLE_MODULE_ARGS']:
|
||||
request.param['ANSIBLE_MODULE_ARGS']['_ansible_remote_tmp'] = '/tmp'
|
||||
if '_ansible_keep_remote_files' not in request.param['ANSIBLE_MODULE_ARGS']:
|
||||
request.param['ANSIBLE_MODULE_ARGS']['_ansible_keep_remote_files'] = '/tmp'
|
||||
request.param['ANSIBLE_MODULE_ARGS']['_ansible_keep_remote_files'] = False
|
||||
args = json.dumps(request.param)
|
||||
else:
|
||||
raise Exception('Malformed data to the patch_ansible_module pytest fixture')
|
||||
|
||||
Reference in New Issue
Block a user