Project

General

Profile

Actions

Bug #22809

closed

[Foreman 1.17] Bug on host creation after migration

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

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Fixed in Releases:
Found in Releases:

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 3 (0 open3 closed)

Related to Foreman - Bug #22788: Wrong validation when creating image base host on ovirtClosedOri Rabin03/06/2018Actions
Related to Foreman - Bug #21337: Config reports detail page brokenRejectedMarek Hulán10/16/2017Actions
Related to Foreman - Bug #23131: Error when displaying config report after upgrade to 1.17RejectedOndřej Pražák04/05/2018Actions
Actions #2

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

  • Assignee set to Ondřej Pražák
Actions #3

Updated by The Foreman Bot over 6 years ago

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

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

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

Updated by Marek Hulán over 6 years ago

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

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

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

Updated by Marek Hulán over 6 years ago

  • Translation missing: en.field_release set to 296

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

Actions #8

Updated by The Foreman Bot over 6 years ago

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

Updated by Anonymous over 6 years ago

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

Updated by The Foreman Bot over 6 years ago

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

Updated by Marek Hulán over 6 years ago

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

Removing unmerged PR

Actions

Also available in: Atom PDF