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
reviewable/pr18780/r1
James Cammarata 10 years ago
parent 61f6a70401
commit 1ef592ff00

@ -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…
Cancel
Save