mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Move where the expanduser call is made, to avoid issues with None
This commit is contained in:
parent
e659d55d62
commit
96f1c3ce2e
1 changed files with 8 additions and 3 deletions
|
@ -48,9 +48,9 @@ class ActionModule(object):
|
||||||
if complex_args:
|
if complex_args:
|
||||||
options.update(complex_args)
|
options.update(complex_args)
|
||||||
options.update(utils.parse_kv(module_args))
|
options.update(utils.parse_kv(module_args))
|
||||||
source = os.path.expanduser(options.get('src', None))
|
source = options.get('src', None)
|
||||||
content = options.get('content', None)
|
content = options.get('content', None)
|
||||||
dest = os.path.expanduser(options.get('dest', None))
|
dest = options.get('dest', None)
|
||||||
raw = utils.boolean(options.get('raw', 'no'))
|
raw = utils.boolean(options.get('raw', 'no'))
|
||||||
force = utils.boolean(options.get('force', 'yes'))
|
force = utils.boolean(options.get('force', 'yes'))
|
||||||
|
|
||||||
|
@ -61,10 +61,15 @@ class ActionModule(object):
|
||||||
result=dict(failed=True, msg="src and content are mutually exclusive")
|
result=dict(failed=True, msg="src and content are mutually exclusive")
|
||||||
return ReturnData(conn=conn, result=result)
|
return ReturnData(conn=conn, result=result)
|
||||||
|
|
||||||
# Check if the source ends with a "/"
|
# Check if the source ends with a "/" and
|
||||||
|
# expand any tildes that may be in the path
|
||||||
source_trailing_slash = False
|
source_trailing_slash = False
|
||||||
if source:
|
if source:
|
||||||
source_trailing_slash = source.endswith("/")
|
source_trailing_slash = source.endswith("/")
|
||||||
|
source = os.path.expanduser(source)
|
||||||
|
# And expand the path for the destination
|
||||||
|
if dest:
|
||||||
|
dest = os.path.expanduser(dest)
|
||||||
|
|
||||||
# Define content_tempfile in case we set it after finding content populated.
|
# Define content_tempfile in case we set it after finding content populated.
|
||||||
content_tempfile = None
|
content_tempfile = None
|
||||||
|
|
Loading…
Reference in a new issue