Horizon image upload with bad Glance CORS config fails with "[object Object]"

Bug #1703708 reported by Mathieu Gagné
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Pascal Boutin

Bug Description

How to reproduce:

Configure Horizon to use direct upload mode:

  HORIZON_IMAGES_UPLOAD_MODE=direct

In glance-api.conf, make sure cors is enabled but configured badly with a bogus origin:

  [cors]
  allowed_origin = https://foobar

Try uploading an image from Horizon.

This should fail with this error in the console:

    XMLHttpRequest cannot load https://glance.example.org/v2/images/XXXX/file. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://foobar' is therefore not allowed access.

And Horizon will show this error at the top of the image creation popup:

  [object Object]

Expected result:

The error message shown should not be the one mentioned above, it's not user friendly.

It can be a generic one like "Unable to create the image." or specific one if we want to inform the user that the provider improperly configured cors support in Glance.

Alok Kumar (rajalokan)
Changed in horizon:
assignee: nobody → Alok Kumar (rajalokan)
Changed in horizon:
milestone: none → pike-3
importance: Undecided → High
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/487592

Changed in horizon:
assignee: Alok Kumar (rajalokan) → Pascal Boutin (pboutin)
status: Confirmed → In Progress
Changed in horizon:
milestone: pike-3 → pike-rc1
Akihiro Motoki (amotoki)
Changed in horizon:
milestone: pike-rc1 → pike-rc2
tags: added: pike-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/487592
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=09a2afef35a2428ed7a551a3f16247e815fbabbd
Submitter: Jenkins
Branch: master

commit 09a2afef35a2428ed7a551a3f16247e815fbabbd
Author: Pascal Boutin <email address hidden>
Date: Wed Jul 26 17:15:29 2017 -0400

    Fix the error format of glance's createImage

    Uppon failure, the createImage function returned a raw xhr error
    that was incompatible with the wizard modal, making it display
    the [Object object] error.

    This change makes it so a generic error message is thrown directly
    if it's not an handled glance error, so it could be shown on top of
    the wizard modal.

    Change-Id: I637bf1002630fe21f5ad20a7a047ec65ebc052dc
    Closes-bug: #1703708

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 13.0.0.0b1

This issue was fixed in the openstack/horizon 13.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/534352

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/pike)

Reviewed: https://review.openstack.org/534352
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=f66f87049dc1c5445c7953a30367574997c8949a
Submitter: Zuul
Branch: stable/pike

commit f66f87049dc1c5445c7953a30367574997c8949a
Author: Pascal Boutin <email address hidden>
Date: Wed Jul 26 17:15:29 2017 -0400

    Fix the error format of glance's createImage

    Uppon failure, the createImage function returned a raw xhr error
    that was incompatible with the wizard modal, making it display
    the [Object object] error.

    This change makes it so a generic error message is thrown directly
    if it's not an handled glance error, so it could be shown on top of
    the wizard modal.

    Change-Id: I637bf1002630fe21f5ad20a7a047ec65ebc052dc
    Closes-bug: #1703708
    (cherry picked from commit 09a2afef35a2428ed7a551a3f16247e815fbabbd)

tags: added: in-stable-pike
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 12.0.3

This issue was fixed in the openstack/horizon 12.0.3 release.

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.