Exemple #1
0
    def mount_kernel_file_systems(self):
        """
        Bind mount kernel filesystems

        :raises KiwiMountKernelFileSystemsError: if some kernel filesystem
            fails to mount
        """
        try:
            for location in self.bind_locations:
                location_mount_target = os.path.normpath(os.sep.join([
                    self.root_dir, location
                ]))
                if os.path.exists(location) and os.path.exists(
                    location_mount_target
                ):
                    shared_mount = MountManager(
                        device=location, mountpoint=location_mount_target
                    )
                    shared_mount.bind_mount()
                    self.mount_stack.append(shared_mount)
        except Exception as e:
            self.cleanup()
            raise KiwiMountKernelFileSystemsError(
                '%s: %s' % (type(e).__name__, format(e))
            )
Exemple #2
0
 def test_kernel_file_systems_raises_error(self, mock_exists, mock_cleanup,
                                           mock_mount):
     mock_exists.return_value = True
     mock_mount.side_effect = KiwiMountKernelFileSystemsError('mount-error')
     with raises(KiwiMountKernelFileSystemsError):
         self.bind_root.mount_kernel_file_systems()
     mock_cleanup.assert_called_once_with()
Exemple #3
0
 def test_kernel_file_systems_raises_error(self, mock_cleanup,
                                           mock_command):
     mock_command.side_effect = KiwiMountKernelFileSystemsError(
         'mount-error')
     self.bind_root.mount_kernel_file_systems()
     mock.cleanup.assert_called_once_with()