Project

General

Profile

Bug #22809

[Foreman 1.17] Bug on host creation after migration

Added by Nicolas Rodriguez over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Difficulty:
Triaged:
Bugzilla link:

Description

Hello!

I've updated Foreman from 1.16 to 1.17-rc1 and get this error when trying to create a new host :

2018-03-07T11:27:46 5665aae3 [app] [I] Started POST "/hosts/interfaces" for 172.16.61.133 at 2018-03-07 11:27:46 +0100
2018-03-07T11:27:46 5665aae3 [app] [I] Processing by HostsController#interfaces as */*
2018-03-07T11:27:46 5665aae3 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"JzN+jXdOLvNqKdDoWkvzn4MA0EBO6jKkYfM+d6bItkkpEc6EXE0bwXd8Ve4gF+TcpMD41MeZX+KfgCeDCfIIPg==", "host"=>{"salt_module_ids"=>[""], "name"=>"adam-maertens", "hostgroup_id"=>"5", "compute_resource_id"=>"1", "salt_proxy_id"=>"3", "salt_environment_id"=>"", "managed"=>"true", "progr
ess_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"adam-maertens", "domain_id"=>"1", "subnet_id"=>"1", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "architecture_id"=>"1", "operatingsy
stem_id"=>"4", "provision_method"=>"build", "build"=>"1", "medium_id"=>"2", "ptable_id"=>"82", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"5-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "fakepassword"=>"[FILTERED]", "bare_metal_capabilities"=>"build"}
2018-03-07T11:27:46 5665aae3 [app] [I] Current user: aanriot (administrator)
2018-03-07T11:27:46 ea2b7171 [app] [I] Completed 200 OK in 2054ms (Views: 0.8ms | ActiveRecord: 1.3ms)
2018-03-07T11:27:46 5665aae3 [app] [W] Action failed
 | ActiveRecord::SerializationTypeMismatch: can't load `vm_attrs`: was supposed to be a Hash, but was a ActionController::Parameters. -- <ActionController::Parameters {"cpus"=>"2", "memory"=>"1073741824", "nics_attributes"=><ActionController::Parameters {"0"=><ActionController::Parameters {"type"=>"bridge", "bridge"=>"vmbr1", "model"=>"virtio"} permitted: true>
} permitted: true>, "volumes_attributes"=><ActionController::Parameters {"0"=><ActionController::Parameters {"pool_name"=>"default", "capacity"=>"10G", "allocation"=>"10G", "format_type"=>"qcow2"} permitted: true>} permitted: true>} permitted: true>
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/coders/yaml_column.rb:34:in `assert_valid_value'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/coders/yaml_column.rb:26:in `load'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/type/serialized.rb:20:in `deserialize'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute.rb:163:in `type_cast'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute.rb:38:in `value'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute_set.rb:45:in `fetch_value'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/read.rb:71:in `_read_attribute'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/read.rb:36:in `__temp__67d6f51647472737'
 | /usr/share/foreman/app/models/compute_attribute.rb:52:in `attribute_values'
 | /usr/share/foreman/app/models/compute_attribute.rb:32:in `vm_interfaces'
 | /usr/share/foreman/app/services/interface_merge.rb:11:in `run'
 | /usr/share/foreman/app/models/host/managed.rb:779:in `apply_compute_profile'
 | /usr/share/foreman/app/controllers/hosts_controller.rb:172:in `interfaces'

It seems that the serialization format has changed between 1.16 and 1.17, and ComputeAttribute values are not updated during the migration.
To solve this issue I had to manually convert vm_attrs from ActionController::Parameters to ActiveSupport::HashWithIndifferentAccess.

Thank you!


Related issues

Related to Foreman - Bug #22788: Wrong validation when creating image base host on ovirtClosed2018-03-06
Related to Foreman - Bug #21337: Config reports detail page brokenRejected2017-10-16
Related to Foreman - Bug #23131: Error when displaying config report after upgrade to 1.17Rejected2018-04-05

Associated revisions

Revision 7bd5816a (diff)
Added by Ondřej Pražák over 2 years ago

Fixes #22809 - Turn VM attributes to hash (#5403)

History

#2 Updated by Ondřej Pražák over 2 years ago

  • Assignee set to Ondřej Pražák

#3 Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5403 added

#4 Updated by Ondřej Pražák over 2 years ago

  • Related to Bug #22788: Wrong validation when creating image base host on ovirt added

#5 Updated by Marek Hulán over 2 years ago

  • Related to Bug #21337: Config reports detail page broken added

#6 Updated by Ondřej Pražák over 2 years ago

  • Related to Bug #23131: Error when displaying config report after upgrade to 1.17 added

#7 Updated by Marek Hulán over 2 years ago

  • Legacy Backlogs Release (now unused) set to 296

This will be cherrypicked to 1.17 so setting the release like that right away

#8 Updated by The Foreman Bot over 2 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5426 added

#9 Updated by Anonymous over 2 years ago

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

#10 Updated by The Foreman Bot over 2 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5429 added

#11 Updated by Marek Hulán over 2 years ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/5429)

Removing unmerged PR

Also available in: Atom PDF