mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fixes #38452 atomicfile only copies mode and not user/group perms
This commit is contained in:
parent
a2161efda3
commit
dbeeb0e917
1 changed files with 3 additions and 0 deletions
|
@ -13,6 +13,7 @@ import errno
|
|||
import time
|
||||
import random
|
||||
import shutil
|
||||
import stat
|
||||
import salt.ext.six as six
|
||||
|
||||
|
||||
|
@ -120,6 +121,8 @@ class _AtomicWFile(object):
|
|||
self._fh.close()
|
||||
if os.path.isfile(self._filename):
|
||||
shutil.copymode(self._filename, self._tmp_filename)
|
||||
st = os.stat(self._filename)
|
||||
os.chown(self._tmp_filename, st[stat.ST_UID], st[stat.ST_GID])
|
||||
atomic_rename(self._tmp_filename, self._filename)
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
|
|
Loading…
Add table
Reference in a new issue