Project

General

Profile

Actions

Bug #11345

closed

API Get available_clusters send empty hash

Added by Michael Alves Lobo over 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Compute resources - VMware
Target version:
Difficulty:
Triaged:
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 1 (0 open1 closed)

Related to Foreman - Bug #8581: Can't provision a new host if vmware cluster is under folderClosedShlomi Zadok12/04/2014Actions
Actions #1

Updated by Dominic Cleal over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Category set to Compute resources - VMware

It's a bug introduced by #8581.

Actions #3

Updated by Michael Alves Lobo over 8 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": 

    [
        { }
    ]

}
Actions #4

Updated by Michael Alves Lobo over 8 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": 

    [
        { }
    ]

}
Actions #5

Updated by Dominic Cleal over 8 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.

Actions #6

Updated by The Foreman Bot over 8 years ago

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

Updated by Anonymous over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Assignee set to Timo Goebel
  • translation missing: en.field_release set to 63
Actions #9

Updated by Tomer Brisker about 8 years ago

  • Bugzilla link set to 1206243
Actions

Also available in: Atom PDF