Error messages are encoded to HTML entity

Bug #1461776 reported by Ankit Agrawal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Ankit Agrawal
Kilo
Fix Released
Medium
Ankit Agrawal

Bug Description

If you pass min_disk or min_ram as -1 to the image create command, then it shows following error message on the command prompt.

$ glance image-create --name test --container-format bare --disk-format raw --file <filename> --min-disk -1
400 Bad Request: Invalid value '-1' for parameter 'min_disk': Image min_disk must be &gt;= 0 ('-1' specified). (HTTP 400)

The above error message will be rendered correctly in the browser but it is not readable on the command prompt.

This issue belongs to v1 API, in case of v2 api it returns proper error message:
400 Bad Request: Invalid value '-1' for parameter 'min_disk': Cannot be a negative value (HTTP 400)

So we can make this error message consistent for both the APIs.

Changed in glance:
assignee: nobody → Ankit Agrawal (ankitagrawal)
description: updated
Revision history for this message
Ankit Agrawal (ankitagrawal) wrote :

The same issue is applicable for size parameter as well.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: New → In Progress
Revision history for this message
Ankit Agrawal (ankitagrawal) wrote :

On our fail early principle we should not send these values to the server at the first place and should validate in glance-client.

Changed in python-glanceclient:
assignee: nobody → Ankit Agrawal (ankitagrawal)
Erno Kuvaja (jokke)
tags: added: kilo-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/188693
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=b7a29b7825799187678953a6052ce784ec285604
Submitter: Jenkins
Branch: master

commit b7a29b7825799187678953a6052ce784ec285604
Author: ankitagrawal <email address hidden>
Date: Thu Jun 4 05:15:06 2015 -0700

    Fixed error message for negative values of min_disk and min_ram

    In case of v1 api if min_disk or min_ram is passed with a negative value
    to the image create command, it returns 400 response with error message
    formatted to HTML entity.

    Eliminated special characters (>=) from error message, so it will not
    cause any encoding issues. Also with this change the error message for
    v1 api will be identical to v2 api.

    Closes-Bug: 1461776
    Change-Id: I71a3cc3ed6bf14f3c0273df053667f1cbf99e98f

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/190190

no longer affects: python-glanceclient
Changed in glance:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/kilo)

Reviewed: https://review.openstack.org/190190
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=a102ebebb6e91f2812d6bcb89293f97d16acc2bd
Submitter: Jenkins
Branch: stable/kilo

commit a102ebebb6e91f2812d6bcb89293f97d16acc2bd
Author: ankitagrawal <email address hidden>
Date: Thu Jun 4 05:15:06 2015 -0700

    Fixed error message for negative values of min_disk and min_ram

    In case of v1 api if min_disk or min_ram is passed with a negative value
    to the image create command, it returns 400 response with error message
    formatted to HTML entity.

    Eliminated special characters (>=) from error message, so it will not
    cause any encoding issues. Also with this change the error message for
    v1 api will be identical to v2 api.

    Closes-Bug: 1461776
    Change-Id: I71a3cc3ed6bf14f3c0273df053667f1cbf99e98f
    (cherry picked from commit b7a29b7825799187678953a6052ce784ec285604)

Changed in glance:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: liberty-1 → 11.0.0
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.