Bug #11345
closed
API Get available_clusters send empty hash
Added by Michael Alves Lobo over 9 years ago.
Updated over 6 years ago.
Category:
Compute resources - VMware
|
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
- Related to Bug #8581: Can't provision a new host if vmware cluster is under folder added
- Category set to Compute resources - VMware
It's a bug introduced by #8581.
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":
[
{ }
]
}
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":
[
{ }
]
}
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.
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2850 added
- Pull request deleted (
)
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Assignee set to Timo Goebel
- Translation missing: en.field_release set to 63
- Bugzilla link set to 1206243
Also available in: Atom
PDF