Project

General

Profile

Bug #13084

undefined method `find_by_ip' during validation of IP retrieved from compute resource

Added by Dominic Cleal over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Compute resources
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

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.


Related issues

Related to Foreman - Refactor #10988: Remove 1.11 deprecationsClosed2015-07-02

Associated revisions

Revision d5b5059a (diff)
Added by Lukas Zapletal over 3 years ago

Fixes #13084 - compute resource IP orchestration fixed

History

#1 Updated by Dominic Cleal over 3 years ago

#2 Updated by Lukas Zapletal over 3 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.

#3 Updated by Lukas Zapletal over 3 years ago

Comment deleted.

#4 Updated by The Foreman Bot over 3 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

#5 Updated by Lukas Zapletal over 3 years ago

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

Also available in: Atom PDF