diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2017-01-03 16:33:13 -0500 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2017-01-04 14:23:50 -0500 |
commit | e223349edcc9748c68f5c01008b66221bea95763 (patch) | |
tree | 266ec4ff47e9aecc6bfa24765509139fe632ab83 /lib | |
parent | b25c06725a9488ee602f69373bb22a48735a27c2 (diff) | |
download | ansible-e223349edcc9748c68f5c01008b66221bea95763.tar.gz |
fixed id queries, should rely on effective
(cherry picked from commit 92e8c538791c6181aa5a8e5a1bd8d0ba3fd49744)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/module_utils/basic.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index d2c282c2a6..a2e7296b5c 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1936,7 +1936,7 @@ class AnsibleModule(object): # if the original login_name doesn't match the currently # logged-in user, or if the SUDO_USER environment variable # is set, then this user has switched their credentials - switched_user = login_name and login_name != pwd.getpwuid(os.getuid())[0] or os.environ.get('SUDO_USER') + switched_user = login_name and login_name != pwd.getpwuid(os.geteuid())[0] or os.environ.get('SUDO_USER') try: # Optimistically try a rename, solves some corner cases and can avoid useless work, throws exception if not atomic. @@ -1976,7 +1976,7 @@ class AnsibleModule(object): # close tmp file handle before file operations to prevent text file busy errors on vboxfs synced folders (windows host) os.close(tmp_dest_fd) # leaves tmp file behind when sudo and not root - if switched_user and os.getuid() != 0: + if switched_user and os.geteuid() != 0: # cleanup will happen by 'rm' of tempdir # copy2 will preserve some metadata shutil.copy2(b_src, b_tmp_dest_name) @@ -2014,7 +2014,7 @@ class AnsibleModule(object): os.umask(umask) os.chmod(b_dest, DEFAULT_PERM & ~umask) if switched_user: - os.chown(b_dest, os.getuid(), os.getgid()) + os.chown(b_dest, os.geteuid(), os.getegid()) if self.selinux_enabled(): # rename might not preserve context |