From: Jan Fajerski Date: Fri, 22 Nov 2019 09:46:05 +0000 (+0100) Subject: ceph-volume: don't assume SELinux X-Git-Tag: v13.2.9~102^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a4dff14a62f82c07db98ff303313e05f3f4d5f54;p=ceph.git 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 (cherry picked from commit 72b79f71fa84fe0d56b2fd1745f5bb130380cc38) --- diff --git a/src/ceph-volume/ceph_volume/util/system.py b/src/ceph-volume/ceph_volume/util/system.py index b5c4ce940aed2..100bcd7b0d25d 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