Project

General

Profile

Actions

Bug #9185

closed

Deleting a network interface breaks all puppet agent syncing

Added by Mark Chaney about 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Ive tried this in 1.7.1 and 1.7.2, but if I delete a network interface in foreman, I can no longer sync any of my dedicated servers with the puppet agent. the odd thing though is that my lxc guests can sync just fine. This is the error i get:

############################

root@stor1:~# puppet agent -t --verbose
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 400 on SERVER: Failed to find stor1.cloud.foo.com via exec: Execution of '/etc/puppet/node.rb stor1.cloud.foo.com' returned 1: --- false
...
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed when searching for node stor1.cloud.foo.com: Failed to find stor1.cloud.myiacon.com via exec: Execution of '/etc/puppet/node.rb stor1.cloud.foo.com' returned 1: --- false
...
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

#############################

I have restored my system from backup multiple times with different scenarios and this is always the common thing that triggers it.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #9231: Exception message missing when ENC fails to renderClosedDavid Davis02/05/2015Actions
Actions #1

Updated by Mark Chaney about 9 years ago

Odd. I cant fix my post? not sure why its striking out some of my code.

Actions #2

Updated by Dominic Cleal about 9 years ago

  • Description updated (diff)
  • Status changed from New to Need more information

Could you provide logs from Foreman too? /var/log/foreman/production.log particularly when running the agent checkin.

Actions #3

Updated by Mark Chaney about 9 years ago

Dominic Cleal wrote:

Could you provide logs from Foreman too? /var/log/foreman/production.log particularly when running the agent checkin.

Started GET "/node/host4.cloud.example.com?format=yml" for 192.168.0.20 at 2015-02-05 03:26:49 -0600
Processing by HostsController#externalNodes as YML
  Parameters: {"name"=>"host4.cloud.example.com"}
Failed to generate external nodes for host4.cloud.example.com with
  Rendered text template (0.0ms)
Completed 412 Precondition Failed in 1549.8ms (Views: 115.7ms | ActiveRecord: 65.3ms)
Started POST "/api/hosts/facts" for 192.168.0.20 at 2015-02-05 03:26:54 -0600
Processing by Api::V2::HostsController#facts as JSON
  Parameters: {"facts"=>"[FILTERED]", "name"=>"host4.cloud.example.com", "certname"=>"host4.cloud.example.com", "apiv"=>"v2", :host=>{"name"=>"host4.cloud.example.com", "certname"=>"host4.cloud.example.com"}}
Import facts for 'host4.cloud.example.com' completed. Added: 0, Updated: 3, Deleted 0 facts
Completed 201 Created in 1000.9ms (Views: 100.0ms | ActiveRecord: 0.9ms)
Started GET "/node/host4.cloud.example.com?format=yml" for 192.168.0.20 at 2015-02-05 03:26:55 -0600
Processing by HostsController#externalNodes as YML
  Parameters: {"name"=>"host4.cloud.example.com"}
Failed to generate external nodes for host4.cloud.example.com with
  Rendered text template (0.0ms)
Completed 412 Precondition Failed in 183.3ms (Views: 0.6ms | ActiveRecord: 15.2ms)
Started POST "/api/reports" for 192.168.0.20 at 2015-02-05 03:26:55 -0600
Processing by Api::V2::ReportsController#create as JSON
  Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
processing report for host4.cloud.example.com
Failed to send email notification puppet_error_state: ERF42-5670 [Foreman::Exception]: unable to find recipients
Imported report for host4.cloud.example.com in 0.41 seconds
Completed 201 Created in 449.9ms (Views: 6.9ms | ActiveRecord: 0.0ms)

Actions #4

Updated by Mark Chaney about 9 years ago

If i generate a YAML report in Foreman, i get this in the production log:

Started GET "/hosts/host4.cloud.example.com/externalNodes?name=host4.cloud.example.com" for 10.8.0.6 at 2015-02-05 03:35:53 -0600
Processing by HostsController#externalNodes as HTML
Parameters: {"name"=>"host4.cloud.example.com", "id"=>"host4.cloud.example.com"}
No SSL cert with CN supplied - request from 10.8.0.6,
Failed to generate external nodes for host4.cloud.example.com with
Rendered text template (0.0ms)
Completed 412 Precondition Failed in 204.1ms (Views: 0.6ms | ActiveRecord: 13.4ms)

Actions #5

Updated by Mark Chaney about 9 years ago

OK, so I edited /usr/share/foreman/app/controllers/hosts_controller.rb with debug info as directed by Dominic in IRC. First response is when I try to view the YAML report, the second is when i do a puppet sync.

Connecting to database specified by database.yml
Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
Fog is not installed - unable to manage compute resources
Fog is not installed - unable to manage compute resources
Started GET "/hosts/host4.cloud.example.com/externalNodes?name=host4.cloud.example.com" for 10.8.0.6 at 2015-02-05 03:43:37 -0600
Processing by HostsController#externalNodes as HTML
  Parameters: {"name"=>"host4.cloud.example.com", "id"=>"host4.cloud.example.com"}
No SSL cert with CN supplied - request from 10.8.0.6,
Failed to generate external nodes for host4.cloud.example.com with undefined method `gateway' for nil:NilClass
  Rendered text template (0.0ms)
Completed 412 Precondition Failed in 1725.3ms (Views: 136.3ms | ActiveRecord: 51.8ms)

Started GET "/node/host4.cloud.example.com?format=yml" for 192.168.0.20 at 2015-02-05 03:44:11 -0600
Processing by HostsController#externalNodes as YML
  Parameters: {"name"=>"host4.cloud.example.com"}
Failed to generate external nodes for host4.cloud.example.com with undefined method `gateway' for nil:NilClass
  Rendered text template (0.0ms)
Completed 412 Precondition Failed in 222.8ms (Views: 0.7ms | ActiveRecord: 18.5ms)
Started POST "/api/hosts/facts" for 192.168.0.20 at 2015-02-05 03:44:13 -0600
Processing by Api::V2::HostsController#facts as JSON
  Parameters: {"facts"=>"[FILTERED]", "name"=>"host4.cloud.example.com", "certname"=>"host4.cloud.example.com", "apiv"=>"v2", :host=>{"name"=>"host4.cloud.example.com", "certname"=>"host4.cloud.example.com"}}
Import facts for 'host4.cloud.example.com' completed. Added: 0, Updated: 5, Deleted 0 facts
Completed 201 Created in 1569.6ms (Views: 18.7ms | ActiveRecord: 0.7ms)
Started GET "/node/host4.cloud.example.com?format=yml" for 192.168.0.20 at 2015-02-05 03:44:15 -0600
Processing by HostsController#externalNodes as YML
  Parameters: {"name"=>"host4.cloud.example.com"}
Failed to generate external nodes for host4.cloud.example.com with undefined method `gateway' for nil:NilClass
  Rendered text template (0.0ms)
Completed 412 Precondition Failed in 182.5ms (Views: 0.6ms | ActiveRecord: 14.0ms)
Started POST "/api/reports" for 192.168.0.20 at 2015-02-05 03:44:16 -0600
Processing by Api::V2::ReportsController#create as JSON
  Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
processing report for host4.cloud.example.com
Failed to send email notification puppet_error_state: ERF42-5670 [Foreman::Exception]: unable to find recipients
Imported report for host4.cloud.example.com in 0.3 seconds
Completed 201 Created in 425.7ms (Views: 90.2ms | ActiveRecord: 0.0ms)
Actions #6

Updated by Dominic Cleal about 9 years ago

  • Related to Bug #9231: Exception message missing when ENC fails to render added
Actions #7

Updated by Dominic Cleal about 9 years ago

  • Status changed from Need more information to Resolved

The error "undefined method `gateway' for nil:NilClass" indicated that a parameter, which contained:

<%= @host.interfaces.managed.first.subnet.gateway %>

Was trying to call gateway when there was no subnet assigned to the first interface. Changing it to ... subnet.try(:gateway) may handle the empty subnet correctly (I'm unsure if this works in safemode).

Actions #8

Updated by Marek Hulán about 9 years ago

For safemode we could use subnet.respond_to?(:gateway)

Actions

Also available in: Atom PDF