Преглед изворни кода

Skip mount-binding missing directories during OSMount.

Some OS releases might not feature all of the system dirs we
`mount -t bind` during OSMount (ex: /run on OpenWRT)
Nashwan Azhari пре 8 година
родитељ
комит
1f3fc28afb
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      coriolis/osmorphing/osmount/base.py

+ 4 - 0
coriolis/osmorphing/osmount/base.py

@@ -252,6 +252,10 @@ class BaseLinuxOSMountTools(BaseSSHOSMountTools):
 
         for dir in set(dirs).intersection(['proc', 'sys', 'dev', 'run']):
             mount_dir = os.path.join(os_root_dir, dir)
+            if not utils.test_ssh_path(self._ssh, mount_dir):
+                LOG.info(
+                    "No '%s' directory in mounted OS. Skipping mount.", dir)
+                continue
             self._exec_cmd(
                 'sudo mount -o bind /%(dir)s/ %(mount_dir)s' %
                 {'dir': dir, 'mount_dir': mount_dir})