Bug #849
closeddata structure from api puppetclasses call is too complex
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.
Updated by Ohad Levy about 14 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}}]
Updated by Corey Osman about 14 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