def main_fix(args):
# A hash table containing 'path': ('uid', 'gid', blocking, recursive)
fix_table = [
- ('/usr/bin/ceph-mon', 'ceph', 'ceph', True, False),
- ('/usr/bin/ceph-mds', 'ceph', 'ceph', True, False),
- ('/usr/bin/ceph-osd', 'ceph', 'ceph', True, False),
- ('/usr/bin/radosgw', 'ceph', 'ceph', True, False),
- ('/etc/ceph', 'ceph', 'ceph', True, True),
+ ('/usr/bin/ceph-mon', 'root', 'root', True, False),
+ ('/usr/bin/ceph-mds', 'root', 'root', True, False),
+ ('/usr/bin/ceph-osd', 'root', 'root', True, False),
+ ('/usr/bin/radosgw', 'root', 'root', True, False),
+ ('/etc/ceph', 'root', 'root', True, True),
('/var/run/ceph', 'ceph', 'ceph', True, True),
('/var/log/ceph', 'ceph', 'ceph', True, True),
('/var/log/radosgw', 'ceph', 'ceph', True, True),
# Use find to relabel + chown ~simultaenously
if args.all:
for directory, uid, gid, blocking, recursive in fix_table:
+ # Skip directories/files that are not installed
+ if not os.access(directory, os.F_OK):
+ continue
+
c = [
'find',
directory,
# Fix permissions
if args.permissions:
for directory, uid, gid, blocking, recursive in fix_table:
+ # Skip directories/files that are not installed
+ if not os.access(directory, os.F_OK):
+ continue
+
if recursive:
c = [
'chown',
# Fix SELinux labels
if args.selinux:
for directory, uid, gid, blocking, recursive in fix_table:
+ # Skip directories/files that are not installed
+ if not os.access(directory, os.F_OK):
+ continue
+
if recursive:
c = [
'restorecon',