mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Push the expanduser call on the source down to slurp rather than fetch
Also moves the calculation of the destination file name until after the slurp of the file contents, since the source as returned by slurp may now be different, so we want to use that expanded path locally. Fixes #8942
This commit is contained in:
@@ -57,7 +57,7 @@ def main():
|
||||
),
|
||||
supports_check_mode=True
|
||||
)
|
||||
source = module.params['src']
|
||||
source = os.path.expanduser(module.params['src'])
|
||||
|
||||
if not os.path.exists(source):
|
||||
module.fail_json(msg="file not found: %s" % source)
|
||||
@@ -66,7 +66,7 @@ def main():
|
||||
|
||||
data = base64.b64encode(file(source).read())
|
||||
|
||||
module.exit_json(content=data, encoding='base64')
|
||||
module.exit_json(content=data, source=source, encoding='base64')
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
Reference in New Issue
Block a user