Project

General

Profile

Bug #13107

Compute attributes are stored without indifferent access

Added by Lukas Zapletal almost 4 years ago. Updated over 1 year ago.

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

Description

Instead of nice error, we error out with:

Failed to login via SSH to xxx: undefined method `username' for nil:NilClass

I think in this case when image was not selected, we should simply skip ssh provisioning. Another option is to raise an error.

Associated revisions

Revision 65b6d7c4 (diff)
Added by Lukas Zapletal almost 4 years ago

Fixes #13107 - compute attributes has indifferent access again

During upgrade to Rails 4.1, our host#create code no longer sends attributes
into the ActiveRecord create/new initializers with indifferent access. One
of these attributes, `compute_attributes` then does not work breaking
provisioning completely.

History

#1 Updated by Lukas Zapletal almost 4 years ago

Oh it looks like this error triggers always, even if you select an image. Testing with OS.

#2 Updated by Lukas Zapletal almost 4 years ago

Looks like the image gets stored properly (image_ref) but the ssh_provision orchestrator is returned nil:

2016-01-11T11:51:14 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"xxxx+BtOzpO938g=", "host"=>{"name"=>"lzap-test-04", "organization_id"=>"3", "location_id"=>"1", "hostgroup_id"=>"7", "compute_resource_id"=>"5", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"lzap-test-04", "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"192.168.122.20", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "compute_attributes"=>{"flavor_ref"=>"83098b08-7339-4089-bc07-3f2a14b7a4c1", "availability_zone"=>"", "tenant_id"=>"2f58867f4fa54a09a266b26ef410d313", "security_groups"=>"lzap-group", "nics"=>[""], "network"=>"os1_internal", "boot_from_volume"=>"false", "size_gb"=>"", "image_ref"=>"2695dbd9-e1b1-47a8-9ac3-4e8854aa55aa"}, "architecture_id"=>"1", "operatingsystem_id"=>"5", "provision_method"=>"image", "build"=>"1", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"1-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"image", "provider"=>"Openstack", "bare_metal_capabilities"=>"build"}

Host -> Image reference does not get updated properly.

#3 Updated by Lukas Zapletal almost 4 years ago

  • Subject changed from When image is not selected, ssh provisioning fails to Image reference is not stored, ssh provisioning fails

#4 Updated by Lukas Zapletal almost 4 years ago

It looks like again, hash with symbol vs string in my case:

[8] pry(#<Host::Managed>)> compute_attributes
=> {"flavor_ref"=>"83098b08-7339-4089-bc07-3f2a14b7a4c1",
 "availability_zone"=>"",
 "tenant_id"=>"2f58867f4fa54a09a266b26ef410d313",
 "security_groups"=>"lzap-group",
 "nics"=>[""],
 "network"=>"os1_internal",
 "boot_from_volume"=>"false",
 "size_gb"=>"",
 "image_ref"=>"2695dbd9-e1b1-47a8-9ac3-4e8854aa55aa",
 "interfaces_attributes"=>{"0"=>{}}}
[9] pry(#<Host::Managed>)> compute_attributes[:image_ref]
=> nil

#5 Updated by Lukas Zapletal almost 4 years ago

  • Subject changed from Image reference is not stored, ssh provisioning fails to Compute attributes are stored without indifferent access

So this is all about indifferent access, looks like the attribute is somehow converted back to regular hash, which breaks our code.

#6 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 71

#7 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Lukas Zapletal
  • Pull request https://github.com/theforeman/foreman/pull/3051 added

#8 Updated by Lukas Zapletal almost 4 years ago

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

Also available in: Atom PDF