Project

General

Profile

Actions

Bug #24478

closed

Unable to delete subnet NoMethodError: undefined method `klass' for nil:NilClass

Added by Marek Hulán over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Network
Target version:
-
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1541002

Description of problem: Trying to delete subnet which is used by provisioned host gives error

2018-02-01 08:40:36 c64b0466 [app] [W] Action failed | NoMethodError: undefined method `klass' for nil:NilClass | Did you mean? class | /opt/theforeman/tfm/root/usr/share/gems/gems/scoped_search-4.1.2/lib/scoped_search/query_builder.rb:31:in `class_for' | /opt/theforeman/tfm/root/usr/share/gems/gems/scoped_search-4.1.2/lib/scoped_search/query_builder.rb:18:in `build_query' | /usr/share/foreman/app/services/authorizer.rb:96:in `build_filtered_scope_components' | /usr/share/foreman/app/services/authorizer.rb:55:in `find_collection' | /usr/share/foreman/app/models/concerns/authorizable.rb:27:in `authorized_as' | /usr/share/foreman/app/models/concerns/authorizable.rb:65:in `authorized' | /usr/share/foreman/app/services/association_authorizer.rb:10:in `authorized_associations' | /usr/share/foreman/lib/core_extensions.rb:45:in `block (2 levels) in before_destroy' | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each' | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each' | /usr/share/foreman/lib/core_extensions.rb:42:in `block in before_destroy' | /usr/share/foreman/lib/core_extensions.rb:41:in `each'

Version-Release number of selected component (if applicable): Satellite 6.3 snap 34

How reproducible: always

Steps to Reproduce:
1. Create subnet
2. Provision a host using created subnet
3. Try to delete subnet

Actual results:

Error as Oops, we're sorry but something went wrong undefined method `klass' for nil:NilClass Did you mean? class

and production.log showed 500 internal server error (see attachment).

Expected results: It should show warning as "subnet is used by host"

Additional info: It is regression. Working correctly in 6.2.14.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #25207: Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::ManagedClosedLukas ZapletalActions
Actions #1

Updated by The Foreman Bot over 5 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Marek Hulán
  • Pull request https://github.com/theforeman/foreman/pull/5888 added
Actions #2

Updated by Marek Hulán over 5 years ago

  • Status changed from Ready For Testing to Closed
Actions #3

Updated by Tomer Brisker over 5 years ago

  • Subject changed from Unable to delete subnet NoMethodError: undefined method `klass' for nil:NilClass to Unable to delete subnet NoMethodError: undefined method `klass' for nil:NilClass
  • Fixed in Releases 1.19.0, 1.20.0 added
Actions #4

Updated by Tomer Brisker over 5 years ago

  • Fixed in Releases deleted (1.19.0)
Actions #5

Updated by Tomer Brisker over 5 years ago

  • Status changed from Closed to Assigned
  • Fixed in Releases deleted (1.20.0)

The fix broken discovery plugin and was reverted. Returning to assigned state.

Actions #6

Updated by The Foreman Bot over 5 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6053 added
Actions #7

Updated by Ondřej Pražák over 5 years ago

  • Status changed from Ready For Testing to Closed
  • Fixed in Releases 1.20.0 added
Actions #8

Updated by Lukas Zapletal over 5 years ago

  • Related to Bug #25207: Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::Managed added
Actions

Also available in: Atom PDF