Project

General

Profile

Actions

Bug #5679

closed

Using compute_resource_name in API results in undefined method `find_by_to_label'

Added by Dominic Cleal over 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Trying to identify a compute resource by name with the "compute_resource_name" helper throws the following error:

Started POST "/api/v2/hosts" for 127.0.0.1 at 2014-05-12 16:07:23 +0100
Processing by Api::V2::HostsController#create as JSON
  Parameters: {"name"=>"test4250", "hostgroup_name"=>"libvirt", "compute_resource_name"=>"localhost", "compute_profile_name"=>"libvirt", "apiv"=>"v2", "host"=>{"name"=>"test4250", "hostgroup_name"=>"libvirt", "compute_resource_name"=>"localhost", "compute_profile_name"=>"libvirt"}}
undefined method `find_by_to_label' for #<Class:0x007fba0fe099a0> (NoMethodError)
/home/dcleal/.rvm/gems/ruby-2.0.0-p247@foreman/gems/activerecord-3.2.18/lib/active_record/dynamic_matchers.rb:27:in `method_missing'
/home/dcleal/code/foreman/foreman/app/models/concerns/has_many_common.rb:83:in `block in belongs_to_name_for'
/home/dcleal/.rvm/gems/ruby-2.0.0-p247@foreman/gems/activerecord-3.2.18/lib/active_record/attribute_assignment.rb:85:in `block in assign_attributes'
/home/dcleal/.rvm/gems/ruby-2.0.0-p247@foreman/gems/activerecord-3.2.18/lib/active_record/attribute_assignment.rb:78:in `each'
/home/dcleal/.rvm/gems/ruby-2.0.0-p247@foreman/gems/activerecord-3.2.18/lib/active_record/attribute_assignment.rb:78:in `assign_attributes'
/home/dcleal/.rvm/gems/ruby-2.0.0-p247@foreman/gems/activerecord-3.2.18/lib/active_record/base.rb:498:in `initialize'
/home/dcleal/.rvm/gems/ruby-2.0.0-p247@foreman/gems/actionpack-3.2.18/lib/action_dispatch/routing/url_for.rb:103:in `initialize'
/home/dcleal/code/foreman/foreman/app/models/concerns/foreman/sti.rb:22:in `new'
/home/dcleal/code/foreman/foreman/app/models/concerns/foreman/sti.rb:22:in `new_with_cast'
/home/dcleal/code/foreman/foreman/app/models/host.rb:16:in `method_missing'
/home/dcleal/code/foreman/foreman/app/controllers/api/v2/hosts_controller.rb:70:in `create'
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal
  • Target version set to 1.8.1
Actions #2

Updated by Dominic Cleal over 10 years ago

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

Updated by Dominic Cleal over 10 years ago

  • Translation missing: en.field_release set to 10
Actions #4

Updated by Dominic Cleal over 10 years ago

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

Also available in: Atom PDF