The foreman logs are filled with errors related to "unknown class DockerRegistry" and "unknown class Container" after upgrading to Red Hat Satellite 6.11

Solution Verified - Updated

Environment

Red Hat Satellite 6.11

Issue

  • After upgrading to Red Hat Satellite 6.11, the following error is appearing in the foreman logs very frequently, causing unnecessary growth of the log file and filling up the disk space.

    2022-07-21T09:30:22 [W|app|e6b226e2] unknown class Container, ignoring
    2022-07-21T09:30:22 [I|app|e6b226e2] Backtrace for 'unknown class Container, ignoring' error (NameError): uninitialized constant Container
    ..
    2022-07-21T09:30:22 [W|app|e6b226e2] unknown class DockerRegistry, ignoring
    2022-07-21T09:30:22 [I|app|e6b226e2] Backtrace for 'unknown class DockerRegistry, ignoring' error (NameError): uninitialized constant DockerRegistry   
    

Resolution

This issue has been reported to the Red Hat Engineering team via the This content is not included.Bugzilla 2109594 and has been fixed in Red Hat Satellite 6.12 through errata RHSA-2022:8506.

If the upgrade to 6.12 is not possible, Then refer to the following steps to fix this problem manually.

  • Ensure to have a VM snapshot or backup is present for the concerned satellite server.

  • Ensure no paused or running tasks are there. Go to the Satellite UI --> Monitor --> Tasks page to verify the same.

  • Clean up the permissions and filters related to DockerRegistry and Container resources:

    # cat << EOF | foreman-rake console
    perms = Permission.where(:resource_type => [:DockerRegistry, :Container])
    perms.each { |perm| perm.filters.destroy_all }
    perms.destroy_all
    EOF
    
  • (Optionally) Restart the services of the satellite server and perform a basic health check.

    # satellite-maintain service restart
    # sleep 20 && hammer ping
    

 

Reach out to This content is not included.Red Hat Technical Support in case of any further assistance is required.

For more KB articles/solutions related to Red Hat Satellite 6.x Installation/Upgrade/Update Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Installation/Upgrade/Update Issues.

Root Cause

Despite performing a successful upgrade to Red Hat Satellite 6.11, permissions and filers related to some removed functionalities were leftover in the database.

Diagnostic Steps

  • The following tracebacks were displayed inside the /var/log/foreman/production.log file:

    2022-07-21T09:30:22 [I|app|e6b226e2] Started GET "/templates/report_templates/468-Ansible%20-%20Ansible%20Inventory/edit" for 10.3.19.126 at 2022-07-21 09:30:22 -0500
    2022-07-21T09:30:22 [I|app|e6b226e2] Processing by ReportTemplatesController#edit as HTML
    2022-07-21T09:30:22 [I|app|e6b226e2]   Parameters: {"id"=>"468-Ansible - Ansible Inventory"}
    2022-07-21T09:30:22 [I|app|e6b226e2]   Rendering report_templates/edit.html.erb within layouts/application
    2022-07-21T09:30:22 [I|app|e6b226e2]   Rendered report_templates/_custom_tab_headers.html.erb (Duration: 1.3ms | Allocations: 201)
    2022-07-21T09:30:22 [I|app|e6b226e2]   Rendered report_templates/_alerts.html.erb (Duration: 3.8ms | Allocations: 1639)
    2022-07-21T09:30:22 [W|app|e6b226e2] unknown class Container, ignoring
    2022-07-21T09:30:22 [I|app|e6b226e2] Backtrace for 'unknown class Container, ignoring' error (NameError): uninitialized constant Container
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:282:in `const_get'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:282:in `block in constantize'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:280:in `each'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:280:in `inject'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:280:in `constantize'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
     e6b226e2 | /usr/share/foreman/app/models/filter.rb:85:in `get_resource_class'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:22:in `block in with_translations'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:22:in `map'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:22:in `with_translations'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:18:in `resources_with_translations'
     e6b226e2 | /usr/share/foreman/app/views/template_inputs/_form.html.erb:8:in `block in _5e3e40319560ac86e152e151988ef286'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.4.7/lib/action_view/helpers/capture_helper.rb:45:in `block in captu
     ..
     ..
    2022-07-21T09:30:22 [W|app|e6b226e2] unknown class DockerRegistry, ignoring
    2022-07-21T09:30:22 [I|app|e6b226e2] Backtrace for 'unknown class DockerRegistry, ignoring' error (NameError): uninitialized constant DockerRegistry
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:282:in `const_get'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:282:in `block in constantize'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:280:in `each'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:280:in `inject'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/inflector/methods.rb:280:in `constantize'
     e6b226e2 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
     e6b226e2 | /usr/share/foreman/app/models/filter.rb:85:in `get_resource_class'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:22:in `block in with_translations'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:22:in `map'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:22:in `with_translations'
     e6b226e2 | /usr/share/foreman/app/models/permission.rb:18:in `resources_with_translations'
     e6b226e2 | /usr/share/foreman/app/views/template_inputs/_form.html.erb:8:in `block in _5e3e40319560ac86e152e151988ef286'   
    
  • Execute the following rake command and If it lists a few permissions, then that indicates some unrequired data is still present in the database.

    # echo -e "conf.echo=false \n pp Permission.where(:resource_type => [:DockerRegistry, :Container])" | foreman-rake console 
    
SBR
Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.