Project

General

Profile

Bug #849

data structure from api puppetclasses call is too complex

Added by Corey Osman over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

I am not sure why the json code returned from http://foreman/hosts/fqdn/puppetclasses has to be so complex. Is it possible to just return something like the following

{"puppetclasses":[{"name":"puppet","id":13},{"name":"newops_default","id":7},{"name":"helloworld","id":1},{"name":"baseapps","id":4}]}

This following seems to make more sense as it contains less overhead.

Here is what the api returns as of now:


{"puppet":[{"puppetclass":{"name":"puppet","id":13}}],"newops_default":[{"puppetclass":{"name":"newops_default","id":7}}],"helloworld":[{"puppetclass":{"name":"helloworld","id":1}}],"baseapps":[{"puppetclass":{"name":"baseapps","id":4}}],"oraclebase":[{"puppetclass":{"name":"oraclebase","id":10}}]}

I just don't see the need to have a hash where the value is an array that contains a hash where the value is a hash with key/value pairs.

History

#1 Updated by Ohad Levy over 11 years ago

  • Status changed from New to Feedback

it seems you are not using puppet modules...

for example, if you were using a module, the output would be:

"apache2":[{"puppetclass":{"name":"apache2::common","id":33}},{"puppetclass":{"name":"apache2::webalizer","id":37}}]

#2 Updated by Corey Osman over 11 years ago

I am using modules. However, the class name inside the init.pp located inside the module has the same name of the module name in most cases. So from you are saying the data structure looks like this:

module name
---->puppetclass
-------->name:classname
-------->id: id of class
---->puppetclass
-------->name:classname
-------->id: id

Well that makes more sense if your looking at it from a module level

#3 Updated by Ohad Levy over 11 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF