Commits

Moises Henriquez  committed 71290a3

Add some logging to chroot to spot errors that happen in the chroot

  • Participants
  • Parent commits 0931d39

Comments (0)

Files changed (1)

File vinstall/backend/utils.py

 import os
 import re
 from vinstall.backend import sp
+from vinstall.core import log
+
+LOG = log.get_logger("vinstall_utils")
 
 
 def get_mem_size():
         """Save current root for restoring later
 
         """
-        self.real_root = os.open("/", os.O_RDONLY)
-        self.old_cwd = os.getcwd()
-        os.chroot(self.new_root)
-        if self.chdir:
-            os.chdir("/")
+        LOG.debug("Entering chroot")
+        try:
+            self.real_root = os.open("/", os.O_RDONLY)
+            self.old_cwd = os.getcwd()
+            os.chroot(self.new_root)
+            if self.chdir:
+                os.chdir("/")
+        except:
+            LOG.error("Error occurred while running commands in chroot %s"% self.new_root)
 
     def __exit__(self, *_):
         """Go back to previous root