Discrepancy with YAML output VS APIv1(APIv2) output

Hey,

I'm seeing an issue in foreman (1.6.3) where host group parameters are
correctly passed via YAML but when I make a call to the API (both v1 or v2)
the parameters section only contains the parameters directly assigned to
the host.

i.e

YAML:

··· --- classes: base: parameters: puppetmaster: foreman.<> hostgroup: Base-S/Network-S/Security-S location: <> organization: <> root_pw: <> puppet_ca: foreman.<> foreman_env: staging owner_name: Admin User owner_email: chris.gibbs@<> ip: rdpport: '3389' sshport: '22' environment: staging

API:

{“name”:“svr10”,“id”:32,“ip”:null,“environment_id”:2,“environment_name”:“staging”,“last_report”:null,“mac”:“10:00:00:00:00:00”,“realm_id”:null,“realm_name”:null,“sp_mac”:null,“sp_ip”:null,“sp_name”:null,“domain_id”:1,“domain_name”:"<>",“architecture_id”:1,“architecture_name”:“x86_64”,“operatingsystem_id”:4,“operatingsystem_name”:“Windows 2008 R2”,“subnet_id”:1,“subnet_name”:“Provisioning”,“sp_subnet_id”:null,“ptable_id”:11,“ptable_name”:“Windows”,“medium_id”:9,“medium_name”:“Windows2008r2”,“build”:true,“comment”:"",“disk”:"",“installed_at”:null,“model_id”:null,“model_name”:null,“hostgroup_id”:9,“hostgroup_name”:“Base-S/Network-S/Security-S”,“owner_id”:3,“owner_type”:“User”,“enabled”:true,“puppet_ca_proxy_id”:1,“managed”:true,“use_image”:null,“image_file”:"",“uuid”:null,“compute_resource_id”:null,“compute_resource_name”:null,“compute_profile_id”:null,“compute_profile_name”:null,“capabilities”:[“build”],“provision_method”:“build”,“puppet_proxy_id”:1,“certname”:“svr10.<>”,“image_id”:null,“image_name”:null,“created_at”:“2014-12-08T00:50:11Z”,“updated_at”:“2014-12-08T00:50:11Z”,“last_compile”:null,“last_freshcheck”:null,“serial”:null,“source_file_id”:null,“puppet_status”:0,“organization_id”:2,“organization_name”:“Company”,“location_id”:8,“location_name”:"<>",“all_puppetclasses”:[{“id”:126,“name”:“base”,“module_name”:“sau_basepackages”}],“parameters”:[{“id”:266,“name”:“sshport”,“value”:“22”}],“interfaces”:[],“puppetclasses”:[],“config_groups”:[]}

Should I be recursively looking up the hostgroup for parameters that are applied there?

Kind of defeats the point as then i would also need to program the inheritance order of priority. Feature?

Forgot to point out that 'sshport' is being overridden on the host level
but 'rdpport' is from host group parameters.

··· On Monday, December 8, 2014 11:58:38 AM UTC+11, Chris Gibbs wrote: > > Hey, > > I'm seeing an issue in foreman (1.6.3) where host group parameters are > correctly passed via YAML but when I make a call to the API (both v1 or v2) > the parameters section only contains the parameters directly assigned to > the host. > > i.e > > YAML: > > --- > classes: > base: > parameters: > puppetmaster: foreman.<> > hostgroup: Base-S/Network-S/Security-S > location: <> > organization: <> > root_pw: <> > puppet_ca: foreman.<> > foreman_env: staging > owner_name: Admin User > owner_email: chris.gibbs@<> > ip: > rdpport: '3389' > sshport: '22' > environment: staging > > > > > API: > > {"name":"svr10","id":32,"ip":null,"environment_id":2,"environment_name":"staging","last_report":null,"mac":"10:00:00:00:00:00","realm_id":null,"realm_name":null,"sp_mac":null,"sp_ip":null,"sp_name":null,"domain_id":1,"domain_name":"<>","architecture_id":1,"architecture_name":"x86_64","operatingsystem_id":4,"operatingsystem_name":"Windows 2008 R2","subnet_id":1,"subnet_name":"Provisioning","sp_subnet_id":null,"ptable_id":11,"ptable_name":"Windows","medium_id":9,"medium_name":"Windows2008r2","build":true,"comment":"","disk":"","installed_at":null,"model_id":null,"model_name":null,"hostgroup_id":9,"hostgroup_name":"Base-S/Network-S/Security-S","owner_id":3,"owner_type":"User","enabled":true,"puppet_ca_proxy_id":1,"managed":true,"use_image":null,"image_file":"","uuid":null,"compute_resource_id":null,"compute_resource_name":null,"compute_profile_id":null,"compute_profile_name":null,"capabilities":["build"],"provision_method":"build","puppet_proxy_id":1,"certname":"svr10.<>","image_id":null,"image_name":null,"created_at":"2014-12-08T00:50:11Z","updated_at":"2014-12-08T00:50:11Z","last_compile":null,"last_freshcheck":null,"serial":null,"source_file_id":null,"puppet_status":0,"organization_id":2,"organization_name":"Company","location_id":8,"location_name":"<>","all_puppetclasses":[{"id":126,"name":"base","module_name":"sau_basepackages"}],"parameters":[{"id":266,"name":"sshport","value":"22"}],"interfaces":[],"puppetclasses":[],"config_groups":[]} > > > > Should I be recursively looking up the hostgroup for parameters that are applied there? > > > Kind of defeats the point as then i would also need to program the inheritance order of priority. Feature? > >

Yeah, this is working as designed, though I agree it's a real pain.
It's been fixed for Puppet class assignments by adding
"all_puppetclasses" to show where they're inherited through host or
config groups, but not yet for parameters.

I filed Feature #3220: API for "rendered" view of host parameters, taking into account inheritance - Foreman a while ago to track
it, but it hasn't been resolved yet.

··· On 08/12/14 00:58, Chris Gibbs wrote: > Hey, > > I'm seeing an issue in foreman (1.6.3) where host group parameters are > correctly passed via YAML but when I make a call to the API (both v1 or > v2) the parameters section only contains the parameters directly > assigned to the host. > > [snip] > Should I be recursively looking up the hostgroup for parameters that are applied there? > > > Kind of defeats the point as then i would also need to program the inheritance order of priority. Feature?


Dominic Cleal
Red Hat Engineering