Replace call to private clear_association_cache in Subnet#known_ips
|Triaged:||Fixed in Releases:|
|Bugzilla link:||Found in Releases:|
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/services/ipam/db.rb:11:in `block 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 (https://github.com/rails/rails/commit/9d56958).
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.
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.