Vmware provisioning fails with error "Render user data template for <hostname> task failed with the following error: undefined method '#params' for Host::Managed::Jail (Host::Managed)"

Problem:
vmware provisioning is failing with the error:

2019-01-14T06:03:00 [I|app|] Started POST "/hosts" for y.y.y.y at 2019-01-14 06:03:00 -0500
2019-01-14T06:03:00 [I|app|f9574] Processing by HostsController#create as */*
2019-01-14T06:03:00 [I|app|f9574]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"" "host"=>{"name"=>"nodename", "hostgroup_id"=>"2", "compute_resource_id"=>"1", "environment_id"=>"2", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"nodename", "domain_id"=>"1", "subnet_id"=>"", "ip"=>"x.x.x.x", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"XXXX"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"2048", "firmware"=>"bios", "cluster"=>"clustername", "resource_pool"=>"resourcename", "path"=>"/Datacenters/clustername/resourcename", "guest_id"=>"rhel7_64Guest", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"0", "start"=>"1", "annotation"=>"", "scsi_controllers"=>"{\"scsiControllers\":[{\"type\":\"ParaVirtualSCSIController\",\"key\":1000}],\"volumes\":[{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"persistent\",\"controllerKey\":1000,\"size\":10485760,\"sizeGb\":10,\"storagePod\":\"storage_pod_name\"}]}", "image_id"=>"image_id_no"}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "pxe_loader"=>"", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "comment"=>"", "overwrite"=>"false"}}
2019-01-14T06:03:00 [I|app|f9574] Current user set to admin (admin)
2019-01-14T06:03:00 [D|app|f9574] Enqueued task 'Render user data template for nodename.org' to 'Host::Managed Main' queue
2019-01-14T06:03:00 [D|app|f9574] Enqueued task 'Set up compute instance nodename.org' to 'Host::Managed Main' queue
2019-01-14T06:03:00 [D|app|f9574] Enqueued task 'Query instance details for nodename.org' to 'Host::Managed Main' queue
2019-01-14T06:03:00 [D|app|f9574] Enqueued task 'Power up compute instance nodename.org' to 'Host::Managed Main' queue
2019-01-14T06:03:00 [D|app|f9574] Enqueued task 'Cleanup PuppetCA certificates for nodename.org' to 'Host::Managed Post' queue
2019-01-14T06:03:00 [D|app|f9574] Enqueued task 'Enable PuppetCA autosigning for nodename.org' to 'Host::Managed Post' queue
2019-01-14T06:03:00 [D|app|f9574] Processing task 'Render user data template for nodename.org' from 'Host::Managed Main'
2019-01-14T06:03:00 [I|app|f9574] Rendering UserData template for nodename.org
2019-01-14T06:03:00 [D|app|f9574] Current organization set to none
2019-01-14T06:03:00 [D|app|f9574] Current location set to none
2019-01-14T06:03:00 [D|app|f9574] Current location set to none
2019-01-14T06:03:00 [D|app|f9574] Current organization set to none
2019-01-14T06:03:00 [E|app|f9574] Could not find a provider for nodename.org. Providers returned {"MediumProviders::Default"=>["RedHat 7.4 medium was not set for host 'nodename.org'", "Invalid medium '' for 'RedHat 7.4'"]}
2019-01-14T06:03:00 [W|app|f9574] Render user data template for nodename.org task failed with the following error: undefined method '#params' for Host::Managed::Jail (Host::Managed)
Safemode::NoMethodError: undefined method '#params' for Host::Managed::Jail (Host::Managed)
/opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode/jail.rb:22:in `method_missing'
userdata vmware:52:in `bind'
/opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode.rb:51:in `eval'
/opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode.rb:51:in `eval'
/usr/share/foreman/lib/foreman/renderer/safe_mode_renderer.rb:7:in `render'
/usr/share/foreman/lib/foreman/renderer/base_renderer.rb:16:in `render'
/usr/share/foreman/lib/foreman/renderer.rb:47:in `render'
/usr/share/foreman/app/models/template.rb:173:in `render'
/usr/share/foreman/app/models/host/base.rb:352:in `render_template'
/usr/share/foreman/app/models/concerns/orchestration/compute.rb:106:in `setUserData'
/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-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in `_run_save_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in `create_or_update'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/persistence.rb:275:in `save'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/validations.rb:46:in `save'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:310:in `block (2 levels) in save'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `block in transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/opt/rh/rh-ruby25/root/usr/share/ruby/monitor.rb:226:in `mon_synchronize'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:310:in `block in save'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:325:in `rollback_active_record_state!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:309:in `save'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:44: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'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118: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-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/static_dispatcher.rb:65:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/extractor/recorder.rb:137:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/share/foreman/lib/middleware/telemetry.rb:9:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/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-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/tempfile_reaper.rb:15:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/conditional_get.rb:38:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/head.rb:12:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/share/foreman/lib/middleware/logging_context.rb:23:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.0.0/lib/secure_headers/middleware.rb:13:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/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-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2019-01-14T06:03:00 [W|app|f9574] Rolling back due to a problem: [#<Orchestration::Task:0x00007feb1022f918 @name="Render user data template for nodename.org", @id="Render user data template for nodename.org", @status="failed", @priority=1, @action=[#<Host::Managed id: nil, name: "nodename.org", last_compile: nil, last_report: nil, updated_at: nil, created_at: nil, root_pass: "", architecture_id: 1, operatingsystem_id: 1, environment_id: 2, ptable_id: nil, medium_id: nil, build: true, comment: "", disk: "", installed_at: nil, model_id: nil, hostgroup_id: 2, owner_id: 4, 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: 1, organization_id: nil, location_id: nil, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: "image", grub_pass: "", global_status: 0, lookup_value_matcher: "fqdn=nodename.org", pxe_loader: "", initiated_at: nil, build_errors: nil>, :setUserData], @created=1547463780.444675, @timestamp=2019-01-14 11:03:00 UTC>]
2019-01-14T06:03:00 [E|app|f9574] Failed to save: Render user data template for nodename.org task failed with the following error: undefined method '#params' for Host::Managed::Jail (Host::Managed)
2019-01-14T06:03:00 [I|app|f9574]   Rendering hosts/new.html.erb within layouts/application
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/_progress.html.erb (0.1ms)
2019-01-14T06:03:00 [D|app|f9574] Current organization set to none
2019-01-14T06:03:00 [D|app|f9574] Current location set to none
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/puppet/_main_tab_fields.html.erb (1.7ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered collection of puppetclasses/_selectedClasses.html.erb [0 times] (0.0ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered collection of puppetclasses/_classes_in_groups.html.erb [0 times] (0.0ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered puppetclasses/_classes.html.erb (25.6ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered puppetclasses/_class_selection.html.erb (53.4ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/puppet/_puppet_classes_tab.html.erb (53.6ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/_base_form.html.erb (11.0ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/_virtual_form.html.erb (0.8ms)
2019-01-14T06:03:00 [D|app|f9574] Reading from compute resource cache: networks
2019-01-14T06:03:00 [I|app|f9574]   Rendered compute_resources_vms/form/vmware/_network.html.erb (1.8ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/_provider_specific_form.html.erb (3.0ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/manageds/_managed.html.erb (15.8ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/_base_form.html.erb (9.2ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/_virtual_form.html.erb (0.8ms)
2019-01-14T06:03:00 [D|app|f9574] Reading from compute resource cache: networks
2019-01-14T06:03:00 [I|app|f9574]   Rendered compute_resources_vms/form/vmware/_network.html.erb (1.5ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/_provider_specific_form.html.erb (2.6ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered nic/manageds/_managed.html.erb (13.5ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/_interfaces.html.erb (30.4ms)
2019-01-14T06:03:00 [D|app|f9574] Reading from compute resource cache: clustername
2019-01-14T06:03:00 [D|app|f9574] Reading from compute resource cache: resourcename
2019-01-14T06:03:00 [D|app|f9574] Reading from compute resource cache: folders
2019-01-14T06:03:00 [D|app|f9574] Reading from compute resource cache: storage_pods
2019-01-14T06:03:00 [D|app|f9574] Reading from compute resource cache: datastores
2019-01-14T06:03:00 [I|app|f9574]   Rendered compute_resources_vms/form/vmware/_base.html.erb (179.9ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered compute_resources_vms/form/_volumes.html.erb (0.1ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/_compute_detail.html.erb (180.8ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/_compute.html.erb (181.6ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered common/os_selection/_architecture.html.erb (3.1ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered common/os_selection/_pxe_loader.html.erb (1.9ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered common/os_selection/_operatingsystem.html.erb (7.8ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/provision_method/build/_form.html.erb (8.6ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/provision_method/image/_form.html.erb (0.0ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/_operating_system.html.erb (14.7ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/_unattended.html.erb (196.7ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered collection of puppetclasses/_class_parameters.html.erb [0 times] (0.0ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered puppetclasses/_classes_parameters.html.erb (6.3ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered common_parameters/_inherited_parameters.html.erb (0.1ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered common_parameters/_parameter.html.erb (0.8ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered common_parameters/_parameters.html.erb (2.0ms)
2019-01-14T06:03:00 [D|app|f9574] Current location set to none
2019-01-14T06:03:00 [D|app|f9574] Current organization set to none
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/_form.html.erb (318.3ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered hosts/new.html.erb within layouts/application (318.6ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendered layouts/_application_content.html.erb (0.7ms)
2019-01-14T06:03:00 [I|app|f9574]   Rendering layouts/base.html.erb
2019-01-14T06:03:00 [I|app|f9574]   Rendered layouts/base.html.erb (10.1ms)
2019-01-14T06:03:00 [I|app|f9574] Completed 200 OK in 583ms (Views: 316.6ms | ActiveRecord: 25.9ms)
2019-01-14T06:03:01 [I|app|] Started GET "/tasks/XXXXX" for y.y.y.y at 2019-01-14 06:03:01 -0500
2019-01-14T06:03:01 [I|app|624ff] Processing by TasksController#show as */*
2019-01-14T06:03:01 [I|app|624ff]   Parameters: {"id"=>"id_no"}
2019-01-14T06:03:01 [I|app|624ff] Current user set to admin (admin)
2019-01-14T06:03:01 [I|app|624ff]   Rendered tasks/_list.html.erb (0.2ms)
2019-01-14T06:03:01 [I|app|624ff] Completed 200 OK in 4ms (Views: 0.7ms | ActiveRecord: 0.6ms)
2019-01-14T06:03:03 [I|app|] Started GET "/tasks/XXXXX" for y.y.y.y at 2019-01-14 06:03:03 -0500
2019-01-14T06:03:03 [I|app|11f55] Processing by TasksController#show as */*
2019-01-14T06:03:03 [I|app|11f55]   Parameters: {"id"=>"XXXXX"}
2019-01-14T06:03:03 [I|app|11f55] Current user set to admin (admin)
2019-01-14T06:03:03 [I|app|11f55]   Rendered tasks/_list.html.erb (0.2ms)
2019-01-14T06:03:03 [I|app|11f55] Completed 200 OK in 4ms (Views: 0.6ms | ActiveRecord: 0.6ms)
2019-01-14T06:03:03 [I|app|] Started GET "/notification_recipients" for y.y.y.y at 2019-01-14 06:03:03 -0500
2019-01-14T06:03:03 [I|app|29e4c] Processing by NotificationRecipientsController#index as JSON
2019-01-14T06:03:03 [I|app|29e4c] Current user set to admin (admin)
2019-01-14T06:03:03 [D|app|29e4c] Body: {"notifications":[{"id":71,"seen":false,"level":"info","text":"Foreman Community Newsletter - October 2018","created_at":"2019-01-13T21:13:27.979Z","group":"Community","actions":{"links":[{"href":"http://theforeman.org/2018/10/foreman-community-newsletter-october-2018.html","title":"Open","external":true}]}},{"id":67,"seen":false,"level":"info","text":"Foreman Community Newsletter, CFP edition! (November 2018)","created_at":"2019-01-13T21:13:27.968Z","group":"Community","actions":{"links":[{"href":"http://theforeman.org/2018/11/foreman-community-newsletter-november-2018.html","title":"Open","external":true}]}},{"id":63,"seen":false,"level":"info","text":"Foreman Community Newsletter (December 2018)","created_at":"2019-01-13T21:13:27.956Z","group":"Community","actions":{"links":[{"href":"http://theforeman.org/2018/12/foreman-community-newsletter-december-2018.html","title":"Open","external":true}]}},{"id":2,"seen":false,"level":"warning","text":"The organizations_enabled setting has been deprecated and will be removed in version 1.21","created_at":"2018-12-19T09:09:23.019Z","group":"Deprecations","actions":{"links":[{"href":"https://community.theforeman.org/t/proposal-remove-support-for-disabling-taxonomies-or-login/10972","title":"Further Information","external":true}]}},{"id":1,"seen":false,"level":"warning","text":"The locations_enabled setting has been deprecated and will be removed in version 1.21","created_at":"2018-12-19T09:09:22.941Z","group":"Deprecations","actions":{"links":[{"href":"https://community.theforeman.org/t/proposal-remove-support-for-disabling-taxonomies-or-login/10972","title":"Further Information","external":true}]}}]}
2019-01-14T06:03:03 [I|app|29e4c] Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.5ms)

Expected outcome:
Host should be properly provisioned.

Foreman and Proxy versions:
foreman-1.20.1

Foreman and Proxy plugin versions:

Other relevant data:
I have several templates associated with the operating system. But when I resolve “provisioning templates” from host provisioning tab, I see only one template resolved.

Your templates seems to be using old macro for fetching params. Please edit your templates and change calls like

@host.params['parameter_name']

to

host_param('param_name')

after upgrade all shipped templates are automatically updated, custom templates need to be update manually

Hi @Marek_Hulan, thank you :slight_smile:

I edited the template but then the error message changed to another line. Looks like there are something that is still using the old format. Do you mind taking a look into the templates and telling where I need to do the changes? I think I need to be more well versed with erb templating as I kind of use foreman on a fairly regular basis.

cloudinit template:

#cloud-config
hostname: <%= @host.name %>
fqdn: <%= @host %>
manage_etc_hosts: true
users: {}
runcmd:
- |
<%= indent(2) { snippet('redhat_register') } %>
- |
<%= indent(2) { snippet('spacewalk_register') } %>
- |
<%= indent(2) { snippet('puppet_setup_cloudinit', :variables => { :full_puppet_run => true }) } %>

output: { all: "| tee -a /var/log/cloud-init-output.log" }

vmware user data:

<%#
kind: user_data
name: vmware user data
oses:
- Redhat 6
- Redhat 7
- CentOS 6
- CentOS 7
- Fedora 19
- Fedora 20
-%>
# https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.vm.customization.Specification.html
# encryptionKey expects an array
# globalIPSettings expects a hash, REQUIRED
# identity expects an hash, REQUIRED
# nicSettingMap expects an array
# options expects an hash

#   *   LinuxPrep: <~Hash> - Optional, contains machine-wide settings (note the uppercase P)
#   *     domain: <~String> - REQUIRED, The fully qualified domain name.
#   *     hostName: <~String> - REQUIRED, the network host name
#   *     hwClockUTC: <~Boolean> - Optional, Specifies whether the hardware clock is in UTC or local time
#   *     timeZone: <~String> - Optional, Case sensistive timezone
identity:
  LinuxPrep:
    domain: <%= @host.domain %>
    hostName: <%= @host.shortname%>

#   * globalIPSettings <~Hash> - REQUIRED
#   *   dnsServerList <~Array> - Optional, list of dns servers - Example: ["10.0.0.2", "10.0.0.3"]
#   *   dnsSuffixList <~Array> - Optional, List of name resolution suffixes - Example: ["dev.example.com", "example.com"]
globalIPSettings:
  dnsSuffixList: [<%= @host.domain %>]
  dnsServerList: ['x1.x1.x1.x1','x2.x2.x2.x2','x3.x3.x3.x3']

#   * nicSettingMap: <~Array> - Optional, IP settings that are specific to a particular virtual network adapter
#   *   Each item in array:
#   *   adapter: <~Hash> - REQUIRED, IP settings for the associated virtual network adapter
#   *     dnsDomain: <~String> - Optional, DNS domain suffix for adapter
#   *     dnsServerList: <~Array> - Optional, list of dns server ip addresses - Example: ["10.0.0.2", "10.0.0.3"]
#   *     gateway: <~Array> - Optional, list of gateways - Example: ["10.0.0.2", "10.0.0.3"]
#   *     ip: <~String> - Optional, but required if static IP
#   *     ipV6Spec: <~Hash> - Optional, IPv^ settings
#   *       ipAddress: <~String> - Optional, but required if setting static IP
#   *       gateway: <~Array> - Optional, list of ipv6 gateways
#   *     netBIOS: <~String> - Optional, NetBIOS settings, if supplied must be one of: disableNetBIOS','enableNetBIOS','enableNetBIOSViaDhcp'
#   *     primaryWINS: <~String> - Optional, IP address of primary WINS server
#   *     secondaryWINS: <~String> - Optional, IP address of secondary WINS server
#   *     subnetMask: <~String> - Optional, subnet mask for adapter
#   *   macAddress: <~String> - Optional, MAC address of adapter being customized. This cannot be set by the client
nicSettingMap:
<% @host.interfaces.each do |interface| %>
  - adapter:
#      dnsDomain: <%= interface.domain %>
#      dnsServerList: [<%= interface.subnet.dns_primary %>, <%= interface.subnet.dns_secondary %>]
      gateway: [<%= interface.subnet.gateway %>]
      ip: <%= interface.ip %>
      subnetMask: <%= interface.subnet.mask %>
<% end %>

Another vmware user data:

<%#
kind: user_data
name: UserData default
oses:
- CentOS
- Fedora
- Debian
- Ubuntu
-%>
<%#
This template accepts the following parameters:
- ssh_pwauth: boolean (default=true unless ssh_authorized_keys)
- ssh_authorized_keys: string w newline seperated keys (default="")
- package_upgrade: boolean (default=false)
- reboot: boolean (default=false)
-%>
<%
  ssh_pwauth = host.param['ssh_pwauth'] ? @host.param_true?('ssh_pwauth') : !host.param['ssh_authorized_keys']
  rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name != 'Fedora'
  # safemode renderer does not support unary negation
  pm_set = @host.puppetmaster.empty? ? false : true
  puppet_enabled = pm_set || @host.param_true?('force-puppet')
  salt_enabled = @host.params['salt_master'] ? true : false
  chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
-%>
#cloud-config
hostname: <%= @host.shortname %>
fqdn: <%= @host %>
manage_etc_hosts: true

<% if @host.param_true?('package_upgrade') -%>
package_upgrade: true
<% end -%>

<%= snippet 'vmware_globalip' %>

runcmd:
<% if rhel_compatible -%>
- |
<%= indent(2) { snippet('epel') } %>
<% end -%>
- |
<%= indent(2) { snippet('remote_execution_ssh_keys') } %>
<% if chef_enabled -%>
- |
<%= indent(2) { snippet('chef_client') } %>
<% end -%>
<% if puppet_enabled -%>
- |
<%= indent(2) { snippet('puppetlabs_repo') } %>
- |
<%= indent(2) { snippet('puppet_setup') } %>
- |
<%= indent(2) { snippet('redhat_register') } %>
<% end -%>
<% if salt_enabled -%>
- |
<%= indent(2) { snippet('saltstack_setup') } %>
<% end -%>

<%# Contact Foreman to confirm instance is built -%>
phone_home:
  url: <%= foreman_url('built') %>
  post: []
  tries: 10

<% if @host.param_true?('reboot') -%>
power_state:
  mode: reboot
  timeout: 30
  condition: true
<% end -%>

And where can I look to learn about the changes in the template language?

Thanks again.

Hello,

from quick read, I still see things like
host.param['ssh_pwauth']
@host.params['salt_master']
@host.param_true?('ssh_pwauth')

all these should be changed (and all similar ones).

The best source of what can be used in templates is this page https://projects.theforeman.org/projects/foreman/wiki/TemplateWriting We should work on improvements of it. The part you’re searching for is here https://projects.theforeman.org/projects/foreman/wiki/TemplateWriting#Host-specific-macros

I had a discussion with @Marek_Hulan and got it fixed to a good extent. There is one odd error about vmware_globalip setting that I am getting now. I will try to get that fixed and provide an update.

Hello,

We’ve started getting this issue too. I’ve pulled the latest preseed from git (https://github.com/theforeman/community-templates/blob/develop/provisioning_templates/provision/preseed_default.erb) and am receiving this error as well. We have switched everything to the host.param. Not sure where the issue is here.

Nevermind. Found that that host group was still referencing an old partition table with the depreceated syntax (which gets rendered in the preseed default template).