Project

General

Profile

Actions

Feature #827

closed

add support for retrieving classes per host via the api

Added by Corey Osman almost 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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:

http://pastie.org/1776402

Actions #1

Updated by Ohad Levy almost 13 years ago

  • Status changed from New to Ready For Testing
  • % Done changed from 0 to 100
Actions #2

Updated by Ohad Levy almost 13 years ago

  • Status changed from Ready For Testing to Closed
  • Assignee set to Ohad Levy
  • Target version set to 0.3
Actions #3

Updated by Corey Osman almost 13 years ago

works great.

Actions #4

Updated by Corey Osman almost 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]

Actions #5

Updated by Ohad Levy almost 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.

Actions

Also available in: Atom PDF