Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
ce80c0b8
Commit
ce80c0b8
authored
May 27, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support checking for su user to atomic_move
Fixes #7553
parent
b50a64b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
lib/ansible/module_utils/basic.py
+3
-2
No files found.
lib/ansible/module_utils/basic.py
View file @
ce80c0b8
...
@@ -1020,6 +1020,7 @@ class AnsibleModule(object):
...
@@ -1020,6 +1020,7 @@ class AnsibleModule(object):
context
=
self
.
selinux_default_context
(
dest
)
context
=
self
.
selinux_default_context
(
dest
)
creating
=
not
os
.
path
.
exists
(
dest
)
creating
=
not
os
.
path
.
exists
(
dest
)
switched_user
=
os
.
getlogin
()
!=
pwd
.
getpwuid
(
os
.
getuid
())[
0
]
try
:
try
:
# Optimistically try a rename, solves some corner cases and can avoid useless work, throws exception if not atomic.
# Optimistically try a rename, solves some corner cases and can avoid useless work, throws exception if not atomic.
...
@@ -1035,7 +1036,7 @@ class AnsibleModule(object):
...
@@ -1035,7 +1036,7 @@ class AnsibleModule(object):
prefix
=
".ansible_tmp"
,
dir
=
dest_dir
,
suffix
=
dest_file
)
prefix
=
".ansible_tmp"
,
dir
=
dest_dir
,
suffix
=
dest_file
)
try
:
# leaves tmp file behind when sudo and not root
try
:
# leaves tmp file behind when sudo and not root
if
os
.
getenv
(
"SUDO_USER"
)
and
os
.
getuid
()
!=
0
:
if
switched_user
and
os
.
getuid
()
!=
0
:
# cleanup will happen by 'rm' of tempdir
# cleanup will happen by 'rm' of tempdir
# copy2 will preserve some metadata
# copy2 will preserve some metadata
shutil
.
copy2
(
src
,
tmp_dest
.
name
)
shutil
.
copy2
(
src
,
tmp_dest
.
name
)
...
@@ -1058,7 +1059,7 @@ class AnsibleModule(object):
...
@@ -1058,7 +1059,7 @@ class AnsibleModule(object):
umask
=
os
.
umask
(
0
)
umask
=
os
.
umask
(
0
)
os
.
umask
(
umask
)
os
.
umask
(
umask
)
os
.
chmod
(
dest
,
0666
^
umask
)
os
.
chmod
(
dest
,
0666
^
umask
)
if
os
.
getenv
(
"SUDO_USER"
)
:
if
switched_user
:
os
.
chown
(
dest
,
os
.
getuid
(),
os
.
getgid
())
os
.
chown
(
dest
,
os
.
getuid
(),
os
.
getgid
())
if
self
.
selinux_enabled
():
if
self
.
selinux_enabled
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment