glance create-image returned error message contains html keys.

Bug #1395207 reported by Danny Choi
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Wishlist
Unassigned

Bug Description

OpenStack version: Juno

localadmin@qa4:~/devstack$ nova-manage version
2014.2.1

Issue: when "glance create-image" operation fails, the returned error message contains html keys.

localadmin@qa4:~/devstack$ glance image-create --name stcva_4.46 --is-public true --disk-format qcow2 --container-format bare --file /home/localadmin/latest.img
<html>
 <head>
  <title>403 Forbidden</title>
 </head>
 <body>
  <h1>403 Forbidden</h1>
  Access was denied to this resource.<br /><br />

 </body>
</html> (HTTP 403)

NOTE: operation fails because tenant demo does not has "admin" role. Could use a better error message to reflect the actual failure.

Revision history for this message
Louis Taylor (kragniz) wrote :

What would you say a better error message would be? The user performing the request didn't the correct rights, so access was deigned.

Changed in glance:
status: New → Incomplete
Revision history for this message
Danny Choi (dannchoi) wrote :

May be something like "Access is denied due to lack of permissions.'

Anyway, this bug report is about removing all the html tags.

It would be a bonus if the error message can be improved to be more descriptive.

Changed in glance:
status: Incomplete → New
Revision history for this message
Ian Cordasco (icordasc) wrote :

Danny, to be clear, which version of the API are you using?

Revision history for this message
Danny Choi (dannchoi) wrote :

localadmin@qa4:~/devstack$ glance --version
0.14.2.15

localadmin@qa4:~/devstack$ glance --debug image-create --name stcva_4.46 --is-public true --disk-format qcow2 --container-format bare --file /home/localadmin/latest.img
curl -i -X POST -H 'Accept-Encoding: gzip, deflate, compress' -H 'x-image-meta-container_format: bare' -H 'Accept: */*' -H 'X-Auth-Token: {SHA1}c55d6612cdccb2ca95b4ffc9e43da089f97a850d' -H 'x-image-meta-size: 1073741824' -H 'x-image-meta-is_public: True' -H 'User-Agent: python-glanceclient' -H 'Content-Type: application/octet-stream' -H 'x-image-meta-disk_format: qcow2' -H 'x-image-meta-name: stcva_4.46' http://172.29.172.161:9292/v1/images
Request returned failure status 403.
Traceback (most recent call last):
  File "/opt/stack/python-glanceclient/glanceclient/shell.py", line 602, in main
    args.func(client, args)
  File "/opt/stack/python-glanceclient/glanceclient/v1/shell.py", line 232, in do_image_create
    image = gc.images.create(**fields)
  File "/opt/stack/python-glanceclient/glanceclient/v1/images.py", line 288, in create
    data=image_data)
  File "/opt/stack/python-glanceclient/glanceclient/common/http.py", line 258, in post
    return self._request('POST', url, **kwargs)
  File "/opt/stack/python-glanceclient/glanceclient/common/http.py", line 223, in _request
    raise exc.from_response(resp, resp.content)
HTTPForbidden: <html>
 <head>
  <title>403 Forbidden</title>
 </head>
 <body>
  <h1>403 Forbidden</h1>
  Access was denied to this resource.<br /><br />

 </body>
</html> (HTTP 403)
<html>
 <head>
  <title>403 Forbidden</title>
 </head>
 <body>
  <h1>403 Forbidden</h1>
  Access was denied to this resource.<br /><br />

 </body>
</html> (HTTP 403)

Revision history for this message
Ian Cordasco (icordasc) wrote :

So this is only a problem with v1 of the API which we're not making changes to, let alone cosmetic changes. I think Erno and Louis agree with me (but I'll defer to them if not), but we're not accepting bug reports or fixes for deprecated versions of the API (in this case v1). I'm going to mark this as propose-close until I can solicit their input more directly.

tags: added: propose-close
Changed in glance:
status: New → Incomplete
Revision history for this message
Ian Cordasco (icordasc) wrote :

After some discussion in IRC, we've come to the conclusion that this is more of a feature for glanceclient since it should strip out the html. As I said above, we're not accepting improvements to v1, so I've removed the fact that this affects glance.

affects: glance → python-glanceclient
Changed in python-glanceclient:
importance: Undecided → Wishlist
Revision history for this message
Ian Cordasco (icordasc) wrote :

glanceclient now properly strips JSON and HTML formatting from error responses that it displays to users. This has been fixed and released since approximately Kilo.

Changed in python-glanceclient:
status: Incomplete → Won't Fix
status: Won't Fix → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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