mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07:00
now get_url defaults to module temp dir (#36218)
* now get_url and other modules default to module temp dir also fixed 'bare' exception * allow modules to work with older versions * updated docs per feedback
This commit is contained in:
parent
0bbea9a579
commit
c119d54e4a
7 changed files with 15 additions and 14 deletions
|
@ -107,9 +107,9 @@ from ansible.module_utils.six import b
|
|||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None, ignore_hidden=False):
|
||||
def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None, ignore_hidden=False, tmpdir=None):
|
||||
''' assemble a file from a directory of fragments '''
|
||||
tmpfd, temp_path = tempfile.mkstemp()
|
||||
tmpfd, temp_path = tempfile.mkstemp(dir=tmpdir)
|
||||
tmp = os.fdopen(tmpfd, 'wb')
|
||||
delimit_me = False
|
||||
add_newline = False
|
||||
|
@ -204,7 +204,7 @@ def main():
|
|||
if validate and "%s" not in validate:
|
||||
module.fail_json(msg="validate must contain %%s: %s" % validate)
|
||||
|
||||
path = assemble_from_fragments(src, delimiter, compiled_regexp, ignore_hidden)
|
||||
path = assemble_from_fragments(src, delimiter, compiled_regexp, ignore_hidden, getattr(module, 'tmpdir', None))
|
||||
path_hash = module.sha1(path)
|
||||
result['checksum'] = path_hash
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue