Bug #5119

Can't create new host on GCE: "Warning! undefined method `first' for nil:NilClass"

Added by Krzysztof Krzyżaniak over 3 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Ohad Levy
Category:Compute resources - GCE
Target version:Sprint 27
Difficulty: Bugzilla link:
Found in release:nightly Pull request:https://github.com/theforeman/foreman/pull/1671
Story points-
Velocity based estimate-
Release1.5.3Release relationshipAuto

Description

Go to Host > New host > [Virtual machine tab] > Error loading virtual machine information: Internal Server Error (no stack trace)
Go to Infrastructure > Compute profiles > Click on any defined profile (for example: 1-Small) > Edit Compute profile: 1-Small > Click on GCE profile > Error with stack trace:

Warning!

undefined method `first' for nil:NilClass

Stack trace:

NoMethodError
undefined method `first' for nil:NilClass
app/models/concerns/fog_extensions/google/server.rb:15:in `image_id'
app/helpers/layout_helper.rb:110:in `block in select_f'
app/helpers/layout_helper.rb:157:in `block (3 levels) in field'
app/helpers/layout_helper.rb:156:in `block (2 levels) in field'
app/helpers/layout_helper.rb:149:in `block in field'
app/helpers/layout_helper.rb:148:in `field'
app/helpers/layout_helper.rb:108:in `select_f'
app/views/compute_resources_vms/form/_gce.html.erb:7:in `_app_views_compute_resources_vms_form__gce_html_erb__2141746024514687174_80528100'
app/views/compute_attributes/_form.html.erb:10:in `block (2 levels) in app_views_compute_attributes_form_html_erb___2910166742332063393_70284026324980'
app/views/compute_attributes/_form.html.erb:8:in `block in app_views_compute_attributes_form_html_erb___2910166742332063393_70284026324980'
app/helpers/layout_helper.rb:248:in `form_for'
app/views/compute_attributes/_form.html.erb:2:in `_app_views_compute_attributes__form_html_erb___2910166742332063393_70284026324980'
app/views/compute_attributes/edit.html.erb:3:in `_app_views_compute_attributes_edit_html_erb___2573780859027174645_70284026243820'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

OS: Centos 6.5
Foreman: 1.5 nightly rpms

Associated revisions

Revision 70b5b765
Added by Ohad Levy over 3 years ago

fixes #5119 - ensure GCE can list images.

Revision a01b8972
Added by Ohad Levy about 3 years ago

fixes #5119 - ensure GCE can list images.

(cherry picked from commit 70b5b765853bbaba86278d5607fdb31b2f66224a)

Revision 281cd276
Added by Ohad Levy about 3 years ago

fixes #5119 - ensure GCE can list images.

(cherry picked from commit 70b5b765853bbaba86278d5607fdb31b2f66224a)

History

#1 Updated by Krzysztof Krzyżaniak over 3 years ago

More info about first case:

Started POST "/hosts/compute_resource_selected" for 164.40.242.212 at 2014-04-09 08:03:33 +0000
Processing by HostsController#compute_resource_selected as */*
Parameters: {"utf8"=>"✓", "authenticity_token"=>"pLZ+X75ikmJq2P6ckD3PR1BafbEwk+bPFmCiJVTU9tY=", "host"=>{"name"=>"", "hostgroup_id"=>"", "compute_resource_id"=>"1", "co\
mpute_profile_id"=>"", "environment_id"=>"", "puppet_ca_proxy_id"=>"", "puppet_proxy_id"=>"", "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Manage\
d", "domain_id"=>"", "realm_id"=>"", "mac"=>"", "ip"=>"", "interfaces_attributes"=>{"new_interfaces"=>{"_destroy"=>"false", "type"=>"Nic::Managed", "mac"=>"", "name"=>"",\
"domain_id"=>"", "ip"=>"", "provider"=>"IPMI"}}, "architecture_id"=>"", "provision_method"=>"build", "build"=>"1", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>\
"1-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}}
Rendered compute_resources_vms/form/_gce.html.erb (2539.0ms)
Rendered hosts/_compute.html.erb (3255.7ms)
Operation FAILED: undefined method `first' for nil:NilClass
Rendered common/500.html.erb (4.0ms)
Completed 500 Internal Server Error in 3270ms (Views: 4.6ms | ActiveRecord: 0.2ms)

#2 Updated by Johan Sunnerstig over 3 years ago

Has there been any further information or progress on this? I'm running into the exact same error, running Foreman 1.5(final) and the matching plugin.

Regards
Johan

#3 Updated by Przemysław Szypowicz over 3 years ago

It still occur in stable 1.5.1 version!

#4 Updated by Loke J. over 3 years ago

I am getting the exact same error in foreman 1.5.2 on Debian Wheezy.

pastebin of trace --> http://pastebin.com/zWdHtduh

Listing of VMs running on GCE works perfectly fine, but "Host > New host > [Virtual machine tab]" and "Infrastructure > Compute profiles > Click on any defined profile" throws a 500 error.

EC2 works fine, only getting this error with GCE.

#5 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Target version set to Sprint 27
  • Pull request https://github.com/theforeman/foreman/pull/1671 added

#6 Updated by Dominic Cleal over 3 years ago

  • Category set to Compute resources - GCE
  • Assigned To set to Ohad Levy

#7 Updated by Dominic Cleal over 3 years ago

  • Release set to 1.5.3

#8 Updated by Ohad Levy over 3 years ago

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

Also available in: Atom PDF