Project

General

Profile

Bug #11345

API Get available_clusters send empty hash

Added by Michael Alves Lobo about 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Compute resources - VMware
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

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 issues

Related to Foreman - Bug #8581: Can't provision a new host if vmware cluster is under folderClosed2014-12-04

Associated revisions

Revision 208a655e (diff)
Added by Timo Goebel almost 4 years ago

fixes #11345 - API GET request available_clusters sends empty hash

Revision cdef67a6 (diff)
Added by Timo Goebel almost 4 years ago

fixes #11345 - API GET request available_clusters sends empty hash

(cherry picked from commit 208a655e8805d41e3eebf82871803770966d20e5)

History

#1 Updated by Dominic Cleal about 4 years ago

  • Related to Bug #8581: Can't provision a new host if vmware cluster is under folder added

#2 Updated by Dominic Cleal about 4 years ago

  • Category set to Compute resources - VMware

It's a bug introduced by #8581.

#3 Updated by Michael Alves Lobo about 4 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": 

    [
        { }
    ]

}

#4 Updated by Michael Alves Lobo about 4 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": 

    [
        { }
    ]

}

#5 Updated by Dominic Cleal about 4 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.

#6 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2850 added
  • Pull request deleted ()

#7 Updated by Anonymous almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#8 Updated by Dominic Cleal almost 4 years ago

  • Assignee set to Timo Goebel
  • Legacy Backlogs Release (now unused) set to 63

#9 Updated by Tomer Brisker over 3 years ago

  • Bugzilla link set to 1206243

Also available in: Atom PDF