]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: path_set_context() after rename()
authorKefu Chai <kchai@redhat.com>
Mon, 27 Nov 2017 08:35:56 +0000 (16:35 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 28 Nov 2017 06:55:33 +0000 (14:55 +0800)
it does not matter if we chown/restorecon before or after the rename,
but the logging message looks better this way: instead of fixing the
.tmp files, we are updating the attributes of the dest files w/o
.${pid}.tmp extension.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph-disk/ceph_disk/main.py

index 44ff442551ac76861cdc25c4875fa5801b6ed134..f4b1d9a060e36b3db9dee2ac572ceeb92e5dea0c 100644 (file)
@@ -1028,8 +1028,8 @@ def write_one_line(parent, name, text):
     with open(tmp, 'wb') as tmp_file:
         tmp_file.write(text.encode('utf-8') + b'\n')
         os.fsync(tmp_file.fileno())
-    path_set_context(tmp)
     os.rename(tmp, path)
+    path_set_context(path)
 
 
 def init_get():