From 049d73874c460529928e67cd9fa6ac9e87fbfb53 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 3 Oct 2011 12:17:17 +0200 Subject: [PATCH] Check if /proc is mounted (#741722) Needed for proper functionality in chroot, so if it is not there, exit before doing anything. --- src/pylorax/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index ff14b4f3..6f73f397 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -170,6 +170,13 @@ class Lorax(BaseLoraxClass): logger.critical("no root privileges") sys.exit(1) + # check if /proc is mounted + logger.info("checking /proc") + if (not os.path.isdir("/proc") and not os.path.exists("/proc/mounts") + and not os.path.exists("/proc/devices")): + logger.critical("missing required /proc files (not mounted?)") + sys.exit(1) + # do we have all lorax required commands? self.lcmds = constants.LoraxRequiredCommands()