Chef plugin chef_handler_foreman facts uploard

Hello,

I am using Foreman server version 1.19.0 with chef_handler_foreman installed on my chef client. I use Foreman to get the report and all my client information.

When the facts are upload I got an error in /var/log/foreman/production.log:

2018-09-14T15:57:36 [W|app|836a7] Action failed
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  missing FROM-clause entry for table "fact_names"
LINE 1: SELECT fact_names.name FROM "fact_values" WHERE "fact_values...
. . .

The host is created and I can see the report but it seems there is an issue to upload the facts.

Is anybody get an idea to fix that?

Best,

https://projects.theforeman.org/issues/24108

it seems an issue is resolved but for salt.

found for Chef Bug #24786: Mysql2::Error: Unknown column 'fact_names.name' when importing facts. - Chef - Foreman

need to wait for the merge request. (or maybe I should use a previous version)

Hi,

I’m the reporter of the chef-issue 24789, and i’m running with my own PR from that issue in production and it works. However it depends a bit on your setup, i also use foreman-tasks, plus use mysql, not pg.

If you feel adventurous you could try yourself, but i make no guarantees that it will work for you.
https://github.com/bjozet/foreman_chef/commit/9ae207462b61551d898e1962835a57b45876857c
If you’re using foreman-tasks you might also require https://raw.githubusercontent.com/theforeman/foreman-tasks/4aa960623bfb19dff930b96efcf23bab7019a90b/app/lib/actions/foreman/host/import_facts.rb

Your mileage might vary :slight_smile:

Hi @bjozet,

Thanks for your answer, I had a look at your code changes if there is no merge soon I probably will manually change and apply that on my server (no risk we are is testing mode)

I will keep on eye on the bug ticket.

Best,

Oh, you know what, please proceed with some caution. I just realized that I’m hitting another fault when using my own patch, that I need adress.

Not sure if they’re because of my changes or if there are additional fixing that needs to be done due to fact-refactoring. I’ll update the bugreport with findings when i know more.

ok thanks for that, I will try to install an older version to see if I experience the same issue. I don’t mind to don’t run on the lastest version.