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:
parent
61f6a70401
commit
1ef592ff00
1 changed files with 2 additions and 2 deletions
|
@ -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 *
|
||||
|
|
Loading…
Reference in a new issue