Project

General

Profile

Bug #12946

When the creation of new virtual instance (compute) fails at the "Set up compute instance" stage, we get "TypeError: can't convert nil into String" instead of the underlying error

Added by Imri Zvik over 3 years ago. Updated about 1 year ago.

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

Description

2015-12-28 04:18:54 [app] [W] Action failed
 | TypeError: can't convert nil into String
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-1.32.0/lib/fog/openstack/models/compute/server.rb:87:in `pack'
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-1.32.0/lib/fog/openstack/models/compute/server.rb:87:in `user_data='
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-core-1.32.0/lib/fog/core/attributes.rb:118:in `block in merge_attributes'
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-core-1.32.0/lib/fog/core/attributes.rb:113:in `each_pair'
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-core-1.32.0/lib/fog/core/attributes.rb:113:in `merge_attributes'
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-core-1.32.0/lib/fog/core/model.rb:20:in `initialize'
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-1.32.0/lib/fog/openstack/models/compute/server.rb:67:in `initialize'
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-core-1.32.0/lib/fog/core/collection.rb:89:in `new'
 | /opt/rh/ruby193/root/usr/share/gems/gems/fog-core-1.32.0/lib/fog/core/collection.rb:89:in `new'
 | /usr/share/foreman/app/models/compute_resource.rb:123:in `new_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:24:in `compute_object'
 | /usr/share/foreman/app/views/hosts/_compute.html.erb:1:in `_app_views_hosts__compute_html_erb__2860077454053786827_70025660232560'

The real error is:

2015-12-28 04:18:50 [app] [W] Failed to create a compute Openstack_Jenkins (OpenStack) instance stgweb811.example.com: Expected([200, 202]) <=> Actual(403 Forbidden)
 | excon.error.response
 |   :body          => "{\"forbidden\": {\"message\": \"Quota exceeded for instances: Requested 1, but already used 14 of 14 instances\", \"code\": 403}}" 
 |   :headers       => {
 |     "Content-Length"       => "121" 
 |     "Content-Type"         => "application/json; charset=UTF-8" 
 |     "Date"                 => "Mon, 28 Dec 2015 10:18:49 GMT" 
 |     "Retry-After"          => "0" 
 |     "X-Compute-Request-Id" => "req-7f2a68d3-fd96-47ee-bd4b-8e7808ca1de5" 
 |   }
 |   :local_address => "10.84.10.74" 
 |   :local_port    => 40189
 |   :reason_phrase => "Forbidden" 
 |   :remote_ip     => "10.84.8.217" 
 |   :status        => 403
 |   :status_line   => "HTTP/1.1 403 Forbidden\r\n" 
 | 
 |  
 | RuntimeError: Expected([200, 202]) <=> Actual(403 Forbidden)
 | excon.error.response
 |   :body          => "{\"forbidden\": {\"message\": \"Quota exceeded for instances: Requested 1, but already used 14 of 14 instances\", \"code\": 403}}" 
 |   :headers       => {
 |     "Content-Length"       => "121" 
 |     "Content-Type"         => "application/json; charset=UTF-8" 
 |     "Date"                 => "Mon, 28 Dec 2015 10:18:49 GMT" 
 |     "Retry-After"          => "0" 
 |     "X-Compute-Request-Id" => "req-7f2a68d3-fd96-47ee-bd4b-8e7808ca1de5" 
 |   }
 |   :local_address => "10.84.10.74" 
 |   :local_port    => 40189
 |   :reason_phrase => "Forbidden" 
 |   :remote_ip     => "10.84.8.217" 
 |   :status        => 403
 |   :status_line   => "HTTP/1.1 403 Forbidden\r\n" 
 | 
 | /usr/share/foreman/app/models/compute_resources/foreman/model/openstack.rb:93:in `rescue in create_vm'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/openstack.rb:77:in `create_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:76:in `setCompute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:152:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:97:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:89:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:89:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:19:in `on_save'

Associated revisions

Revision 3ce9810b (diff)
Added by Imri Zvik over 3 years ago

Fixes #12946 - Do not fail miserably when compute instance is not found.

Revision cce9172b (diff)
Added by Imri Zvik over 3 years ago

Fixes #12946 - Do not fail miserably when compute instance is not found.

(cherry picked from commit 3ce9810bc26e49a11ba6bc978deaf5520311efc8)

History

#1 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Imri Zvik
  • Pull request https://github.com/theforeman/foreman/pull/3006 added

#2 Updated by Imri Zvik over 3 years ago

The root cause of the first exception (TypeError: can't convert nil into String), is that the delUserData method (the rollback method) did not remove the :user_data attribute, but set it to nil instead. We should remove it instead.

#3 Updated by Imri Zvik over 3 years ago

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

#4 Updated by Dominic Cleal over 3 years ago

  • Legacy Backlogs Release (now unused) set to 104

Also available in: Atom PDF