Exemplo n.º 1
0
    def __init__(self, data):
        if tarfile is None:
            raise PayloadError("unsupported payload type")

        super(TarPayload, self).__init__(data)
        self.archive = None
        self.image_file = None
Exemplo n.º 2
0
    def setup(self, storage):
        super(TarPayload, self).setup(storage)

        try:
            self.archive = tarfile.open(self.image_file)
        except (tarfile.ReadError, tarfile.CompressionError) as e:
            # maybe we only need to catch ReadError and CompressionError here
            log.error("opening tar archive %s: %s", self.image_file, e)
            raise PayloadError("invalid payload format")