puppetdb_foreman icon indicating copy to clipboard operation
puppetdb_foreman copied to clipboard

Can't import host to foreman

Open amateo opened this issue 7 years ago • 7 comments

I'm trying this plugin. My puppetdb server is version 5.2.4. Dashboard is working and puppetdb nodes are displayed, but in this window, I can delete hosts, but I can't import them into foreman. When I try to import a host I get:

Failed to import host from PuppetDB: wrong number of arguments (given 1, expected 2)

I have foreman 1.16.0 and puppetdb plugin installed from packages (version 3.1.2-1). My configuration is:

  • puppetdb_address: https://puppetdb:8081/pdb/cmd/v1
  • puppetdb_dashboard_address: http://puppetdb:8080/pdb/dashboard/
  • puppetdb api version: v4

amateo avatar Jul 31 '18 07:07 amateo

@amateo: Thanks. Is there a way you can provide a full stack trace of the error maybe from the logs?

timogoebel avatar Jul 31 '18 08:07 timogoebel

How can I get it?

amateo avatar Jul 31 '18 08:07 amateo

@amateo: In /var/log/foreman/production.log

timogoebel avatar Jul 31 '18 08:07 timogoebel

This is the log while importing node:

2018-07-31T11:00:52 6e0a8699 [app] [I] Started PUT "/puppetdb_foreman/nodes/tapirus20.um.es/import" for 155.54.194.128 at 2018-07-31 11:00:52 +0200
2018-07-31T11:00:52 6e0a8699 [app] [I] Processing by PuppetdbForeman::NodesController#import as HTML
2018-07-31T11:00:52 6e0a8699 [app] [I]   Parameters: {"authenticity_token"=>"qouec2zXJd/NC8sQl2QGb46tWAk0L19pIMdFgYIa8HwaKJZFAXoO9G+rKSJAWwuxhK8uSp/L8FT0ym44gBFh3w==", "id"=>"tapirus20.um.es"}
2018-07-31T11:00:52 6e0a8699 [app] [I] Current user: amateo_adm (administrator)
2018-07-31T11:00:52 6e0a8699 [audit] [I] [tapirus20.um.es] deleted 0 (9.9ms)
2018-07-31T11:00:52 6e0a8699 [audit] [I] [tapirus20.um.es] updated 0 (0.7ms)
2018-07-31T11:00:54 6e0a8699 [audit] [I] [tapirus20.um.es] added 453 (2018.2ms)
2018-07-31T11:00:54 6e0a8699 [app] [I] Import facts for 'tapirus20.um.es' completed. Added: 453, Updated: 0, Deleted 0 facts
2018-07-31T11:00:57 6e0a8699 [app] [I] Redirected to https://foremantest.um.es/puppetdb_foreman/nodes
2018-07-31T11:00:57 6e0a8699 [app] [I] Completed 302 Found in 5072ms (ActiveRecord: 2822.3ms)
2018-07-31T11:00:57 c45bc55c [app] [I] Started GET "/notification_recipients" for 155.54.194.128 at 2018-07-31 11:00:57 +0200
2018-07-31T11:00:57 c45bc55c [app] [I] Processing by NotificationRecipientsController#index as JSON
2018-07-31T11:00:57 c45bc55c [app] [I] Current user: amateo_adm (administrator)
2018-07-31T11:00:57 c45bc55c [app] [I] Completed 200 OK in 5ms (Views: 0.1ms | ActiveRecord: 3.5ms)
2018-07-31T11:00:57 26f526d1 [app] [I] Started GET "/puppetdb_foreman/nodes" for 155.54.194.128 at 2018-07-31 11:00:57 +0200
2018-07-31T11:00:57 26f526d1 [app] [I] Processing by PuppetdbForeman::NodesController#index as HTML
2018-07-31T11:00:57 26f526d1 [app] [I] Current user: amateo_adm (administrator)
2018-07-31T11:00:57 26f526d1 [app] [I]   Rendered vendor/ruby/2.3.0/gems/puppetdb_foreman-3.1.2/app/views/puppetdb_foreman/nodes/index.html.erb within layouts/application (570.5ms)
2018-07-31T11:00:57 26f526d1 [app] [I]   Rendered layouts/_application_content.html.erb (0.4ms)
2018-07-31T11:00:57 26f526d1 [app] [I]   Rendered home/_user_dropdown.html.erb (1.6ms)
2018-07-31T11:00:57 26f526d1 [app] [I] Read fragment views/tabs_and_title_records-4 (0.1ms)
2018-07-31T11:00:57 26f526d1 [app] [I]   Rendered home/_topbar.html.erb (3.1ms)
2018-07-31T11:00:57 26f526d1 [app] [I]   Rendered layouts/base.html.erb (4.5ms)
2018-07-31T11:00:57 26f526d1 [app] [I] Completed 200 OK in 646ms (Views: 583.8ms | ActiveRecord: 10.8ms)
2018-07-31T11:00:58 a9638c57 [app] [I] Started GET "/javascripts/locale/en/app.js" for 155.54.194.128 at 2018-07-31 11:00:58 +0200
2018-07-31T11:00:58 a9638c57 [app] [F] 
 | ActionController::RoutingError (No route matches [GET] "/javascripts/locale/en/app.js"):
 |   lib/middleware/tagged_logging.rb:18:in `call'
 | 
 | 
2018-07-31T11:00:58 67caadd9 [app] [I] Started GET "/notification_recipients" for 155.54.194.128 at 2018-07-31 11:00:58 +0200
2018-07-31T11:00:58 67caadd9 [app] [I] Processing by NotificationRecipientsController#index as JSON
2018-07-31T11:00:58 67caadd9 [app] [I] Current user: amateo_adm (administrator)
2018-07-31T11:00:58 67caadd9 [app] [I] Completed 200 OK in 5ms (Views: 0.1ms | ActiveRecord: 3.5ms)

amateo avatar Jul 31 '18 09:07 amateo

It seems the node has been imported, and I can see it now in foreman.

amateo avatar Jul 31 '18 09:07 amateo

@amateo: I see, we should improve logging in the plugin so that we can actually find out what is wrong.

timogoebel avatar Jul 31 '18 09:07 timogoebel

I am having this same issue. I can import only one host to Foreman, and I noticed that the "certname" is always "puppet" instead the real certname. I changed it directly on database, and I could add another, but it is imported as "puppet". What can I do?

LeandroSalvas avatar Oct 18 '18 20:10 LeandroSalvas