Bug #3757

Sunstone requests "GET /appliance" instead of the URI that is configured in sunstone-server.conf

Added by Stefan Kooman about 6 years ago. Updated almost 6 years ago.

Status:ClosedStart date:04/17/2015
Priority:NormalDue date:
Assignee:Daniel Molina% Done:

100%

Category:Sunstone
Target version:Release 4.14
Resolution:fixed Pull request:
Affected Versions:OpenNebula 4.12

Description

I have set up our own marketplace (appmarket). The appmarket is available under "hostname/market/appliance". If I configure hostname/market/appliance in sunstone-server.conf (:marketplace_url:) sunstone makes request to hostname/appliance in stead of "hostname/market/appliance". Sunstone seems to have the request URI part hard coded (appliance), which results in "GET /appliance HTTP/1.1" 404 448 "-" "OpenNebula 4.12.1 (Sunstone)" and "Cannot connect to OpenNebula Marketplace" error in Sunstone.

Associated revisions

Revision 830eb339
Added by Daniel Molina almost 6 years ago

bug #3757: Use path uri for marketplace client

Revision b481d534
Added by Daniel Molina almost 6 years ago

bug #3757: Add note about the marketplace url path in sunstone-server.conf

History

#1 Updated by Stefan Kooman about 6 years ago

I tried to implement a workaround by configuring a rewrite rule (rewrite '/appliance' -> '/market/') but to no avail: JSON response "{
"error": {
"message": ""
}
}"

#2 Updated by Daniel Molina about 6 years ago

Hi Stefan,

You should modify the following lines:
https://github.com/OpenNebula/one/blob/master/src/cloud/marketplace/lib/marketplace_client.rb#L44
https://github.com/OpenNebula/one/blob/master/src/cloud/marketplace/lib/marketplace_client.rb#L49

to something like:
req = Net::HTTP::Proxy(@host, @port)::Get.new(@uri.path + path)
req = Net::HTTP::Proxy(@host, @port):: + (path)

If you are using the appmarket library (that means you added a new tab in sunstone instead of using the marketplace tab and added a new route in sunstone-server), you should modify the Get,Post,Put,Delete methods adding the @uri.path:
https://github.com/OpenNebula/addon-appmarket/blob/master/src/client/lib/appmarket_client.rb#L145

Hope this helps

#3 Updated by Stefan Kooman about 6 years ago

I applied the changes as suggested by Daniel and can confirm that these changes make it work (marketplace as well as appmarket tab). For the "marketplace_url / Appmarket endpoint" a note should be added that "/appliance" is added to the request uri, so to avoid /market/appliance/appliance calls.

#4 Updated by Daniel Molina about 6 years ago

  • Status changed from Pending to New
  • Target version set to Release 4.14

#5 Updated by Daniel Molina almost 6 years ago

  • Assignee set to Daniel Molina

#6 Updated by Daniel Molina almost 6 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
  • Resolution set to fixed

Also available in: Atom PDF