예제 #1
0
 def install_with_task(self):
     """Install the payload."""
     if url_target_is_tarfile(self._url):
         return InstallFromTarTask(self.image_path, conf.target.system_root,
                                   self.kernel_version_list)
     else:
         return InstallFromImageTask(conf.target.system_root,
                                     self.kernel_version_list)
예제 #2
0
    def update_kernel_version_list(self):
        """Update list of kernel versions."""
        if url_target_is_tarfile(self._url):
            if not os.path.exists(self.image_path):
                raise SourceSetupError("Failed to find tarfile image")
            kernel_version_list = get_kernel_version_list_from_tar(
                self.image_path)
        else:
            kernel_version_list = get_kernel_version_list(INSTALL_TREE)

        self.set_kernel_version_list(kernel_version_list)
예제 #3
0
    def run(self):
        """Run tear down of installation source image."""
        if not url_target_is_tarfile(self._url):
            unmount(self._image_mount_point, raise_exc=True)
            # FIXME: Payload and LiveOS stuff
            # FIXME: do we need a task for this?
            if os.path.exists(IMAGE_DIR + "/LiveOS"):
                # FIXME: catch and pass the exception
                unmount(IMAGE_DIR, raise_exc=True)
                os.rmdir(IMAGE_DIR)

        if not get_local_image_path_from_url(self._url):
            if os.path.exists(self._image_path):
                os.unlink(self._image_path)
예제 #4
0
    def run(self):
        """Run set up or installation source."""
        image_path_from_url = get_local_image_path_from_url(self._url)
        if image_path_from_url:
            self._image_path = image_path_from_url
        else:
            self._download_image(self._url, self._image_path, self._session)

        # TODO - do we use it at all in LiveImage
        # Used to make install progress % look correct
        # self._adj_size = os.stat(self.image_path)[stat.ST_SIZE]

        if self._checksum:
            self._check_image_sum(self._image_path, self._checksum)

        if not url_target_is_tarfile(self._url):
            self._mount_image(self._image_path, self._image_mount_point)

        log.debug("Source image file path: %s", self._image_path)
        return self._image_path