Inconsistent behavior in puppet facts update in foreman api

Hi,

We can find an inconsistent behavior in getting the updated facts values on
invocation of “GET /api/hosts/:host_id/facts
<https://sdin-swt-at-02.sdcorp.global.sandisk.com/apidoc/v1/fact_values/index.html>”
Foreman API.

On execution of “puppet agent –test –tags <module_name>”, imports facts for
the node is not happening every time.

Below is the “foreman/production.log” where in the first execution of the
above command facts for the node is imported. On the other hand, in the
second run it didn’t.

First Run:

2016-07-13 18:57:53 [app] [I] Started GET
"/hosts/sdin-swt-at-24.sdcorp.global.sandisk.com/resources?range=7" for
10.65.228.193 at 2016-07-13 18:57:53 +0530

2016-07-13 18:57:53 [app] [I] Parameters: {"range"=>"7",
"id"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}

2016-07-13 18:58:56 [app] [I] Started GET
"/node/sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml" for
10.65.172.189 at 2016-07-13 18:58:56 +0530

2016-07-13 18:58:56 [app] [I] Parameters:
{"name"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}

2016-07-13 18:59:04 [app] [I] Parameters: {"facts"=>"[FILTERED]",
"name"=>"SDIN-SWT-AT-24.sdcorp.global.sandisk.com",
"certname"=>"sdin-swt-at-24.sdcorp.global.sandisk.com", "apiv"=>"v2",
:host=>{"name"=>"SDIN-SWT-AT-24.sdcorp.global.sandisk.com",
"certname"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}}

2016-07-13 18:59:04 [app] [I] Import facts for
'sdin-swt-at-24.sdcorp.global.sandisk.com' completed. Added: 2, Updated: 5,
Deleted 0 facts

2016-07-13 18:59:04 [app] [I] Started GET
"/node/sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml" for
10.65.172.189 at 2016-07-13 18:59:04 +0530

2016-07-13 18:59:04 [app] [I] Parameters:
{"name"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}

2016-07-13 18:59:34 [app] [I] processing report for
sdin-swt-at-24.sdcorp.global.sandisk.com

2016-07-13 18:59:34 [app] [I] Imported report for
sdin-swt-at-24.sdcorp.global.sandisk.com in 0.47 seconds

Second Run:

2016-07-13 18:59:44 [app] [I] Started GET
"/node/sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml" for
10.65.172.189 at 2016-07-13 18:59:44 +0530

2016-07-13 18:59:44 [app] [I] Parameters:
{"name"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}

2016-07-13 18:59:52 [app] [I] Parameters:
{"name"=>"SDIN-SWT-AT-24.sdcorp.global.sandisk.com",
"certname"=>"sdin-swt-at-24.sdcorp.global.sandisk.com",
"facts"=>"[FILTERED]", "apiv"=>"v2",
:host=>{"name"=>"SDIN-SWT-AT-24.sdcorp.global.sandisk.com",
"certname"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}}

2016-07-13 18:59:52 [app] [I] Started GET
"/node/sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml" for
10.65.172.189 at 2016-07-13 18:59:52 +0530

2016-07-13 18:59:52 [app] [I] Parameters:
{"name"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}

2016-07-13 19:00:04 [app] [I] processing report for
sdin-swt-at-24.sdcorp.global.sandisk.com

2016-07-13 19:00:04 [app] [I] Imported report for
sdin-swt-at-24.sdcorp.global.sandisk.com in 0.21 seconds

2016-07-13 19:05:03 [app] [I] Started GET
"/hosts/sdin-swt-at-24.sdcorp.global.sandisk.com/edit" for 10.65.228.193 at
2016-07-13 19:05:03 +0530

2016-07-13 19:05:03 [app] [I] Parameters:
{"id"=>"sdin-swt-at-24.sdcorp.global.sandisk.com"}

Again, in puppetdb logs, we observed that even though the facts are
replaced on each execution of “puppet agent –test –tags <module_name>” but,
the facts values on invocation of “GET /api/hosts/:host_id/facts
<https://sdin-swt-at-02.sdcorp.global.sandisk.com/apidoc/v1/fact_values/index.html>”
Foreman API was not updated inconsistently.

Can anybody suggest us the reason behind the inconsistent behavior?

Regards

Amrit

Hi,

I think it's the same issue as Stephen addressed recently in this PR
https://github.com/theforeman/foreman/pull/3615,
there was some ancient check (7 years is a long time:) no skip the imports
of facts when sent within 1 minute from the same
hosts.

– Ivan

··· On Wed, Jul 13, 2016 at 4:12 PM, Amrit Atmajit wrote:

Hi,

We can find an inconsistent behavior in getting the updated facts values
on invocation of “GET /api/hosts/:host_id/facts
https://sdin-swt-at-02.sdcorp.global.sandisk.com/apidoc/v1/fact_values/index.html
Foreman API.

On execution of “puppet agent –test –tags <module_name>”, imports facts
for the node is not happening every time.

Below is the “foreman/production.log” where in the first execution of the
above command facts for the node is imported. On the other hand, in the
second run it didn’t.

First Run:

2016-07-13 18:57:53 [app] [I] Started GET “/hosts/
sdin-swt-at-24.sdcorp.global.sandisk.com/resources?range=7” for
10.65.228.193 at 2016-07-13 18:57:53 +0530

2016-07-13 18:57:53 [app] [I] Parameters: {“range”=>“7”, “id”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”}

2016-07-13 18:58:56 [app] [I] Started GET “/node/
sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml” for 10.65.172.189 at
2016-07-13 18:58:56 +0530

2016-07-13 18:58:56 [app] [I] Parameters: {“name”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”}

2016-07-13 18:59:04 [app] [I] Parameters: {“facts”=>"[FILTERED]",
“name”=>“SDIN-SWT-AT-24.sdcorp.global.sandisk.com”, “certname”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”, “apiv”=>“v2”, :host=>{“name”=>“
SDIN-SWT-AT-24.sdcorp.global.sandisk.com”, “certname”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”}}

2016-07-13 18:59:04 [app] [I] Import facts for ‘
sdin-swt-at-24.sdcorp.global.sandisk.com’ completed. Added: 2, Updated:
5, Deleted 0 facts

2016-07-13 18:59:04 [app] [I] Started GET “/node/
sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml” for 10.65.172.189 at
2016-07-13 18:59:04 +0530

2016-07-13 18:59:04 [app] [I] Parameters: {“name”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”}

2016-07-13 18:59:34 [app] [I] processing report for
sdin-swt-at-24.sdcorp.global.sandisk.com

2016-07-13 18:59:34 [app] [I] Imported report for
sdin-swt-at-24.sdcorp.global.sandisk.com in 0.47 seconds

Second Run:

2016-07-13 18:59:44 [app] [I] Started GET “/node/
sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml” for 10.65.172.189 at
2016-07-13 18:59:44 +0530

2016-07-13 18:59:44 [app] [I] Parameters: {“name”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”}

2016-07-13 18:59:52 [app] [I] Parameters: {“name”=>“
SDIN-SWT-AT-24.sdcorp.global.sandisk.com”, “certname”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”, “facts”=>"[FILTERED]",
“apiv”=>“v2”, :host=>{“name”=>“SDIN-SWT-AT-24.sdcorp.global.sandisk.com”,
“certname”=>“sdin-swt-at-24.sdcorp.global.sandisk.com”}}

2016-07-13 18:59:52 [app] [I] Started GET “/node/
sdin-swt-at-24.sdcorp.global.sandisk.com?format=yml” for 10.65.172.189 at
2016-07-13 18:59:52 +0530

2016-07-13 18:59:52 [app] [I] Parameters: {“name”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”}

2016-07-13 19:00:04 [app] [I] processing report for
sdin-swt-at-24.sdcorp.global.sandisk.com

2016-07-13 19:00:04 [app] [I] Imported report for
sdin-swt-at-24.sdcorp.global.sandisk.com in 0.21 seconds

2016-07-13 19:05:03 [app] [I] Started GET “/hosts/
sdin-swt-at-24.sdcorp.global.sandisk.com/edit” for 10.65.228.193 at
2016-07-13 19:05:03 +0530

2016-07-13 19:05:03 [app] [I] Parameters: {“id”=>“
sdin-swt-at-24.sdcorp.global.sandisk.com”}

Again, in puppetdb logs, we observed that even though the facts are
replaced on each execution of “puppet agent –test –tags <module_name>” but,
the facts values on invocation of “GET /api/hosts/:host_id/facts
https://sdin-swt-at-02.sdcorp.global.sandisk.com/apidoc/v1/fact_values/index.html
Foreman API was not updated inconsistently.

Can anybody suggest us the reason behind the inconsistent behavior?

Regards

Amrit


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.