Actions
Bug #13084
closedundefined method `find_by_ip' during validation of IP retrieved from compute resource
Description
When creating a Rackspace CR-based host, the following error is thrown in orchestration:
| NoMethodError: undefined method `find_by_ip' for #<Class:0x0000000adce650> | /home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-4.1.5/lib/active_record/dynamic_matchers.rb:26:in `method_missing' | /home/dcleal/code/foreman/foreman/app/models/host.rb:15:in `method_missing' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration/compute.rb:285:in `validate_foreman_attr' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration/compute.rb:135:in `block in setComputeDetails' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration/compute.rb:122:in `each' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration/compute.rb:122:in `setComputeDetails' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration.rb:162:in `execute' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration.rb:107:in `block in process' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration.rb:99:in `each' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration.rb:99:in `process' | /home/dcleal/code/foreman/foreman/app/models/concerns/orchestration.rb:35:in `on_save'
I suspect this may affect other CR types that retrieve IP addresses, such as EC2/OpenStack.
Those that retrieve MACs seem OK as the match_macs_to_nics method calls the same function, but passing in Nic::Base instead of Host.
Updated by Dominic Cleal about 9 years ago
- Related to Refactor #10988: Remove 1.11 deprecations added
Updated by Lukas Zapletal about 9 years ago
Tried with OS, this is what it gets passed in:
[1] pry(#<Foreman::Model::Openstack>)> args => {"flavor_ref"=>"83098b08-7339-4089-bc07-3f2a14b7a4c1", "availability_zone"=>"", "tenant_id"=>"2f58867f4fa54a09a266b26ef410d311", "security_groups"=>"xxx-sec-group", "nics"=>[""], "network"=>"os1_internal", "boot_from_volume"=>"false", "size_gb"=>"", "image_ref"=>"2695dbd9-e1b1-47a8-9ac3-4e8854aa55aa", "interfaces_attributes"=>{"0"=>{}}, :name=>"lzap-test-01.local.lan", :provision_method=>"image"}
It looks like the hash has no indiffrent access. Once I fix this, I get the very same error there.
Updated by The Foreman Bot about 9 years ago
- Status changed from New to Ready For Testing
- Assignee set to Lukas Zapletal
- Pull request https://github.com/theforeman/foreman/pull/3052 added
Updated by Lukas Zapletal about 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset d5b5059a1acc7f5cb96fc7dc873e403fdcac24b8.
Actions