Project

General

Profile

Bug #23335

Cannot create VM in a vCenter. NoMethodError.

Added by David Fuellgraf over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Compute resources - VMware
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Hi,

i try to install a Debian VM within a vCenter Cluster. Connection to the vCenter cluster is working. But every time i try to deploy a VM, i always get this error:

Failed to create a compute Cluster-HQ (VMware) instance lloyd-zoldesy.dv.nil: undefined method `attributes' for #<String:0x007f8bdcfd70b8>
 |  
 | NoMethodError: undefined method `attributes' for #<String:0x007f8bdcfd70b8>
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:198:in `create_controller'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `block in device_change'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each_with_index'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `map'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `device_change'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:17:in `create_vm'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/models/compute/server.rb:303:in `save'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:447:in `create_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:77:in `setCompute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:222:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:145:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:44:in `around_save_orchestration'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:336:in `create_or_update'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:129:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/validations.rb:44:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:35:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block (2 levels) in save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
 | /usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block in save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:307:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/suppressor.rb:42:in `save'
 | /usr/share/foreman/app/models/concerns/foreman/sti.rb:26:in `save'
 | /usr/share/foreman/app/controllers/hosts_controller.rb:106:in `create'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/audited-4.5.0/lib/audited/sweeper.rb:14:in `around'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/audited-4.5.0/lib/audited/sweeper.rb:14:in `around'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/static_dispatcher.rb:65:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/extractor/recorder.rb:136:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/etag.rb:25:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/conditional_get.rb:38:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/head.rb:12:in `call'
 | /usr/share/foreman/lib/middleware/session_safe_logging.rb:17:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:232:in `context'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:226:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/runtime.rb:22:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/secure_headers-3.7.3/lib/secure_headers/middleware.rb:12:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:68:in `block in call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `call'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:160:in `accept_and_process_next_request'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

As i just started to learn ruby, i don't know how to debug this correctly.

KR
David


Related issues

Related to Foreman - Bug #23342: vsphere - failed to create resource - undefined method firstDuplicate2018-04-19
Related to Foreman - Bug #23378: Unable to create a VM on 1.17.0 on vCenter 6.5.Closed2018-04-24
Related to Foreman - Bug #23429: VMWare: Cannot create VM in a vCenter. NoMethodError. still not fixed: -> 23335New2018-04-27
Has duplicate Foreman - Bug #23431: clone_vm No :volumes key in args Duplicate2018-04-27
Has duplicate Foreman - Bug #23513: Foreman 1.17-stable: can not create vmware guest using vmware compute resource.Duplicate2018-05-04
Has duplicate Foreman - Bug #23584: Cannot create a vm on any VCSA: undefined method `attributes' Duplicate2018-05-14

Associated revisions

Revision 397ea488 (diff)
Added by Timo Goebel over 1 year ago

fixes #23335 - normalize scsi attributes in rails 5 (#5475)

History

#1 Updated by David Fuellgraf over 1 year ago

  • Subject changed from Cannot create VM in a vCenter. to Cannot create VM in a vCenter. NoMethodError.

#2 Updated by Michael Moll over 1 year ago

  • Category set to Compute resources - VMware
  • Project changed from Deployments to Foreman

#3 Updated by Daniel Lobato Garcia over 1 year ago

  • Legacy Backlogs Release (now unused) set to 297

Someone else reported this on IRC when upgrading to 1.17 - marking as 1.17.1

#4 Updated by Ian Mordey over 1 year ago

Daniel Lobato Garcia wrote:

Someone else reported this on IRC when upgrading to 1.17 - marking as 1.17.1

That'll be me. Upgrade from 1.16 to 1.17 on CentOS 7. Get this when I click submit to create a new host:

2018-04-19 11:17:04 070ab2bf [app] [I] Processing by HostsController#create as */*
2018-04-19 11:17:04 070ab2bf [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"xxxx", "host"=>{"name"=>"essie-moring", "hostgroup_id"=>"", "compute_resource_id"=>"2", "environment_id"=>"1", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "realm_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"essie-moring", "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"10.8.12.221", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-25"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"2048", "firmware"=>"automatic", "cluster"=>"ASHB_PROD", "resource_pool"=>"Resources", "path"=>"/Datacenters/ASHB/vm", "guest_id"=>"centos7_64Guest", "hardware_version"=>"vmx-13", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"0", "start"=>"1", "annotation"=>"", "scsi_controllers"=>"{\"scsiControllers\":[{\"type\":\"VirtualLsiLogicController\",\"key\":1000}],\"volumes\":[{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"persistent\",\"controllerKey\":1000,\"size\":10485760,\"sizeGb\":10,\"key\":\"8edaab60-43e4-11e8-a4b5-bd23a1c81764\",\"datastore\":\"PROD_DS2\"}]}"}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"build", "build"=>"1", "medium_id"=>"1", "ptable_id"=>"88", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"6-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image", "provider"=>"Vmware", "bare_metal_capabilities"=>"build"}
2018-04-19 11:17:04 070ab2bf [app] [I] Current user: ian.mordey (administrator)
2018-04-19 11:17:04 070ab2bf [app] [I] Adding Compute instance for essie-moring.example.com
2018-04-19 11:17:04 070ab2bf [app] [W] Failed to create a compute prod03.ashb (VMware) instance essie-moring.example.com: undefined method `attributes' for #<String:0x0000000692a328>
 |
 | NoMethodError: undefined method `attributes' for #<String:0x0000000692a328>
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:198:in `create_controller'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `block in device_change'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each_with_index'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `map'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `device_change'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/create_vm.rb:17:in `create_vm'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.1.0/lib/fog/vsphere/models/compute/server.rb:303:in `save'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:447:in `create_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:77:in `setCompute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:222:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:145:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:44:in `around_save_orchestration'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:336:in `create_or_update'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/persistence.rb:129:in `save'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/validations.rb:44:in `save'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:35:in `save'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block (2 levels) in save'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
 | /opt/rh/rh-ruby24/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block in save'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:307:in `save'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/suppressor.rb:42:in `save'
 | /usr/share/foreman/app/models/concerns/foreman/sti.rb:26:in `save'
 | /usr/share/foreman/app/controllers/hosts_controller.rb:106:in `create'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/sweeper.rb:14:in `around'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/sweeper.rb:14:in `around'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/static_dispatcher.rb:65:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/extractor/recorder.rb:136:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/etag.rb:25:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/conditional_get.rb:38:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/head.rb:12:in `call'
 | /usr/share/foreman/lib/middleware/session_safe_logging.rb:17:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:232:in `context'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/runtime.rb:22:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-3.4.1/lib/secure_headers/middleware.rb:12:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/urlmap.rb:68:in `block in call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in `each'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in `call'
 | /usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
 | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
 | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
 | /usr/share/passenger/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
2018-04-19 11:17:04 070ab2bf [app] [W] Rolling back due to a problem: [#<Orchestration::Task:0x00000006f019e0 @name="Set up compute instance essie-moring.aexample.com", @status="failed", @priority=2, @action=[#<Host::Managed id: nil, name: "essie-moring.example.com", last_compile: nil, last_report: nil, updated_at: nil, created_at: nil, root_pass: "xxxx.", architecture_id: 1, operatingsystem_id: 1, environment_id: 1, ptable_id: 88, medium_id: 1, build: true, comment: "", disk: "", installed_at: nil, model_id: nil, hostgroup_id: nil, owner_id: 6, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: 2, puppet_proxy_id: 1, certname: nil, image_id: nil, organization_id: nil, location_id: nil, type: "Host::Managed", otp: nil, realm_id: 1, compute_profile_id: nil, provision_method: "build", grub_pass: "xxxxx.", global_status: 0, lookup_value_matcher: "fqdn=essie-moring.example.com", pxe_loader: "PXELinux BIOS">, :setCompute], @timestamp=2018-04-19 15:17:04 UTC>]
2018-04-19 11:17:04 070ab2bf [app] [I] Processed 1 tasks from queue 'Host::Managed Main', completed 0/9
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Set up compute instance essie-moring.example.com' *failed*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Query instance details for essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Create DHCP Settings for essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Deploy TFTP PXEGrub2 config for essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Deploy TFTP PXELinux config for essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Deploy TFTP PXEGrub config for essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Fetch TFTP boot files for essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Create realm entry for essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [E] Task 'Power up compute instance essie-moring.example.com' *canceled*
2018-04-19 11:17:04 070ab2bf [app] [I] Failed to save: Failed to create a compute prod03.ashb (VMware) instance essie-moring.example.com: undefined method `attributes' for #<String:0x0000000692a328>
 |

#5 Updated by Adonis Serban over 1 year ago

I have the same issue.
I got this after an upgrade from 1.16 to 1.17
I made a clean install ( 1.17. RC2 , 1.17.0-1, 1.18-devel ) and they all game me the same error when i try to deploy a new vm on vcenter 6.5.
All this tests were made initially on a Debian 9 system. After all of it failed i installed centos 7 ( latest stable ) and the result was the same . This does not seem to be an OS problem.
Puppet version was 5.5 (latest stable from repo ).

#6 Updated by Michael Eklund over 1 year ago

Same issue for me. Foreman 1.17 after upgrade from 1.16.

2018-04-20T17:10:54 3a6b846f [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"/xxx", "host"=>{"name"=>"test", "location_id"=>"1", "hostgroup_id"=>"12", "compute_resource_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"test", "domain_id"=>"1", "subnet_id"=>"3", "ip"=>"10.10.51.25", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-645"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"4096", "firmware"=>"bios", "cluster"=>"EVC Sandy Bridge", "resource_pool"=>"Resources", "path"=>"/Datacenters/xxx/vm", "guest_id"=>"ubuntu64Guest", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"1", "cpuHotAddEnabled"=>"1", "add_cdrom"=>"0", "start"=>"1", "annotation"=>"", "scsi_controllers"=>"{\"scsiControllers\":[{\"type\":\"ParaVirtualSCSIController\",\"key\":1000}],\"volumes\":[{\"thin\":\"true\",\"name\":\"Hard disk 1\",\"mode\":\"persistent\",\"controllerKey\":1000,\"datastore\":\"xxx\",\"size\":16777216,\"sizeGb\":16,\"eagerZero\":\"false\"},{\"thin\":\"true\",\"name\":\"Hard disk 2\",\"mode\":\"persistent\",\"controllerKey\":1000,\"datastore\":\"xxx\",\"size\":16777216,\"sizeGb\":16,\"eagerZero\":\"false\"}]}"}, "architecture_id"=>"1", "operatingsystem_id"=>"28", "provision_method"=>"build", "build"=>"1", "medium_id"=>"7", "ptable_id"=>"51", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"5-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image", "provider"=>"Vmware", "bare_metal_capabilities"=>"build"}
2018-04-20T17:10:54 3a6b846f [app] [I] Current user: meklund (administrator)
2018-04-20T17:10:55 3a6b846f [app] [I] Adding Compute instance for test.xxx.net
2018-04-20T17:10:55 3a6b846f [app] [W] Failed to create a compute VMware (VMware) instance test.xxx.net: undefined method `attributes' for #<String:0x007fdab0ec11d8>
 |
 | NoMethodError: undefined method `attributes' for #<String:0x007fdab0ec11d8>
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:198:in `create_controller'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `block in device_change'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each_with_index'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `map'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `device_change'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:17:in `create_vm'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/models/compute/server.rb:303:in `save'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:447:in `create_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:77:in `setCompute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:222:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:145:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:44:in `around_save_orchestration'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:336:in `create_or_update'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:129:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/validations.rb:44:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:35:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block (2 levels) in save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
 | /usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block in save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:307:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/suppressor.rb:42:in `save'
 | /usr/share/foreman/app/models/concerns/foreman/sti.rb:26:in `save'
 | /usr/share/foreman/app/controllers/hosts_controller.rb:106:in `create'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/audited-4.5.0/lib/audited/sweeper.rb:14:in `around'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/audited-4.5.0/lib/audited/sweeper.rb:14:in `around'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/static_dispatcher.rb:65:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/extractor/recorder.rb:136:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/etag.rb:25:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/conditional_get.rb:38:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/head.rb:12:in `call'
 | /usr/share/foreman/lib/middleware/session_safe_logging.rb:17:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:232:in `context'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:226:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/runtime.rb:22:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/secure_headers-3.7.3/lib/secure_headers/middleware.rb:12:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:68:in `block in call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `call'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:160:in `accept_and_process_next_request'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2018-04-20T17:10:55 3a6b846f [app] [W] Rolling back due to a problem: [#<Orchestration::Task:0x007fdab139f380 @name="Set up compute instance test.xxx.net", @status="failed", @priority=2, @action=[#<Host::Managed id: nil, name: "test.xxx.net", last_compile: nil, last_report: nil, updated_at: nil, created_at: nil, root_pass: "xxx.", architecture_id: 1, operatingsystem_id: 28, environment_id: 1, ptable_id: 51, medium_id: 7, build: true, comment: "", disk: "", installed_at: nil, model_id: nil, hostgroup_id: 12, owner_id: 5, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: 1, puppet_proxy_id: 1, certname: nil, image_id: nil, organization_id: nil, location_id: 1, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: 1, provision_method: "build", grub_pass: "xxx.", global_status: 0, lookup_value_matcher: "fqdn=test.xxx.net", discovery_rule_id: nil, pxe_loader: "PXELinux BIOS">, :setCompute], @timestamp=2018-04-20 21:10:55 UTC>]

#7 Updated by Stephan Schultchen over 1 year ago

i am also hitting this bug after switching from 1.16.1 to 1.17.0

#8 Updated by Timo Goebel over 1 year ago

  • Assignee set to Timo Goebel

I'll take ownership of this issue for now.

#9 Updated by The Foreman Bot over 1 year ago

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

#10 Updated by Timo Goebel over 1 year ago

This PR should contain a fix for this. Please let us know if this works for you.

https://github.com/theforeman/foreman/pull/5475

To apply the patch manually, you can do something like this:

wget -O ~/vmware.patch https://patch-diff.githubusercontent.com/raw/theforeman/foreman/pull/5475.patch
cd /usr/share/foreman
patch -p1 < ~/vmware.patch

#11 Updated by Ian Mordey over 1 year ago

I get this using your instructions:

patching file app/controllers/concerns/foreman/controller/parameters/host.rb
Hunk #1 FAILED at 2.
Hunk #2 FAILED at 31.
2 out of 2 hunks FAILED -- saving rejects to file app/controllers/concerns/foreman/controller/parameters/host.rb.rej
patching file app/controllers/hosts_controller.rb
Hunk #1 succeeded at 9 with fuzz 1.
Hunk #3 FAILED at 889.
1 out of 3 hunks FAILED -- saving rejects to file app/controllers/hosts_controller.rb.rej
can't find file to patch at input line 73
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/test/controllers/concerns/parameters/host_test.rb b/test/controllers/concerns/parameters/host_test.rb
|index 54edbf535a..5d9e26c3ad 100644
|--- a/test/controllers/concerns/parameters/host_test.rb
|+++ b/test/controllers/concerns/parameters/host_test.rb
--------------------------
File to patch:
Skip this patch? [y] y
Skipping patch.
2 out of 2 hunks ignored

#12 Updated by Timo Goebel over 1 year ago

Ian Mordey wrote:

I get this using your instructions:
[...]

Ian, please try this patch. It's rebased against 1.17-stable and should apply cleanly:

https://gist.github.com/timogoebel/783d746a524964d8d81a8b7a828969a0

https://github.com/theforeman/foreman/pull/5481.patch

#13 Updated by Timo Goebel over 1 year ago

  • Related to Bug #23342: vsphere - failed to create resource - undefined method first added

#14 Updated by Ian Mordey over 1 year ago

I ran the patch and got this:

[root@prodfm03 foreman]# patch -p1 < ~/gistfile1.txt
patching file app/controllers/concerns/foreman/controller/parameters/host.rb
patching file app/controllers/hosts_controller.rb
can't find file to patch at input line 65
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/test/controllers/concerns/parameters/host_test.rb b/test/controllers/concerns/parameters/host_test.rb
|index 54edbf535..5d9e26c3a 100644
|--- a/test/controllers/concerns/parameters/host_test.rb
|+++ b/test/controllers/concerns/parameters/host_test.rb
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
patch unexpectedly ends in middle of line

Restarted httpd and still get:

Failed to create a compute prod03.ashb (VMware) instance <host_name>: undefined method `attributes' for #<String:0x007fe6cbcf11d8>

Have I patched correctly? Anything else I need to do?

#15 Updated by Michael Moll over 1 year ago

Anything else I need to do?

restart apache

#16 Updated by Ian Mordey over 1 year ago

I did a systemctl restart httpd then attempted another build.

#17 Updated by Adonis Serban over 1 year ago

I gave both patches a try too but i got patch errors :

@patching file app/controllers/concerns/foreman/controller/parameters/host.rb
patching file app/controllers/hosts_controller.rb
can't find file to patch at input line 65
Perhaps you used the wrong p or --strip option?
The text leading up to this was:
-------------------------
|diff --git a/test/controllers/concerns/parameters/host_test.rb b/test/controllers/concerns/parameters/host_test.rb |index 54edbf535..5d9e26c3a 100644 |--- a/test/controllers/concerns/parameters/host_test.rb |+++ b/test/controllers/concerns/parameters/host_test.rb
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
patch unexpectedly ends in middle of line
@

#18 Updated by David Fuellgraf over 1 year ago

the first patch, patches a file(app/controllers/concerns/foreman/controller/parameters/host.rb), which does not exist in my installation.

#19 Updated by Stephan Schultchen over 1 year ago

i was able to fix my installation by adjusting the provisioning templates. it seems like wit 1.17.0 some things where deprecated for example i had to change:

-<% if @host.param_true?('disable-firewall') ->
+<
if host_params('disable-firewall')? -%>

-TIMEOUT <%= @host.params['loader_timeout'] || 10 %>
+TIMEOUT <%= host_param('loader_timeout') || 10 %>

#20 Updated by Adonis Serban over 1 year ago

Stephan Schultchen wrote:

i was able to fix my installation by adjusting the provisioning templates. it seems like wit 1.17.0 some things where deprecated for example i had to change:

-<% if @host.param_true?('disable-firewall') ->
+<
if host_params('disable-firewall')? -%>

-TIMEOUT <%= @host.params['loader_timeout'] || 10 %>
+TIMEOUT <%= host_param('loader_timeout') || 10 %>

Can you provide a full example ?

#21 Updated by Stephan Schultchen over 1 year ago

adonis serban: this is all that i had to change. seems like .param_true, .param_false, and the to access an variable are deprecated.

@foreman team:

i also noticed that i still get the "...undefined method `attributes' for..." when i use the web interface. this happens after pressing "submit" button. when i hit the submit button a second time, it will create the host. this is wired.

when creating the host via hammer on the cli, i get this error:

/opt/theforeman/tfm/root/usr/share/gems/gems/logging-1.8.2/lib/logging/appender.rb:139: warning: constant ::Fixnum is deprecated
/opt/theforeman/tfm/root/usr/share/gems/gems/awesome_print-1.7.0/lib/awesome_print/formatters/base_formatter.rb:31: warning: constant ::Fixnum is deprecated
/opt/theforeman/tfm/root/usr/share/gems/gems/awesome_print-1.7.0/lib/awesome_print/formatters/base_formatter.rb:31: warning: constant ::Fixnum is deprecated
/opt/theforeman/tfm/root/usr/share/gems/gems/awesome_print-1.7.0/lib/awesome_print/formatters/base_formatter.rb:31: warning: constant ::Fixnum is deprecated
uninitialized constant Fog::Compute::Ovirt

seeing a message related to "Ovirt" is suspicious, since we are using vmware.

#22 Updated by The Foreman Bot over 1 year ago

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

#23 Updated by The Foreman Bot over 1 year ago

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

#24 Updated by Timo Goebel over 1 year ago

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

#25 Updated by Stephan Schultchen over 1 year ago

i now have applied the patch from https://github.com/theforeman/foreman/pull/5481, i still have the issue that i get "Failed to create a compute VSphere (VMware) instance hostname.example.com: undefined method `attributes' for #<String:0x007f5ded08e718>.

at least for me, the patch is not resolving the issue

#26 Updated by Marek Hulán over 1 year ago

Sorry for obvious, have you restarted Foreman/httpd after applying the patch? It worked locally.

#27 Updated by Stephan Schultchen over 1 year ago

yes, i restarted httpd

#28 Updated by Michael Eklund over 1 year ago

I also am still getting the error after patching with 5481, though I did skip patching test/controllers/concerns/parameters/host_test.rb since I installed via packages and do not have the test directory.

I even double checked that app/controllers/concerns/foreman/controller/parameters/host.rb and app/controllers/hosts_controller.rb were patched.

2018-04-23T11:08:06 ba7242a9 [app] [W] Failed to create a compute HSV_VMware (VMware) instance test.example.net: undefined method `attributes' for #<String:0x007fcab16522e0>
 |
 | NoMethodError: undefined method `attributes' for #<String:0x007fcab16522e0>
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:198:in `create_controller'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `block in device_change'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each_with_index'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `map'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:101:in `device_change'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/requests/compute/create_vm.rb:17:in `create_vm'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.1/lib/fog/vsphere/models/compute/server.rb:303:in `save'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:447:in `create_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:77:in `setCompute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:222:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:145:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:137:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:44:in `around_save_orchestration'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:336:in `create_or_update'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:129:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/validations.rb:44:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:35:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block (2 levels) in save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
 | /usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:308:in `block in save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:307:in `save'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/suppressor.rb:42:in `save'
 | /usr/share/foreman/app/models/concerns/foreman/sti.rb:26:in `save'
 | /usr/share/foreman/app/controllers/hosts_controller.rb:104:in `create'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/audited-4.5.0/lib/audited/sweeper.rb:14:in `around'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/audited-4.5.0/lib/audited/sweeper.rb:14:in `around'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/static_dispatcher.rb:65:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/extractor/recorder.rb:136:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/apipie-rails-0.5.7/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/etag.rb:25:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/conditional_get.rb:38:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/head.rb:12:in `call'
 | /usr/share/foreman/lib/middleware/session_safe_logging.rb:17:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:232:in `context'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:226:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/runtime.rb:22:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/secure_headers-3.7.3/lib/secure_headers/middleware.rb:12:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:68:in `block in call'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `each'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in `call'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:160:in `accept_and_process_next_request'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
 | /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

#29 Updated by Timo Goebel over 1 year ago

Tests against the 1.17-branch also suggest, this does not quite work there. I have only tested this in develop.

https://github.com/theforeman/foreman/pull/5481

Sorry guys - or thanks for testing. I'll look into it.

#30 Updated by Michael Eklund over 1 year ago

A bit more investigating, first submit on create host I get the unable to save popup.

Failed to create a compute HSV_VMware (VMware) instance test.example.net: undefined method `attributes' for #<String:0x007fcab16522e0>

if I hit submit again it does create the VM, and the popup eventually goes away on it's own, but the VM is not booted.

#31 Updated by Timo Goebel over 1 year ago

The patch against 1.17-stable needed some work. If you want to try it, make sure to undo any previous patches (patch -R, I believe) and try this one.

https://github.com/theforeman/foreman/pull/5481.patch

#32 Updated by Ian Mordey over 1 year ago

Applied the latest patch and restart Apache. Get a different error now:

Failed to create a compute prod03.ashb (VMware) instance irvin-catania.example.com: InvalidRequest: Cannot parse "70aa0880-4799-11e8-b3ab-d7400f90b035" as an int value while parsing serialized value of type int at line 1, column 1394 while parsing property "key" of static type int while parsing serialized DataObject of type vim.vm.device.VirtualDisk at line 1, column 1363 while parsing property "device" of static type VirtualDevice while parsing serialized DataObject of type vim.vm.device.VirtualDeviceSpec at line 1, column 1251 while parsing property "deviceChange" of static type ArrayOfVirtualDeviceConfigSpec while parsing serialized DataObject of type vim.vm.ConfigSpec at line 1, column 247 while parsing call information for method CreateVM_Task at line 1, column 177 while parsing SOAP body at line 1, column 167 while parsing SOAP envelope at line 1, column 0 while parsing HTTP request for method createVm on object of type vim.Folder at line 1, column 0 

production.log is a little more readable:

InvalidRequest:
 | Cannot parse "70aa0880-4799-11e8-b3ab-d7400f90b035" as an int value
 |
 | while parsing serialized value of type int
 | at line 1, column 1394
 |
 | while parsing property "key" of static type int
 |
 | while parsing serialized DataObject of type vim.vm.device.VirtualDisk
 | at line 1, column 1363
 |
 | while parsing property "device" of static type VirtualDevice
 |
 | while parsing serialized DataObject of type vim.vm.device.VirtualDeviceSpec
 | at line 1, column 1251
 |
 | while parsing property "deviceChange" of static type ArrayOfVirtualDeviceConfigSpec
 |
 | while parsing serialized DataObject of type vim.vm.ConfigSpec
 | at line 1, column 247
 |
 | while parsing call information for method CreateVM_Task
 | at line 1, column 177
 |
 | while parsing SOAP body
 | at line 1, column 167
 |
 | while parsing SOAP envelope
 | at line 1, column 0
 |
 | while parsing HTTP request for method createVm
 | on object of type vim.Folder
 | at line 1, column 0
 |

#33 Updated by Timo Goebel over 1 year ago

Ian, can you please file a separate issue for this and include the complete stack trace, if you clone a host or create a new vm and your vsphere version. Thanks.

#34 Updated by Ian Mordey over 1 year ago

Timo Goebel wrote:

Ian, can you please file a separate issue for this and include the complete stack trace, if you clone a host or create a new vm and your vsphere version. Thanks.

Sure. http://projects.theforeman.org/issues/23378

#35 Updated by Ian Mordey over 1 year ago

  • Related to Bug #23378: Unable to create a VM on 1.17.0 on vCenter 6.5. added

#36 Updated by Michael Moll over 1 year ago

  • Has duplicate Bug #23431: clone_vm No :volumes key in args added

#37 Updated by Michael Moll over 1 year ago

  • Has duplicate Bug #23513: Foreman 1.17-stable: can not create vmware guest using vmware compute resource. added

#38 Updated by Evgeni Golov over 1 year ago

  • Has duplicate Bug #23584: Cannot create a vm on any VCSA: undefined method `attributes' added

#39 Updated by Eric Hansen over 1 year ago

Hit this upgrading from 1.16rc2 to 1.17.1

I had no issues deploying VM's beforehand.

#40 Updated by Eric Hansen over 1 year ago

Eric Hansen wrote:

Hit this upgrading from 1.16rc2 to 1.17

I had no issues deploying VM's beforehand.

#41 Updated by Eric Hansen over 1 year ago

  • Legacy Backlogs Release (now unused) changed from 297 to 296

Eric Hansen wrote:

Hit this upgrading from 1.16rc2 to 1.17

I had no issues deploying VM's beforehand.

#42 Updated by Tomer Brisker about 1 year ago

  • Related to Bug #23429: VMWare: Cannot create VM in a vCenter. NoMethodError. still not fixed: -> 23335 added

#43 Updated by David Surey about 1 year ago

  • Triaged set to No

Hey guys,

i do get the error mentioned in https://projects.theforeman.org/issues/23342 with version 1.18 as well.
1.17 is working for me though.
Is patch https://github.com/theforeman/foreman/pull/5481.patch merged to 1.18?

Cheers!

Also available in: Atom PDF