From 72b79f71fa84fe0d56b2fd1745f5bb130380cc38 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 22 Nov 2019 10:46:05 +0100 Subject: [PATCH] ceph-volume: don't assume SELinux Expect selinux related binaries to not be present. Fixes: 33c8a64a54d9ea8962091caf8564cea3f603c5f5 Fixes: https://tracker.ceph.com/issues/42957 Signed-off-by: Jan Fajerski --- src/ceph-volume/ceph_volume/util/system.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ceph-volume/ceph_volume/util/system.py b/src/ceph-volume/ceph_volume/util/system.py index b5c4ce940aed..100bcd7b0d25 100644 --- a/src/ceph-volume/ceph_volume/util/system.py +++ b/src/ceph-volume/ceph_volume/util/system.py @@ -297,7 +297,13 @@ def set_context(path, recursive=False): ) return - stdout, stderr, code = process.call(['selinuxenabled'], verbose_on_failure=False) + try: + stdout, stderr, code = process.call(['selinuxenabled'], + verbose_on_failure=False) + except FileNotFoundError: + logger.info('No SELinux found, skipping call to restorecon') + return + if code != 0: logger.info('SELinux is not enabled, will not call restorecon') return -- 2.47.3