mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Merge branch 'devel' of https://github.com/l1k/ansible into l1k-devel
Conflicts: test/integration/roles/test_copy/tasks/main.yml
This commit is contained in:
commit
5e240fec71
2 changed files with 32 additions and 3 deletions
|
@ -1148,9 +1148,13 @@ class AnsibleModule(object):
|
|||
if self.selinux_enabled():
|
||||
self.set_context_if_different(
|
||||
tmp_dest.name, context, False)
|
||||
tmp_stat = os.stat(tmp_dest.name)
|
||||
if dest_stat and (tmp_stat.st_uid != dest_stat.st_uid or tmp_stat.st_gid != dest_stat.st_gid):
|
||||
os.chown(tmp_dest.name, dest_stat.st_uid, dest_stat.st_gid)
|
||||
try:
|
||||
tmp_stat = os.stat(tmp_dest.name)
|
||||
if dest_stat and (tmp_stat.st_uid != dest_stat.st_uid or tmp_stat.st_gid != dest_stat.st_gid):
|
||||
os.chown(tmp_dest.name, dest_stat.st_uid, dest_stat.st_gid)
|
||||
except OSError, e:
|
||||
if e.errno != errno.EPERM:
|
||||
raise
|
||||
os.rename(tmp_dest.name, dest)
|
||||
except (shutil.Error, OSError, IOError), e:
|
||||
self.cleanup(tmp_dest.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue