Ensure that SELinux context is properly set according to policy.We
need this as SELinux context is not preserved across mount points.
Signed-off-by: Milan Broz <mbroz@redhat.com>
with file(tmp, 'wb') as tmp_file:
tmp_file.write(text + '\n')
os.fsync(tmp_file.fileno())
+ path_set_context(tmp)
os.rename(tmp, path)
check_osd_id(osd_id)
return osd_id
+def path_set_context(path):
+ # restore selinux context to default policy values
+ if which('restorecon'):
+ command(
+ [
+ 'restorecon', '-R',
+ path,
+ ],
+ )
def _check_output(args=None, **kwargs):
out, ret = command(args, **kwargs)
journal_dmcrypt=journal_dmcrypt,
)
finally:
+ path_set_context(path)
unmount(path)
finally:
if rawdev != dev: