Feature #827
closedadd support for retrieving classes per host via the api
Description
I would like to be able to get the assigned classes on a per host basis. I think it make logical sense to use the following url
GET: http://foreman/hosts/fqdn/puppetclasses
This would return a json object with the classes that the host is assigned.
A change similar to the following would need to be done:
Updated by Ohad Levy over 13 years ago
- Status changed from New to Ready For Testing
- % Done changed from 0 to 100
Applied in changeset 31207a31fca8609182762e9717aa6978753cb317.
Updated by Ohad Levy over 13 years ago
- Status changed from Ready For Testing to Closed
- Assignee set to Ohad Levy
- Target version set to 0.3
Updated by Corey Osman over 13 years ago
actually I just noticed that the puppet classids are being returned as integers instead of strings like they were being returned before the patch.
here is how they are returned now (notice the ids are integers:
{"puppet":[{"puppetclass":{"name":"puppet","id":13}}],"newops_default":[{"puppetclass":{"name":"newops_default","id":7}}],"helloworld":[{"puppetclass":{"name":"helloworld","id":1}}],"weblogic":[{"puppetclass":{"name":"weblogic","id":23}}],"baseapps":[{"puppetclass":{"name":"baseapps","id":4}}],"oraclebase":[{"puppetclass":{"name":"oraclebase","id":10}}],"oracleperformance":[{"puppetclass":{"name":"oracleperformance","id":11}}]}
Here is how I submit when I do an update: Notice the ids are strings:
Processing HostsController#update (for 192.168.11.28 at 2011-04-16 15:50:01) [PUT] Parameters: {"action"=>"update", "_method"=>"put", "id"=>"cobbler.logicminds.corp", "controller"=>"hosts", "host"=>{"puppetclass_ids"=>["10", "4", "23", "1", "7", "13", "11"]}} Completed in 24ms (View: 3, DB: 8) | 200 OK [http://192.168.11.8/hosts/cobbler.logicminds.corp]
Updated by Ohad Levy over 13 years ago
Corey Osman wrote:
actually I just noticed that the puppet classids are being returned as integers instead of strings like they were being returned before the patch.
here is how they are returned now (notice the ids are integers:
[...]
Here is how I submit when I do an update: Notice the ids are strings:
[...]
what happens if you send it as integers? afaik, rails doesn't care too much about it.