Undefined method `all_ansible_roles'


I use foreman with katello and have installed the openscap plugin, which i once set up and tested but don’t yet use.

After i upgraded 2.5.3 → 2.5.4 → 3.0.2 → 3.1.2 i have a problem. I don’t know if it is relevant but i use nested hostgroups, some of the hostgroups have OpenSCAP Proxy filled others don’t.

When i want to set the OpenSCAP Proxy on a hostgroup the following error occurs:

Oops, we're sorry but something went wrong undefined method `all_ansible_roles' for #<Hostgroup:

The big problem for me is i can’t create new hosts with this hostgroup, new hosts for other groups work. The same error occurs there as well.

Here the more detailed informations:

022-04-07T13:04:31 [I|app|b27bfbaa] Started PATCH "/hostgroups/43-Fedora%2034%20Testing" for at 2022-04-07 13:04:31 +0200
2022-04-07T13:04:31 [I|app|b27bfbaa] Processing by HostgroupsController#update as HTML
2022-04-07T13:04:31 [I|app|b27bfbaa]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"fnzuejWmFEcEsPLua2MB/sQ0uJP+KxCdR2CHO8h8H7s+v6HH1/fgnLeXPgghSY88rYY3BJNwj3ddbXOzu1CRu
w==", "hostgroup"=>{"parent_id"=>"", "name"=>"Fedora 34 Testing", "description"=>"", "lifecycle_environment_id"=>"2", "content_view_id"=>"23", "content_source_id"=>"1", "com
pute_resource_id"=>"", "puppet_attributes"=>{"environment_id"=>"3"}, "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "openscap_proxy_id"=>"", "domain_id"=>"1", "subnet_id
"=>"1", "realm_id"=>"", "architecture_id"=>"1", "operatingsystem_id"=>"20", "medium_id"=>"", "kickstart_repository_id"=>"1619", "ptable_id"=>"261", "pxe_loader"=>"Grub2 UEFI
", "group_parameters_attributes"=>{"0"=>{"name"=>"enable-puppetlabs-puppet6-repo", "parameter_type"=>"boolean", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destro
y"=>"false", "id"=>"1479"}, "1"=>{"name"=>"installmode", "parameter_type"=>"string", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"1458"},
 "2"=>{"name"=>"kt_activation_keys", "parameter_type"=>"string", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"0", "id"=>"1459"}, "3"=>{"name"=>"root_par
tition_label", "parameter_type"=>"string", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"1460"}, "4"=>{"name"=>"root_partition_size", "par
ameter_type"=>"string", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"1461"}, "5"=>{"name"=>"scratch_partition_label", "parameter_type"=>"
string", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"1462"}, "6"=>{"name"=>"swap_partition_size", "parameter_type"=>"string", "value"=>"
[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"1463"}}, "puppetclass_ids"=>["", "52", "69", "62", "44", "63", "54", "59", "29", "64", "41", "21", "70
", "72", "66", "73", "61", "30", "39", "31", "55", "47", "46", "43", "50", "45", "40", "7", "65", "48", "58", "57", "8", "60", "32", "56", "71", "24", "22", "53", "25", "33"
, "42"], "location_ids"=>["", "2"], "organization_ids"=>["", "1"], "id"=>"43"}, "media_selector"=>"synced_content", "commit"=>"Submit", "id"=>"43-Fedora 34 Testing"}
2022-04-07T13:04:31 [W|api|b27bfbaa] param hostgroup[puppetclass_*] has been deprecated in favor of hostgroup[puppet_attributes][puppetclass_*]
2022-04-07T13:04:31 [I|aud|b27bfbaa] Hostgroup (43) update event on openscap_proxy_id 1, 
2022-04-07T13:04:31 [W|app|b27bfbaa] undefined method `all_ansible_roles' for #<Hostgroup:0x00007fd634625018>
2022-04-07T13:04:31 [I|app|b27bfbaa] Backtrace for 'undefined method `all_ansible_roles' for #<Hostgroup:0x00007fd634625018>' error (NoMethodError): undefined method `all_an
sible_roles' for #<Hostgroup:0x00007fd634625018>
 b27bfbaa | /opt/theforeman/tfm/root/usr/share/gems/gems/activemodel- `method_missing'
 b27bfbaa | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:99:in `method_missing'

Foreman and Proxy versions:

  • Foreman 3.1.2
  • Proxy 3.1.2

Foreman and Proxy plugin versions:

  • foreman_openscap 5.1.1

Distribution and version:

  • CentOS Linux release 7.9.2009

Proper uninstallation of the plugin seems not to be existing, according to the following ticket:

But i achieved to make my installation usable again in removing the plugin the following way. I think this may lead to problems later, but i hope it will not:

foreman-installer --no-enable-foreman-plugin-openscap --no-enable-foreman-proxy-plugin-openscap

yum remove tfm-rubygem-smart_proxy_openscap tfm-rubygem-openscap tfm-rubygem-foreman_openscap tfm-rubygem-openscap_parser scap-security-guide openscap-scanner openscap

After that i rebooted the server, which may not be required a service restart may have been enough.

Then a refresh of the smartproxy capabilities is neccessary:

→ Webinterface → smartproxy → refresh