On Red Hat Satellite 6.2.x `# satellite-installer --scenario satellite` fails with Proxy cannot be registered (500 Internal Server Error)

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.2

Issue

  • Satellite-installer fails with:
 /Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[satellite.example.com]: Could not evaluate: Proxy satellite.example.com cannot be registered (500 Internal Server Error): N/A
  • The Web UI shows
Web application could not be started
Validation failed: Permissions Permissions must be of same resource type (ActiveRecord::RecordInvalid)

Resolution

  • Found hint from below Ruby file from Satellite Server related to permission.

    ~foreman/app/models/filter.rb

    166   def same_resource_type_permissions
    167     errors.add(:permissions, _('Permissions must be of same resource type')) if self.permissions.map(&:resource_type).uniq.size > 1
    168   end
  • Execute below command on Satellite Server to collect filters.
# foreman-rake console
> Filter.all.collect {|f| [f.role.name,f.permissions.map(&:resource_type).uniq.size,f, f.permissions.pluck(:id,:name,:resource_type)] }. select {|n,c| c>1}

If the above command shows duplicate results, it means that the filters were applied from the different resource type.

Eg:-

> Filter.all.collect {|f| [f.role.name,f.permissions.map(&:resource_type).uniq.size,f, f.permissions.pluck(:id,:name,:resource_type)] }. select {|n,c| c>1}
[["Viewer", 2, #<Filter id: 74, search: nil, role_id: 13, created_at: "2016-02-29 18:20:36", updated_at: "2016-02-29 18:20:36", taxonomy_search: nil>, [[105, "view_organizations", "Organization"], [178, "view_subscriptions", "Katello::Subscription"]]]]
  • It means that Filter :permissions list may not have more than one element. However, the Role "Viewer" filter had two for some obscure reason. Removing the filter fixed the issue:

Eg:-

# foreman-rake console
> Filter.find(74).destroy
> exit
# foreman-rake fix_db_cache --trace COMMIT=true
# katello-service restart

Diagnostic Steps

  • /var/log/httpd/error.log and /var/log/foreman/production.log
     in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:782)

[ 2017-05-15 09:41:21.0055 16781/7f03220a4700 agents/HelperAgent/RequestHandler.h:1971 ]: [Client 20] Cannot checkout session. An error occured while starting up the preloader.
Error page:
Validation failed: Permissions Permissions must be of same resource type (ActiveRecord::RecordInvalid)
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:57:in `save!'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `block in save!'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:208:in `transaction'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `save!'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/delegation.rb:46:in `each'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/delegation.rb:46:in `each'
  /usr/share/foreman/app/services/cache_manager.rb:13:in `create_new_filter_cache'
  /usr/share/foreman/app/services/cache_manager.rb:20:in `recache!'
  /usr/share/foreman/config/initializers/fix_cache.rb:10:in `<top (required)>'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `block in load'
  /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
  • In the ~foreman/app/models/filter.rb
    166   def same_resource_type_permissions
    167     errors.add(:permissions, _('Permissions must be of same resource type')) if self.permissions.map(&:resource_type).uniq.size > 1
    168   end

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.

1 Comments

"Removed One Entry fixed Issue."

instructions?