示例#1
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)
示例#2
0
    def run(self):
        """Run installation source image check.

        :return: a tuple with the required space
        :rtype: an instance of SetupImageResult
        :raise: SourceSetupError on failure
        """
        path = get_local_image_path_from_url(self._url)

        if not os.path.exists(path):
            raise SourceSetupError("File {} does not exist.".format(path))

        size = self._get_required_space(path)
        return SetupImageResult(required_space=size)
示例#3
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).st_size

        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
示例#4
0
    def run(self):
        """Run installation source image check.

        :returns: space required for the image in bytes if not known return None
        :rtype: int or None
        """
        size = 0
        local_image_path = get_local_image_path_from_url(self._url)
        if local_image_path:
            size = self._check_local_image(local_image_path)
        else:
            size = self._check_remote_image(self._url, self._proxy)

        # size <= 0 means that we don't know size
        if size <= 0:
            log.debug("Required space: Not known")
            return None
        else:
            log.debug("Required space: %s", size)
            return size