fail to load package ui with glare enabled

Bug #1594362 reported by SFilatov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Murano
Fix Released
High
SFilatov

Bug Description

GET on http://<vip>:8082/v1/catalog/packages/<package id>/ui fails with:
"PackageFormatError: Incorrect package format: Uploaded file /tmp/tmpgCb7ll is not a zip archive\n"

This happens occasionally depending on a package
/usr/lib/python2.7/dist-packages/murano/api/v1/catalog.py:

def get_ui(self, req, package_id):
        ...
        else:
            g_client = self._get_glare_client(req)
            blob_data = g_client.artifacts.download_blob(package_id, 'archive')
            with tempfile.NamedTemporaryFile() as tempf:
                for chunk in blob_data:
                    tempf.write(chunk)
                with load_utils.load_from_file(tempf.name, target_dir=None,
                                               drop_dir=True) as pkg:
                    return pkg.ui

Since load_utils.load_from_file is called inside temp's with construction and it's opened, subsequent zipfile check might fail

SFilatov (sergeyfilatov)
description: updated
Changed in murano:
importance: Undecided → High
milestone: none → newton-2
SFilatov (sergeyfilatov)
Changed in murano:
assignee: nobody → SFilatov (filatecs)
Revision history for this message
SFilatov (sergeyfilatov) wrote :

I suggest we use streams instead of tempfiles. If we stick to the tempfile way we can either flush or mark it as delete=false, removing with os. Which way we better go?

Revision history for this message
Valerii Kovalchuk (vakovalchuk) wrote :

Looks like this issue is already fixed by https://review.openstack.org/#/c/320540/

Changed in murano:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.