Actions
Feature #25211
openImprove logging for smartclass/ENC failures
Status:
New
Priority:
Normal
Assignee:
-
Category:
External Nodes
Target version:
-
Description
Currently, when the ENC fails to render there is no contextual information in the logs about which class failed to generate data. With multiple users (or post upgrade) it can be challenging to determine which classes' settings are not being correctly generated.
For instance logging such as:
2018-10-15T15:59:07 ad704ead [app] [W] Failed to generate external nodes for myhost.com | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:34:in `puppetclass_parameters' | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:96:in `classes_info_hash' | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:11:in `host_info' | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:29:in `block in info' | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `each' | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `info' | /usr/share/foreman/app/controllers/hosts_controller.rb:206:in `block in externalNodes' | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/mime_responds.rb:195:in `respond_to' | /usr/share/foreman/app/controllers/hosts_controller.rb:202:in `externalNodes' | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action' | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
Instead, I propose a patch to try/catch each classes' rendering and log the result if it is not successful.
Something like...
2018-10-15T16:14:09 d4441af1 [app] [E] Smart class parameter rendering of `admins` on myhost.com failed: undefined method `host_param' for #<SafeRender:0x00007f992aee39f8> | Did you mean? to_param 2018-10-15T16:14:09 d4441af1 [app] [E] Smart class parameter rendering of `consul` on myhost.com failed: undefined method `host_param' for #<SafeRender:0x00007f992aee39f8> | Did you mean? to_param 2018-10-15T16:14:09 d4441af1 [app] [E] Smart class parameter rendering of `time` on myhost.com failed: undefined method `host_param' for #<SafeRender:0x00007f992aee39f8> | Did you mean? to_param 2018-10-15T16:14:09 d4441af1 [app] [W] Failed to generate external nodes for myhost.com | SomeRescueableRenderingError: Smart class parameter rendering failed for ["admins", "consul", "time"] | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:38:in `puppetclass_parameters' | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:100:in `classes_info_hash' | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:11:in `host_info' | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:29:in `block in info' | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `each' | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `info' | /usr/share/foreman/app/controllers/hosts_controller.rb:206:in `block in externalNodes'
I would love to see this data propagated to the HTML page generated, maybe with the exception message. But even just exposing this in the logs would be great.
Actions