Can't import Puppet classes after update

I have no /etc/foreman/logging.yaml but I have finded /usr/share/foreman/config/logging.yaml which contain:

:default:
:colorize: false
:console_inline: false
:log_trace: false
:level: info
:type: file
:layout: multiline_request_pattern
:json_items:
- logger
- timestamp
- level
- message
- mdc
- ndc
:pattern: “%d [%.1l|%.3c|%.8X{request}] %m\n”
:sys_pattern: “%m\n”
:facility: LOG_LOCAL6

But I’m still getting the warning “Logging layout is not multiline_request_pattern.”

Looks like it is defined in /etc/foreman/settings.yaml for systems configured by the installer

Indeed, but run foreman-installer --foreman-logging-layout didn’t update this setting.

I noticed this error during foreman-installer was running:

Upgrade Step 2/3: katello:correct_puppet_environments. This may take a long while.
Processing Puppet Environment 1/9: 1-Affichage_Centos_8-v1_0-puppet-a7d90fab-abf5-4b2e-be06-38fd4528a0a0 (1)
Content View Puppet Environment 1 Missing, Creating.
Failed upgrade task: katello:correct_puppet_environments, see logs for more information.

Any idea how can i manage this?

you need to give it a parameter, foreman-installer --foreman-logging-layout=multiline_request_pattern

I’m not sure about this one, perhaps one of the @katello team will know?

1 Like

@GC29 there’s very likely a stack trace in /var/log/foreman/production.log for that - can you share it here?

I found this:

# cat production.log | grep 1-Affichage_Centos_8-v1_0-puppet-a7d90fab-abf5-4b2e-be06-38fd4528a0a0
2021-02-17T11:11:54 [I|kat|] GET: https://myserver.domain/pulp/api/v2/repositories/1-Affichage_Centos_8-v1_0-puppet-a7d90fab-abf5-4b2e-be06-38fd4528a0a0/?: {"content_type"=>"appli
404 Not Found: {"http_request_method": "GET", "exception": null, "error_message": "Missing resource(s): repository=1-Affichage_Centos_8-v1_0-puppet-a7d90fab-abf5-4b2e-be06-38fd4528antos_8-v1_0-puppet-a7d90fab-abf5-4b2e-be06-38fd4528a0a0/?", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"repository": "1-Affichage_Centos_8-v1_0-puppet-aMissing resource(s): repository=1-Affichage_Centos_8-v1_0-puppet-a7d90fab-abf5-4b2e-be06-38fd4528a0a0", "sub_errors": []}, "traceback": null, "resources": {"repository": "1-Affichag0a0"}}

But I have no repository called “Affichage Centos 8” it’s my content-view name for CentOS 8 client.

# hammer content-view list
----------------|---------------------------|---------------------------|-----------|---------------------|----------------------------------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|----------------------------------------------
3               | Affichage Centos 7        | Affichage_Centos_7        | false     | 2021/02/11 12:58:50 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
2               | Affichage Centos 8        | Affichage_Centos_8        | false     | 2021/02/11 13:11:16 | 1, 3, 5, 6, 4, 8, 2, 112, 123, 124
5               | Affichage Ubuntu 20.04    | Affichage_Ubuntu_20_04    | false     | 2021/02/16 10:55:12 | 270
1               | Default Organization View | Default_Organization_View | false     | 2020/11/24 14:54:20 |
----------------|---------------------------|---------------------------|-----------|---------------------|----------------------------------------------

I’m afraid there isn’t enough context to make a determination. The name of that repo is valid because a copy is created from Library with the name of the CV within its own name. Can you run foreman-rake katello:correct_puppet_environments and share the stack trace?

Here is the full trace of foreman-rake katello:correct_puppet_environments

# foreman-rake katello:correct_puppet_environments --trace
** Invoke katello:correct_puppet_environments (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke katello:check_ping (first_time)
** Invoke environment
** Execute katello:check_ping
{:services=>
  {:candlepin=>{:status=>"ok", :duration_ms=>"24"},
   :candlepin_auth=>{:status=>"ok", :duration_ms=>"26"},
   :foreman_tasks=>
    {:status=>"FAIL",
     :message=>
      "The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer"},
   :katello_events=>
    {:status=>"ok", :message=>"2 Processed, 0 Failed", :duration_ms=>"0"},
   :candlepin_events=>
    {:status=>"ok", :message=>"1 Processed, 0 Failed", :duration_ms=>"0"},
   :pulp3=>{:status=>"ok", :duration_ms=>"49"},
   :pulp=>{:status=>"ok", :duration_ms=>"56"},
   :pulp_auth=>{:status=>"ok", :duration_ms=>"26"}},
 :status=>"FAIL"}
rake aborted!
Not all the services have been started. Check the status report above and try again.
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/lib/katello/tasks/reimport.rake:10:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:251:in `each'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:251:in `execute'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/ruby/monitor.rb:226:in `mon_synchronize'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:217:in `block in invoke_prerequisites'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:215:in `each'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:215:in `invoke_prerequisites'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/ruby/monitor.rb:226:in `mon_synchronize'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:181:in `invoke'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:160:in `invoke_task'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:116:in `each'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:116:in `block in top_level'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:125:in `run_with_threads'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:110:in `top_level'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:83:in `block in run'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:80:in `run'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/opt/rh/rh-ruby25/root/usr/bin/rake:23:in `load'
/opt/rh/rh-ruby25/root/usr/bin/rake:23:in `<main>'
Tasks: TOP => katello:correct_puppet_environments => katello:check_ping

Linked to this post ?

@GC29 nice find. I do believe that is related to the issue you’re hitting. Let us know if that does the trick for you!

Unfortunately no. It’s even worst… Here the result after changing accordingly to my conf:
(/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/lib/katello/tasks/pulp3_content_switchover.rake)
and restarted the services with hammer service restart

\# foreman-rake katello:correct_puppet_environments --trace
** Invoke katello:correct_puppet_environments (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke katello:check_ping (first_time)
** Invoke environment
** Execute katello:check_ping
{:services=>
  {:candlepin=>{:status=>"ok", :duration_ms=>"462"},
   :candlepin_auth=>{:status=>"ok", :duration_ms=>"70"},
   :foreman_tasks=>
    {:status=>"FAIL",
     :message=>
      "The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer"},
   :katello_events=>
    {:status=>"FAIL", :message=>"Not running", :duration_ms=>"1"},
   :candlepin_events=>
    {:status=>"ok", :message=>"27 Processed, 0 Failed", :duration_ms=>"0"},
   :pulp3=>{:status=>"ok", :duration_ms=>"338"},
   :pulp=>{:status=>"ok", :duration_ms=>"129"},
   :pulp_auth=>{:status=>"ok", :duration_ms=>"57"}},
 :status=>"FAIL"}
rake aborted!
Not all the services have been started. Check the status report above and try again.
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/lib/katello/tasks/reimport.rake:10:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:251:in `each'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:251:in `execute'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/ruby/monitor.rb:226:in `mon_synchronize'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:217:in `block in invoke_prerequisites'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:215:in `each'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:215:in `invoke_prerequisites'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/ruby/monitor.rb:226:in `mon_synchronize'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:181:in `invoke'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:160:in `invoke_task'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:116:in `each'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:116:in `block in top_level'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:125:in `run_with_threads'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:110:in `top_level'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:83:in `block in run'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/application.rb:80:in `run'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/opt/rh/rh-ruby25/root/usr/bin/rake:23:in `load'
/opt/rh/rh-ruby25/root/usr/bin/rake:23:in `<main>'
Tasks: TOP => katello:correct_puppet_environments => katello:check_ping

Now the Katello_events is failling too!

I also try this change with no success:

In this file:/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/lib/katello/tasks/reimport.rake

change
task :check_ping => :environment do
to
task :check_ping => "dynflow:client" do

Result:
{:services=>
{:candlepin=>{:status=>“ok”, :duration_ms=>“600”},
:candlepin_auth=>{:status=>“ok”, :duration_ms=>“142”},
:foreman_tasks=>{:status=>“ok”, :duration_ms=>“5”},
:katello_events=>
{:status=>“FAIL”, :message=>“Not running”, :duration_ms=>“1”},
:candlepin_events=>
{:status=>“ok”, :message=>“0 Processed, 0 Failed”, :duration_ms=>“0”},
:pulp3=>{:status=>“ok”, :duration_ms=>“310”},
:pulp=>{:status=>“ok”, :duration_ms=>“121”},
:pulp_auth=>{:status=>“ok”, :duration_ms=>“159”}},
:status=>“FAIL”}
rake aborted!
Not all the services have been started. Check the status report above and try again.
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/lib/katello/tasks/reimport.rake:10:in `block (2 levels) in <top (required)>’
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute’

It seems like the Foreman app itself isn’t running if I’m interpreting that output correctly. Can you do a foreman-maintain service restart and try the rake task again?

I didn’t mention it, but I have already restarted foreman service after editing the rake task. (And just tried again right now)
In my opinion it’s the task which is not able to handle the katello check_ping because when running manually a hammer ping everything is ok:

# hammer ping
database:
    Status:          ok
    Server Response: Duration: 2ms
candlepin:
    Status:          ok
    Server Response: Duration: 23ms
candlepin_events:
    Status:          ok
    message:         0 Processed, 0 Failed
    Server Response: Duration: 0ms
candlepin_auth:
    Status:          ok
    Server Response: Duration: 21ms
katello_events:
    Status:          ok
    message:         0 Processed, 0 Failed
    Server Response: Duration: 0ms
pulp:
    Status:          ok
    Server Response: Duration: 75ms
pulp_auth:
    Status:          ok
    Server Response: Duration: 45ms
pulp3:
    Status:          ok
    Server Response: Duration: 43ms
foreman_tasks:
    Status:          ok
    Server Response: Duration: 4ms

I think we were talking about the correct_puppet_environments task, so although the thread you found spoke about pulp3_content_switchover what you should have done was (also) modify the former rake task. Sorry if I’ve misinterpreted as this thread is speaking about a number of issues!

Yes I have been trying many thigs to solve my problem
It seemed to me that the problem was up to the reimport.rake task because of this line in the error log

So I tried to do the trick in the reimport.rake

But with no luck until now…

I have same problem.
Recently , i have installed Foreman 2.3.3 and imported backup / configuration of old server ( Foreman 1.21 / puppetserver 5.3).

this server is running but i can’t import Puppet Class.
Here are logs from foreman-rake errors:fetch_log request_id=03540751

`/usr/share/foreman` is not writable.
Bundler will use `/tmp/bundler20210430-2509-l5eun62509' as your home directory temporarily.
processing by EnvironmentsController#import_environments as HTML
2021-04-30T13:53:26 [I|app|03540751]   Parameters: {"env"=>"integration", "proxy"=>"1-intsrvdpl-a2-smileandpay-int"}
2021-04-30T13:53:28 [I|app|03540751]   Rendering common/_puppetclasses_or_envs_changed.html.erb within layouts/application
2021-04-30T13:53:28 [I|app|03540751]   Rendered common/_puppetclasses_or_envs_changed.html.erb within layouts/application (Duration: 2.0ms | Allocations: 1584)
2021-04-30T13:53:28 [W|app|03540751] unnumbered(1) mixed with named
2021-04-30T13:53:28 [I|app|03540751] Backtrace for 'unnumbered(1) mixed with named' error (ActionView::Template::Error): unnumbered(1) mixed with named
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/fast_gettext-1.8.0/lib/fast_gettext/vendor/string.rb:70:in `%'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/fast_gettext-1.8.0/lib/fast_gettext/vendor/string.rb:70:in `%'
 03540751 | /usr/share/foreman/app/helpers/puppetclasses_and_environments_helper.rb:42:in `block in pretty_print'
 03540751 | /usr/share/foreman/app/helpers/puppetclasses_and_environments_helper.rb:37:in `map'
 03540751 | /usr/share/foreman/app/helpers/puppetclasses_and_environments_helper.rb:37:in `pretty_print'
 03540751 | /usr/share/foreman/app/helpers/puppetclasses_and_environments_helper.rb:12:in `class_update_text'
 03540751 | /usr/share/foreman/app/views/common/_puppetclasses_or_envs_changed.html.erb:50:in `block (3 levels) in _b064dcf8ffe20d03f4ac7f2dea296629'
 03540751 | /usr/share/foreman/app/views/common/_puppetclasses_or_envs_changed.html.erb:32:in `each'
 03540751 | /usr/share/foreman/app/views/common/_puppetclasses_or_envs_changed.html.erb:32:in `block (2 levels) in _b064dcf8ffe20d03f4ac7f2dea296629'
 03540751 | /usr/share/foreman/app/views/common/_puppetclasses_or_envs_changed.html.erb:30:in `each'
 03540751 | /usr/share/foreman/app/views/common/_puppetclasses_or_envs_changed.html.erb:30:in `block in _b064dcf8ffe20d03f4ac7f2dea296629'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/helpers/form_tag_helper.rb:74:in `form_tag'
 03540751 | /usr/share/foreman/app/views/common/_puppetclasses_or_envs_changed.html.erb:2:in `_b064dcf8ffe20d03f4ac7f2dea296629'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/base.rb:274:in `_run'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/template.rb:185:in `block in render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/notifications.rb:182:in `instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/template.rb:385:in `instrument_render_template'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/template.rb:183:in `render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/template_renderer.rb:58:in `block (2 levels) in render_template'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/notifications.rb:180:in `block in instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/notifications.rb:180:in `instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/template_renderer.rb:57:in `block in render_template'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/template_renderer.rb:65:in `render_with_layout'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/template_renderer.rb:56:in `render_template'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/template_renderer.rb:13:in `render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/rendering.rb:117:in `block in _render_template'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/base.rb:304:in `in_rendering_context'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/rendering.rb:116:in `_render_template'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/streaming.rb:218:in `_render_template'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/rendering.rb:103:in `render_to_body'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/abstract_controller/rendering.rb:25:in `render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/rendering.rb:36:in `render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
 03540751 | /usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/core_ext/benchmark.rb:14:in `ms'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/instrumentation.rb:43:in `render'
 03540751 | /usr/share/foreman/app/controllers/concerns/foreman/controller/environments.rb:26:in `import_environments'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/abstract_controller/base.rb:195:in `process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/rendering.rb:30:in `process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
 03540751 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 03540751 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 03540751 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:139:in `run_callbacks'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/abstract_controller/callbacks.rb:41:in `process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/rescue.rb:22:in `process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/notifications.rb:180:in `block in instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/notifications.rb:180:in `instrument'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/abstract_controller/base.rb:136:in `process'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-6.0.3.5/lib/action_view/rendering.rb:39:in `process'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal.rb:190:in `dispatch'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal.rb:254:in `dispatch'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/journey/router.rb:49:in `block in serve'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/journey/router.rb:32:in `each'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/journey/router.rb:32:in `serve'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/routing/route_set.rb:834:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-dsl-2.3.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/static_dispatcher.rb:66:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/extractor/recorder.rb:137:in `call'
 03540751 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 03540751 | /usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/conditional_get.rb:27:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 03540751 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/cookies.rb:648:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/callbacks.rb:101:in `run_callbacks'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/railties-6.0.3.5/lib/rails/rack/logger.rb:37:in `call_app'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/railties-6.0.3.5/lib/rails/rack/logger.rb:28:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 03540751 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/request_id.rb:27:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/executor.rb:14:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/static.rb:126:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/secure_headers-6.3.2/lib/secure_headers/middleware.rb:11:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/railties-6.0.3.5/lib/rails/engine.rb:527:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/railties-6.0.3.5/lib/rails/railtie.rb:190:in `public_send'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/railties-6.0.3.5/lib/rails/railtie.rb:190:in `method_missing'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/puma-4.3.7/lib/puma/configuration.rb:228:in `call'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/puma-4.3.7/lib/puma/server.rb:713:in `handle_request'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/puma-4.3.7/lib/puma/server.rb:472:in `process_client'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/puma-4.3.7/lib/puma/server.rb:328:in `block in run'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/puma-4.3.7/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
 03540751 | /usr/share/foreman/vendor/ruby/2.5.0/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2021-04-30T13:53:28 [I|app|03540751]   Rendering common/500.html.erb within layouts/application
2021-04-30T13:53:28 [I|app|03540751]   Rendered common/500.html.erb within layouts/application (Duration: 1.4ms | Allocations: 780)
2021-04-30T13:53:28 [I|app|03540751]   Rendered layouts/_application_content.html.erb (Duration: 2.4ms | Allocations: 5685)
2021-04-30T13:53:28 [I|app|03540751]   Rendering layouts/base.html.erb
2021-04-30T13:53:28 [I|app|03540751]   Rendered layouts/base.html.erb (Duration: 2.9ms | Allocations: 6932)
2021-04-30T13:53:28 [I|app|03540751] Completed 500 Internal Server Error in 1501ms (Views: 11.0ms | ActiveRecord: 45.4ms | Allocations: 307205)
Foreman version: 2.3.3
Plugins: 
foreman-tasks 3.0.5
foreman_bootdisk 17.0.2
foreman_cockpit 2.0.3
 foreman_discovery 16.3.4
 foreman_memcache 0.1.0
foreman_remote_execution 4.2.2
 foreman_setup 6.0.0
 foreman_statistics 1.0.0
foreman_templates 9.0.0

Hmmm, this is quite odd, as the line throwing the error hasn’t changed in 5 years.
Are you using Foreman in a non-English language? If so, can you try switching your locale to English and attempt to perform the import again?

Additionally, your issue is unrelated to what is described in this thread, i would suggest opening a new thread so it doesn’t get mixed up.

i m using Foreman in French Language. But i think the bug is due of a problem of linking between Puppet Class and environment.

I managed to fix in running this following command :

hammer --verbose proxy import-classes --id 1

Now , i can import Puppet Class by Foreman interface but all Puppet Class are linked at all environments. It’s not too bad for now

1 Like