Most the attributes are getting "null" from /api/hosts Foreman API

Hi,

I am using two Puppet Servers, one is having the version as v3.8.7 and the
other is having version as v4.7.0.

In Puppet v3.8.7, hosts details In am getting from foreman API is:

Foreman API: https://<Puppet_Server_3.8.7>/api/hosts?per_page=99999

Response:

  {
  &quot;ip&quot;: &quot;10.65.229.45&quot;,                     
  &quot;environment_id&quot;: 1,
  &quot;environment_name&quot;: &quot;production&quot;,
  &quot;last_report&quot;: &quot;2016-07-27 09:59:20 UTC&quot;,
  &quot;mac&quot;: &quot;c4:d9:87:67:eb:bb&quot;,
  &quot;realm_id&quot;: null,
  &quot;realm_name&quot;: null,
   ...
   ...
   ...
  &quot;global_status&quot;: 0,
  &quot;global_status_label&quot;: &quot;Error&quot;,
  &quot;puppet_status&quot;: 0,
  &quot;model_name&quot;: &quot;Latitude E6440&quot;,
  &quot;configuration_status&quot;: 0,
  &quot;configuration_status_label&quot;: &quot;No reports&quot;,
  &quot;name&quot;: &quot;sdin803763.sdcorp.global.sandisk.com&quot;,
  &quot;id&quot;: 34
},

On the other hand, in Puppet v4.7.0, all hosts details In am getting from
foreman API is:

Foreman API: https://<Puppet_Server_4.7.0>/api/hosts?per_page=99999

Response:
{
"ip": null,
"environment_id": 1,
"environment_name": "production",
"last_report": "2016-11-21 05:34:01 UTC",
"mac": null,
"realm_id": null,
"realm_name": null,
"sp_mac": null,
"sp_ip": null,



"configuration_status_label": "Out of sync",
"name": "asus_n550j.cssvalidation.com",
"id": 7,
"hostgroup_name": null,
"hostgroup_title": null
},

As per the above highlighted attributes from Foreman APIs are fetched
properly in Puppet v3.8.7. On the other hand, most of the attributes are
fetched as "null" in Puppet v4.7.0.

But, these attributes are coming properly from the following Foreman API of
both the Puppet Servers.
Foreman API to get the fat_values:
https://<Both_Puppet_Server>/api/v2/fact_values?per_page=99999

Am I missing any configuration to be set in Puppet Server v4.7.0 to get the
proper attributes using "hosts" API?

Anybody please help me on this.

Thanks and Regards,
Amrit

What is logged by Foreman (production.log) when the Puppet agent runs?
It should log a fact upload, this may be partially failing to update the
IP/MAC on the hosts.

··· On 25/11/16 05:59, Amrit Atmajit wrote: > On the other hand, in Puppet v4.7.0, all hosts details In am getting > from foreman API is: > > Foreman API: *https:///api/hosts?per_page=99999* > * > * > Response: > { > "ip": null, > "environment_id": 1, > "environment_name": "production", > "last_report": "2016-11-21 05:34:01 UTC", > "mac": null, > "realm_id": null, > "realm_name": null, > "sp_mac": null, > "sp_ip": null, > ... > ... > ... > "configuration_status_label": "Out of sync", > "name": "asus_n550j.cssvalidation.com", > "id": 7, > "hostgroup_name": null, > "hostgroup_title": null > }, > > As per the above highlighted attributes from Foreman APIs are fetched > properly in Puppet v3.8.7. On the other hand, most of the attributes are > fetched as "null" in Puppet v4.7.0. > > But, these attributes are coming properly from the following Foreman API > of both the Puppet Servers. > Foreman API to get the > fat_values: *https:///api/v2/fact_values?per_page=99999*


Dominic Cleal
dominic@cleal.org