mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
parent
ee18c557ec
commit
600a4657b4
1 changed files with 5 additions and 2 deletions
|
@ -1132,8 +1132,11 @@ class AnsibleModule(object):
|
||||||
|
|
||||||
dest_dir = os.path.dirname(dest)
|
dest_dir = os.path.dirname(dest)
|
||||||
dest_file = os.path.basename(dest)
|
dest_file = os.path.basename(dest)
|
||||||
|
try:
|
||||||
tmp_dest = tempfile.NamedTemporaryFile(
|
tmp_dest = tempfile.NamedTemporaryFile(
|
||||||
prefix=".ansible_tmp", dir=dest_dir, suffix=dest_file)
|
prefix=".ansible_tmp", dir=dest_dir, suffix=dest_file)
|
||||||
|
except (OSError, IOError), e:
|
||||||
|
self.fail_json(msg='The destination directory (%s) is not writable by the current user.' % dest_dir)
|
||||||
|
|
||||||
try: # leaves tmp file behind when sudo and not root
|
try: # leaves tmp file behind when sudo and not root
|
||||||
if switched_user and os.getuid() != 0:
|
if switched_user and os.getuid() != 0:
|
||||||
|
|
Loading…
Reference in a new issue