Project

General

Profile

Bug #2967

Foreman is randomly missing certain facts

Added by Anders Sveen over 5 years ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

I have set up Foreman with ENC integration and pushing facts with the script at https://github.com/theforeman/puppet-foreman/blob/master/templates/external_node.rb.erb . After activating this I could see that facts were coming in and I could query. We currently have 8 hosts running.

If I do a query for facts "name = puppetversion" 8 hosts and their values shows up. This seems to return the correct number of hosts all the time.

If I do a query for facts "name = memoryfree" it usually displays something between 4 and 6 hosts. Only rarely do I see 8 hosts. The number and which hosts that show up vary over time.

This behavior is consistent across two different deployments of Foreman I have. They are installed with yum on RHEL6 systems. I'm currently running on SQLite3. Anothe reporter (see mail thread below) is running Postgres.

Production log for foreman:

Started POST "/fact_values/create?format=yml" for 127.0.0.1 at 2013-08-23 03:35:24 +0200
Processing by FactValuesController#create as YML
  Parameters: {"facts"=>"[FILTERED]"}
  Rendered text template (0.0ms)
Completed 200 OK in 92ms (Views: 0.8ms | ActiveRecord: 50.0ms)

See the following mail thread for some history and another reporter having the same issue: https://groups.google.com/forum/#!topic/foreman-users/KQ-YxXLuLDA

Associated revisions

Revision fb68fd22 (diff)
Added by Ohad Levy over 5 years ago

[REFACTOR] fixes #2967 - refactored Fact Importer

Based on Dmitri Dolguikh <> original patch.

- renamed original fact_importer class to fact_parser class
- moved fact handling logic to its own fact_importer class
- fact importer now assumes single-value facts
- added a uniqueness constraint on fact_values table on fact_name_id and host_id
- added tests

Revision f3f86a3a (diff)
Added by Ohad Levy over 5 years ago

refs #2967 fact deleted counters did not propagate correctly.

Revision a51ed475 (diff)
Added by Ohad Levy over 5 years ago

[REFACTOR] fixes #2967 - refactored Fact Importer

Based on Dmitri Dolguikh <> original patch.

- renamed original fact_importer class to fact_parser class
- moved fact handling logic to its own fact_importer class
- fact importer now assumes single-value facts
- added a uniqueness constraint on fact_values table on fact_name_id and host_id
- added tests

(cherry picked from commit fb68fd22a05a5b949d9313db59168d69efb14ad8)

Conflicts:
app/models/host/base.rb

Revision 77d584b6 (diff)
Added by Ohad Levy over 5 years ago

refs #2967 fact deleted counters did not propagate correctly.

(cherry picked from commit f3f86a3a712224963ceff34613f86e11f07ecb66)

History

#1 Updated by Anders Sveen over 5 years ago

The values seems to be missing in the database:

sqlite> select fact_values.* from fact_values inner join fact_names on fact_names.id=fact_values.fact_name_id where fact_names.name='memoryfree';
16612|33.11 GB|17|8|2013-08-27 11:29:43.404051|2013-08-27 11:29:43.404051
16690|29.20 GB|17|7|2013-08-27 13:05:25.528203|2013-08-27 13:05:25.528203

Should give 8 entries.

#2 Updated by Ohad Levy over 5 years ago

  • Assignee set to Ohad Levy
  • Target version set to 1.15.0

#3 Updated by Anders Sveen over 5 years ago

Upgraded to 1.3.1 and replaced scripts according to instructions for the 1.3 release. I also switched to MySQL and still seeing the same behaviour. :)

#4 Updated by Ohad Levy over 5 years ago

Anders Sveen wrote:

Upgraded to 1.3.1 and replaced scripts according to instructions for the 1.3 release. I also switched to MySQL and still seeing the same behaviour. :)

Are you willing to try https://github.com/theforeman/foreman/pull/975, I'm unable to reproduce the issue after this patch.

#5 Updated by Ohad Levy over 5 years ago

  • Status changed from New to Ready For Testing

#6 Updated by Ohad Levy over 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#7 Updated by Dominic Cleal over 5 years ago

  • Legacy Backlogs Release (now unused) set to 1

#8 Updated by Anders Sveen over 5 years ago

Ohad Levy wrote:

Anders Sveen wrote:

Upgraded to 1.3.1 and replaced scripts according to instructions for the 1.3 release. I also switched to MySQL and still seeing the same behaviour. :)

Are you willing to try https://github.com/theforeman/foreman/pull/975, I'm unable to reproduce the issue after this patch.

I can try that, but not quite sure how to do it. :) I'm running off rpm packages via yum (foreman-1.3.0-1.el6.noarch). What would be the best way to apply this patch and make rollback easy?

Anders,

#9 Updated by Ohad Levy over 5 years ago

this is already part of the 1.3.1 release, if you prefer to wait, I assume next Monday it would be released.

#10 Updated by Anders Sveen over 5 years ago

Ohad Levy wrote:

this is already part of the 1.3.1 release, if you prefer to wait, I assume next Monday it would be released.

Alright, I'll wait and verify with the 1.3.1 release. :) Thanks.

Also available in: Atom PDF