Unable to list flavors in WebUI due to wrong Content-Type of a query sent to nova

Bug #1591393 reported by Krzysztof Klimonda
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R3.0
Fix Committed
Medium
Krzysztof Klimonda
R3.0.2.x
Fix Committed
Medium
Krzysztof Klimonda
Trunk
Fix Committed
Medium
Krzysztof Klimonda
OpenContrail
New
Medium
Krzysztof Klimonda

Bug Description

When creating a Service Template, instance flavor has to be selected from a dropdown menu. That fails when running Mitaka nova-api, due to requests being done with Content-Type set to "application/x-www-form-urlencoded", which nova-api rejects with "Unsupported Content-Type".

That happens because an empty data object is passed to request.get call. Even though we're setting Content-Type to "application/json", restler later sees a JS object, "stringifies" it, and overrides Content-Type with "application/x-www-form-urlencoded".

The simplest fix seems to simply avoid passing an empty data object with GET calls, which seems to make sense anyway.

Tags: ui
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/21091
Submitter: Krzysztof Klimonda (<email address hidden>)

Changed in opencontrail:
importance: Undecided → Medium
assignee: nobody → Krzysztof Klimonda (kklimonda)
tags: added: ui
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/21091
Committed: http://github.org/Juniper/contrail-web-core/commit/f10620ede1f9f28858a9b418ec26093c57f00c41
Submitter: Zuul
Branch: master

commit f10620ede1f9f28858a9b418ec26093c57f00c41
Author: Krzysztof Klimonda <email address hidden>
Date: Thu Jun 9 13:38:18 2016 -0700

Avoid passing an empty 'data' object to restler.get calls.

Restler changes Content-Type to 'application/x-www-form-urlencoded' even
for GET requests, as long as data is not a string. That breaks some nova
API calls when Mitaka nova-api is used, as it now expects to get
"application/json" for all queries. Make sure we pass data object only
for POST and PUT calls.

Change-Id: Ieaf1622dec703404d9672681a9cd0d35199326d7
Closes-Bug: 1591393

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R3.0

Review in progress for https://review.opencontrail.org/23042
Submitter: Biswajit Mandal (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R3.0.2.x

Review in progress for https://review.opencontrail.org/23043
Submitter: Biswajit Mandal (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/23042
Committed: http://github.org/Juniper/contrail-web-core/commit/2465d3eebc3ae8b951305972ed6fd9210ce286d3
Submitter: Zuul
Branch: R3.0

commit 2465d3eebc3ae8b951305972ed6fd9210ce286d3
Author: Biswajit Mandal <email address hidden>
Date: Tue Jul 26 23:10:05 2016 +0530

Closes-Bug: #1606646
Post node version 0.9.1, tls, https: validate server certificate by default.
So in case self signed certificate, UI will not work with https request to
openstack services.
https://github.com/mscdex/node-imap/issues/181#issuecomment-14781480
Fix: Added rejectUnauthorized flag.

In node post v0.11.14, we have custom checkServerIdentity in options to have
more control.

UT Results:
+++++++++++
contrail-web-controller:
------------------------
PhantomJS 1.9.8 (Mac OS X 10.9.5): Executed 376 of 376 SUCCESS (1 min 41.645 secs / 1 min 39.143 secs)
Done, without errors.

contrail-web-server-manager:
----------------------------
PhantomJS 1.9.8 (Mac OS X 10.9.5): Executed 89 of 89 SUCCESS (11.9 secs / 11.643 secs)
Done, without errors.

contrail-web-storage:
--------------------
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 84 of 84 SUCCESS (20.301 secs / 18.748 secs)
Done, without errors.

Change-Id: Iec589a59b5ae153c3b6a57ad1e96a025c8a9280e
(cherry picked from commit 60c214946aa0ceb34e668a212a41036b693e63df)

Avoid passing an empty 'data' object to restler.get calls.

Restler changes Content-Type to 'application/x-www-form-urlencoded' even
for GET requests, as long as data is not a string. That breaks some nova
API calls when Mitaka nova-api is used, as it now expects to get
"application/json" for all queries. Make sure we pass data object only
for POST and PUT calls.

Change-Id: Ieaf1622dec703404d9672681a9cd0d35199326d7
Closes-Bug: 1591393
(cherry picked from commit f10620ede1f9f28858a9b418ec26093c57f00c41)

Closes-Bug: #1605163
This is side effect of the below fix:
https://github.com/Juniper/contrail-web-core/commit/f10620ede1f9f28858a9b418ec26093c57f00c41
Comuting data before Content-Length header assignement.

Change-Id: I100ab66856595688e97a74a54ce534fcdc201a36
(cherry picked from commit 15ba7405f1a000dcf3537cef7c2191f91a1c0fb5)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Reviewed: https://review.opencontrail.org/23043
Committed: http://github.org/Juniper/contrail-web-core/commit/44f8bdd31e4f285203cddca3772b45f495b49a8a
Submitter: Zuul
Branch: R3.0.2.x

commit 44f8bdd31e4f285203cddca3772b45f495b49a8a
Author: Biswajit Mandal <email address hidden>
Date: Tue Jul 26 23:10:05 2016 +0530

Closes-Bug: #1606646
Post node version 0.9.1, tls, https: validate server certificate by default.
So in case self signed certificate, UI will not work with https request to
openstack services.
https://github.com/mscdex/node-imap/issues/181#issuecomment-14781480
Fix: Added rejectUnauthorized flag.

In node post v0.11.14, we have custom checkServerIdentity in options to have
more control.

UT Results:
+++++++++++
contrail-web-controller:
------------------------
PhantomJS 1.9.8 (Mac OS X 10.9.5): Executed 376 of 376 SUCCESS (1 min 41.645 secs / 1 min 39.143 secs)
Done, without errors.

contrail-web-server-manager:
----------------------------
PhantomJS 1.9.8 (Mac OS X 10.9.5): Executed 89 of 89 SUCCESS (11.9 secs / 11.643 secs)
Done, without errors.

contrail-web-storage:
--------------------
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 84 of 84 SUCCESS (20.301 secs / 18.748 secs)
Done, without errors.

Change-Id: Iec589a59b5ae153c3b6a57ad1e96a025c8a9280e
(cherry picked from commit 60c214946aa0ceb34e668a212a41036b693e63df)

Avoid passing an empty 'data' object to restler.get calls.

Restler changes Content-Type to 'application/x-www-form-urlencoded' even
for GET requests, as long as data is not a string. That breaks some nova
API calls when Mitaka nova-api is used, as it now expects to get
"application/json" for all queries. Make sure we pass data object only
for POST and PUT calls.

Change-Id: Ieaf1622dec703404d9672681a9cd0d35199326d7
Closes-Bug: 1591393
(cherry picked from commit f10620ede1f9f28858a9b418ec26093c57f00c41)

Closes-Bug: #1605163
This is side effect of the below fix:
https://github.com/Juniper/contrail-web-core/commit/f10620ede1f9f28858a9b418ec26093c57f00c41
Comuting data before Content-Length header assignement.

Change-Id: I100ab66856595688e97a74a54ce534fcdc201a36
(cherry picked from commit 15ba7405f1a000dcf3537cef7c2191f91a1c0fb5)

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.