Project

General

Profile

Actions

Bug #22130

open

some question about chef-handler-foreman

Added by snow snow over 6 years ago. Updated over 6 years ago.

Status:
Need more information
Priority:
Normal
Assignee:
Category:
chef-handler-foreman
Target version:
-
Difficulty:
hard
Triaged:
Fixed in Releases:
Found in Releases:

Description

Question 01:
According to this url, I installed the remote plug-in, but I did not see those two job template.
https://www.theforeman.org/plugins/foreman_chef/0.6/index.html#4.8Runlistmanagement

Question 02:
The names of the two options in the red box are the same "Run chef-client Once"

Question 03:
How do I develop a role or recipe to run chefl-client remotely? Is it a way to define a job templete?

Release:
tfm-rubygem-foreman_setup-5.0.0-1.fm1_13.el7.noarch
foreman-release-1.16.0-1.el7.noarch
tfm-rubygem-foreman-tasks-0.10.0-2.fm1_16.el7.noarch
tfm-rubygem-foreman_chef-0.6.0-1.fm1_16.el7.noarch
tfm-rubygem-foreman_remote_execution_core-1.0.5-1.fm1_16.el7.noarch
foreman-1.16.0-1.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.11.0-1.el7.noarch
foreman-selinux-1.16.0-1.el7.noarch
foreman-release-scl-3-1.el7.noarch
foreman-debug-1.16.0-1.el7.noarch
foreman-postgresql-1.16.0-1.el7.noarch
tfm-rubygem-foreman-tasks-core-0.2.0-1.fm1_16.el7.noarch
foreman-cli-1.16.0-1.el7.noarch
foreman-installer-1.16.0-1.el7.noarch
tfm-rubygem-foreman_remote_execution-1.3.3-1.fm1_16.el7.noarch
foreman-proxy-1.16.0-1.el7.noarch

[root@foreman settings.d]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)


Files

01.png View 01.png 16.1 KB snow snow, 01/03/2018 10:34 AM
02.png View 02.png 36.6 KB snow snow, 01/03/2018 11:29 AM
03.png View 03.png 36.5 KB snow snow, 01/03/2018 11:32 AM
01.png View 01.png 21.3 KB snow snow, 01/04/2018 09:19 AM
02.png View 02.png 20.9 KB snow snow, 01/04/2018 09:22 AM
Actions #1

Updated by snow snow over 6 years ago


2018-01-03 19:27:56 56e7678a [app] [W] Action failed
ActionView::MissingTemplate: Missing template remote_execution_features/edit, application/edit with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :rabl]}. Searched in:
* "/usr/share/foreman/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.3/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_chef-0.6.0/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.0/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_setup-5.0.0/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.4/app/views"
Actions #2

Updated by snow snow over 6 years ago



2018-01-03 19:27:56 56e7678a [app] [W] Action failed
ActionView::MissingTemplate: Missing template remote_execution_features/edit, application/edit with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :rabl]}. Searched in:
* "/usr/share/foreman/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.3/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_chef-0.6.0/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.0/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_setup-5.0.0/app/views"
* "/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.4/app/views"
Actions #3

Updated by Marek Hulán over 6 years ago

  • Status changed from New to Need more information
  • Priority changed from High to Normal

That seems like a remote execution bug, but it probably happens only if the feature can't be saved for some reason. Could you please enable debug log level, restart Foreman, capture production.log while you submit the form and upload it here?

Also I see you've chosen "Run chef-client once" but you should choose "Run chef-client wrapper" which does not require any user inputs.

Actions #4

Updated by Marek Hulán over 6 years ago

Question 01:
According to this url, I installed the remote plug-in, but I did not see those two job template.
https://www.theforeman.org/plugins/foreman_chef/0.6/index.html#4.8Runlistmanagement

pls try running foreman-rake db:seed, the foreman-installer should do it for you, it seems that didn't happen for some reason

Question 02:
The names of the two options in the red box are the same "Run chef-client Once"

that seems as some kind of a bug, I haven't seen this, what do you see as list of the features in Adminitration -> Remote execution features?

Question 03:
How do I develop a role or recipe to run chefl-client remotely? Is it a way to define a job templete?

yes, but you should not need to do it, foreman_chef should provide job templates by default, you can find their code at https://github.com/theforeman/foreman_chef/tree/master/app/views/job_templates

Updated by snow snow over 6 years ago

Marek Hulán wrote:

That seems like a remote execution bug, but it probably happens only if the feature can't be saved for some reason. Could you please enable debug log level, restart Foreman, capture production.log while you submit the form and upload it here?

Also I see you've chosen "Run chef-client once" but you should choose "Run chef-client wrapper" which does not require any user inputs.

There are two called "foreman_chef_run_chef_client", I chose the first one to perform the following operation

Here is the error log that I have submitted

@
2018-01-04 17:24:10 5b50ebcb [app] [I] Started PATCH "/remote_execution_features/foreman_chef_run_chef_client" for 192.168.10.1 at 2018-01-04 17:24:10 +0800
2018-01-04 17:24:10 5b50ebcb [app] [I] Processing by RemoteExecutionFeaturesController#update as HTML
2018-01-04 17:24:10 5b50ebcb [app] [I] Parameters: {"utf8"=>"✓", "authenticity_token"=>"L0y/tSCF1JVMAd0zFNnYUzKJOr9+wHdwaNsrcMAjFRIGUOSsqieLdCmNQdsK08wenLV1XXuLSgex4w9sR48PTA==", "remote_execution_feature"=>{"job_template_id"=>"109"}, "commit"=>"Submit", "id"=>"foreman_chef_run_chef_client"}
2018-01-04 17:24:10 5b50ebcb [app] [I] Current user: admin (administrator)
2018-01-04 17:24:10 5b50ebcb [app] [D] Setting current user thread-local variable to admin
2018-01-04 17:24:10 5b50ebcb [app] [D] Unpermitted parameters: utf8, _method, authenticity_token, commit, id, locale
2018-01-04 17:24:11 5b50ebcb [app] [I] Failed to save: Label has already been taken, Name has already been taken
2018-01-04 17:24:11 5b50ebcb [app] [W] Action failed | ActionView::MissingTemplate: Missing template remote_execution_features/edit, application/edit with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :rabl]}. Searched in: | * "/usr/share/foreman/app/views" | * "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.3/app/views" | * "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_chef-0.6.0/app/views" | * "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.0/app/views" | * "/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_setup-5.0.0/app/views" | * "/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.4/app/views" | | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/path_set.rb:46:in `find' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/lookup_context.rb:121:in `find' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/abstract_renderer.rb:18:in `find_template' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:40:in `determine_template' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:8:in `render' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:46:in `render_template' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:27:in `render' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:100:in `_render_template' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/streaming.rb:217:in `_render_template' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:83:in `render_to_body' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:32:in `render_to_body' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/renderers.rb:37:in `render_to_body' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/rendering.rb:25:in `render' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:16:in `render' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms' | /opt/rh/rh-ruby22/root/usr/share/ruby/benchmark.rb:303:in `realtime' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/core_ext/benchmark.rb:12:in `ms' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:43:in `render' | /usr/share/foreman/app/controllers/application_controller.rb:307:in `process_error' | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.3/app/controllers/remote_execution_features_controller.rb:15:in `update' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/base.rb:198:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:10:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:in `block in make_lambda' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `block in halting' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `block in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:in `block in make_lambda' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `block in halting' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `block in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:in `block in make_lambda' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `block in halting' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `block in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/sweeper.rb:14:in `around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:455:in `public_send' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:455:in `block in make_lambda' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in `block in halting' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `block in around' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:81:in `run_callbacks' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/callbacks.rb:19:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rescue.rb:29:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `block in instrument' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `instrument' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/base.rb:137:in `process' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:30:in `process' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal.rb:196:in `dispatch' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal.rb:237:in `block in action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/route_set.rb:74:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/route_set.rb:74:in `dispatch' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/route_set.rb:43:in `serve' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/journey/router.rb:43:in `block in serve' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/journey/router.rb:30:in `each' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/journey/router.rb:30:in `serve' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/route_set.rb:815:in `call' | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.4/lib/apipie/static_dispatcher.rb:65:in `call' | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.4/lib/apipie/extractor/recorder.rb:136:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/static.rb:116:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/static.rb:116:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/static.rb:116:in `call' | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.4/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/etag.rb:24:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/conditionalget.rb:38:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/head.rb:13:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call' | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/flash.rb:260:in `call' | /usr/share/foreman/lib/middleware/session_safe_logging.rb:17:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/session/abstract/id.rb:225:in `context' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/session/abstract/id.rb:220:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/cookies.rb:560:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/query_cache.rb:36:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:88:in `__run_callbacks__' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_call_callbacks' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:81:in `run_callbacks' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/remote_ip.rb:78:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:38:in `call_app' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:22:in `call' | /opt/theforeman/tfm/root/usr/share/gems/gems/sprockets-rails-3.2.0/lib/sprockets/rails/quiet_assets.rb:13:in `call' | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/request_id.rb:21:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/methodoverride.rb:22:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/runtime.rb:18:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/static.rb:116:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/sendfile.rb:113:in `call' | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-3.4.1/lib/secure_headers/middleware.rb:12:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:518:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/application.rb:165:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/railtie.rb:194:in `public_send' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/railtie.rb:194:in `method_missing' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/urlmap.rb:66:in `block in call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/urlmap.rb:50:in `each' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/urlmap.rb:50:in `call' | /usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request' | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request' | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop' | /usr/share/passenger/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads' | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `call' | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
2018-01-04 17:24:11 5b50ebcb [app] [I] Rendered common/500.html.erb within layouts/application (45.1ms)
2018-01-04 17:24:11 5b50ebcb [app] [I] Rendered layouts/_application_content.html.erb (0.8ms)
2018-01-04 17:24:11 5b50ebcb [app] [I] Rendered layouts/base.html.erb (3.2ms)
2018-01-04 17:24:11 5b50ebcb [app] [I] Completed 500 Internal Server Error in 188ms (Views: 55.6ms | ActiveRecord: 21.1ms)
@

Actions #6

Updated by snow snow over 6 years ago

Hello Marek Hulán, thanks for the help these days, and I'm from China. Do you know that there is a chat software called WeChat? If you are also using the two of us can add a friend, ha ha.

Actions #7

Updated by Marek Hulán over 6 years ago

Ok, the feature got duplicated in your DB for some reason causing these issues. Try following:

foreman-rake console
RemoteExecutionFeature.where(:label => 'foreman_chef_run_chef_client').first.destroy
exit

that should delete the feature and assigning the template should no longer cause problems.

Sorry, I prefer redmine as my social network for resolving issues :-) That way other users hitting the same issue can find the solution.

Actions #8

Updated by snow snow over 6 years ago

  • Subject changed from some question about foreman_chef and foreman_remote_execution to some question about chef-handler-foreman
  • Category changed from foreman_chef to chef-handler-foreman
  • Difficulty set to hard

Dear Marek:
I downloaded a zip archive from https://github.com/theforeman/chef-handler-foreman/ and then used the gem build && / opt / chef / embedded / bin / gem install chef_handler_foreman-0.2.0.gem Installed, and in the foreman_enc_fetcher.rb before modifying the contents of "/ api / hosts / # {client_name} / enc", because I found this is wrong. But after running chef-client or error, the error is as follows, can help me? Thank you.

[2018-01-21T18:21:34+08:00] ERROR: Report handler ChefHandlerForeman::ForemanFacts raised #<Encoding::UndefinedConversionError: "\xE7" from ASCII-8BIT to UTF-8>
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef_handler_foreman-0.2.0/lib/chef_handler_foreman/foreman_uploader.rb:50:in `encode'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef_handler_foreman-0.2.0/lib/chef_handler_foreman/foreman_uploader.rb:50:in `to_json'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef_handler_foreman-0.2.0/lib/chef_handler_foreman/foreman_uploader.rb:50:in `foreman_request'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef_handler_foreman-0.2.0/lib/chef_handler_foreman/foreman_facts.rb:118:in `send_attributes'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef_handler_foreman-0.2.0/lib/chef_handler_foreman/foreman_facts.rb:26:in `report'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/handler.rb:226:in `run_report_unsafe'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/handler.rb:214:in `run_report_safely'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/handler.rb:118:in `block in run_exception_handlers'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/handler.rb:117:in `each'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/handler.rb:117:in `run_exception_handlers'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/handler.rb:127:in `block in <class:Handler>'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/client.rb:450:in `call'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/client.rb:450:in `block in run_failed'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/client.rb:449:in `each'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/client.rb:449:in `run_failed'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/client.rb:311:in `rescue in run'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/client.rb:318:in `run'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application.rb:285:in `block in fork_chef_client'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application.rb:273:in `fork'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application.rb:273:in `fork_chef_client'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application.rb:238:in `block in run_chef_client'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/local_mode.rb:44:in `with_server_connectivity'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application.rb:226:in `run_chef_client'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application/client.rb:456:in `sleep_then_run_chef_client'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application/client.rb:443:in `block in interval_run_chef_client'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application/client.rb:442:in `loop'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application/client.rb:442:in `interval_run_chef_client'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application/client.rb:426:in `run_application'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/lib/chef/application.rb:58:in `run'
[2018-01-21T18:21:34+08:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.9.38/bin/chef-client:26:in `<top (required)>'
[2018-01-21T18:21:34+08:00] ERROR: /usr/bin/chef-client:51:in `load'
[2018-01-21T18:21:34+08:00] ERROR: /usr/bin/chef-client:51:in `<main>'
- ChefHandlerForeman::ForemanFacts
Running handlers complete
[2018-01-21T18:21:34+08:00] ERROR: Exception handlers complete
Chef Client failed. 1 resources updated in 20 seconds
[2018-01-21T18:21:34+08:00] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
[2018-01-21T18:21:34+08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-01-21T18:21:34+08:00] ERROR: 403 "Forbidden"
[2018-01-21T18:21:34+08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

@log_location STDOUT
log_level :info
file_backup_path "/var/lib/chef"
file_cache_path "/var/cache/chef"
pid_file "/var/run/chef/client.pid"
node_name "macd4ae52e8bfb7.jbaidu.com"
json_attribs "/etc/chef/nodeattr.json"
environment "prod_bj02"
chef_server_url "https://chefserver.jbaidu.com/organizations/jbaidu"
validation_client_name "jbaidu-validator"
  1. Using default node name (fqdn)
    trusted_certs_dir "/etc/chef/trusted_certs"
    encrypted_data_bag_secret "/etc/chef/data_bag_secret_key.pem"
  1. this adds new functions to chef configuration
    require 'chef_handler_foreman'
  2. here you can specify your connection options
    #foreman_server_options :url => 'http://foreman.jbaidu.com'
  3. Or another option to set URL if using chef-client cookbook config option
    foreman_server_url 'https://foreman.jbaidu.com'
  4. add following line if you want to upload node attributes (facts in Foreman language)
    foreman_facts_upload true
    1. Facts whitelist / blacklisting
    2. add following line if you want to upload only specific node attributes - only top-level attributes
      #foreman_facts_whitelist ['lsb','network','cpu']
    3. add following line if you want to avoid uploading specific node attributes - any part from the key will do
      ##foreman_facts_blacklist ['kernel','counters','interfaces::sit0']
      #foreman_facts_blacklist ['flags']
    4. enable caching of attributes - (full) upload will be performed only if attributes changed
      #foreman_facts_cache_file '/var/cache/chef_foreman_cache.md5'
    5. add following line if you want to upload reports
      #foreman_reports_upload true
    6. add following line to manage reports verbosity. Allowed values are debug, notice and error
      #reports_log_level "notice"
    7. add following line to load additional attributes from Foreman
      #foreman_enc true
    8. to configure the level of attributes coming from Foreman you can set a second argument like this
      ##foreman_enc true, 'default'
      @
Actions

Also available in: Atom PDF