Bug #11345
closedAPI Get available_clusters send empty hash
Description
When i request /api/compute_resources/:id/available_clusters , list of clusters is empty ..
When i look in app/models/compute_resources/foreman/model/vmware.rb the method clusters return an array of string , but the view of API needs an array of cluster objet
I've modify the method :
def clusters if dc.clusters.nil? Rails.logger.info "Datacenter #{dc.try(:name)} returned zero clusters" return [] end #dc.clusters.map(&:full_path).sort name_sort(dc.clusters) end
and now it's ok...
It's a bug or a i use so bad the API ?
Michael
Updated by Dominic Cleal over 9 years ago
- Related to Bug #8581: Can't provision a new host if vmware cluster is under folder added
Updated by Dominic Cleal over 9 years ago
- Category set to Compute resources - VMware
It's a bug introduced by #8581.
Updated by Michael Alves Lobo over 9 years ago
Dominic,
Thanks.
But i think my problem is not excatly this bug.
In this rabl view (compute_resources/available_clusters.rabl) i've:
collection @available_clusters regards , Michael attribute :name, :id
But @available_clusters is an array of string, not a array of object , and so the result is empty like this :
{ "total": 2, "subtotal": 2, "page": 1, "per_page": 100, "search": null, "sort": { "by": null, "order": null }, "results": [ { } ] }
Updated by Michael Alves Lobo over 9 years ago
Dominic,
Thanks.
But i think my problem is not excatly this bug.
In this rabl view (compute_resources/available_clusters.rabl) i've:
collection @available_clusters attribute :name, :id
But @available_clusters is an array of string, not a array of object , and so the result is empty like this :
{ "total": 2, "subtotal": 2, "page": 1, "per_page": 100, "search": null, "sort": { "by": null, "order": null }, "results": [ { } ] }
Updated by Dominic Cleal over 9 years ago
Yes, I understand. I was saying that it was caused by a change in that bug, which switched the cluster return value from objects to strings.
Updated by The Foreman Bot about 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2850 added
- Pull request deleted (
)
Updated by Anonymous about 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 208a655e8805d41e3eebf82871803770966d20e5.
Updated by Dominic Cleal about 9 years ago
- Assignee set to Timo Goebel
- Translation missing: en.field_release set to 63