Refactor #18176

Replace call to private clear_association_cache in Subnet#known_ips

Added by Dominic Cleal over 1 year ago. Updated 9 days ago.

Assignee:Dominic Cleal
Target version:1.15.0
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link: Found in Releases:
Pull request:


The method clear_association_cache on models has been made private in Rails 5.0, it should be replaced where it's used in Subnet#known_ips:

NoMethodError: private method `clear_association_cache' called for #<Subnet::Ipv4:0x0000000b9d15d8>
Did you mean? clear_transaction_record_state
app/models/subnet.rb:190:in `known_ips'
app/services/ipam/db.rb:11:in `block in suggest_ip'
app/services/ipam/db.rb:9:in `suggest_ip'
test/unit/nic_test.rb:220:in `block (2 levels) in <class:NicTest>' (NoMethodError)

The method was public, but undocumented - for use only by Rails. It is now private (

The purpose appears to be to ensure known_ips always returns up to date lists of IPs when used for IPAM. e.g. if an interface is created with a given subnet and allocated an IP, a second interface created with the same subnet object won't be allocated the same IP.

Associated revisions

Revision 6a3b4abc
Added by Dominic Cleal over 1 year ago

fixes #18176 - replace clear_association_cache with reload

Reload is still necessary in Rails 5 as interfaces association will be
cached. The BMC test change is necessary to reload smart proxies
associated to the subnet after their features were altered - previously
clearing the entire subnet cache from `known_ips` also removed cached
smart proxies with outdated feature lists.


#1 Updated by The Foreman Bot over 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request added

#2 Updated by Dominic Cleal over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal over 1 year ago

  • Legacy Backlogs Release (now unused) set to 209

Also available in: Atom PDF