Google cloud compute ressource: header field value cannot include CR/LF

Problem:

When trying to add Google Cloud Platform (Google compute engine - GCE) to the Foreman compute ressources, I get the following error:

Cannot save
header field value cannot include CR/LF

I have googled this, and the recommendation was to upgrade the google-api-client gem, but since this gem is installed via packages (RPM in my case), I don’t know how to upgrade it.

See: https://stackoverflow.com/questions/51219917/rails-w-google-api-client-header-field-value-cannot-include-cr-lf

Anybody has a solution how to overcome this?

Expected outcome:

Working GCE compute ressource

Foreman and Proxy versions:

Foreman 1.20.1
Foreman Proxy 1.20.1

Foreman and Proxy plugin versions:

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)

logs

@rforberger,

Yes, you are right that to fix above error you will need to upgrade google-api-client.
But this change is not enough for Google cloud compute resource to work.

Currently, GCE is broken as there are changes in Google Compute APIs.
In addition to google-api-client and fog-google gems, it needs latest fog version.

We are working on GCE so that it will work in future.
For more details you can go through the post

Thanks @kgaikwad. I will follow the upgrade of the gems.

Best regards,
Ronny

@rforberger,
Just an update about broken GCE.
Recently PR-6634 got merged.

thanks @kgaikwad

@rforberger Hi, did updating to latest version 1.21 (this includes PR mentioned above) help ?
I am asking, because I have the same issue and I am using 1.21 version.

@pdzionek,
Changes from PR-6634 available in version 1.22.
I would recommend to update version to 1.22. Please let me know if you are still facing above issue.

Hi @kgaikwad, I updated to latest RC2 and there is a different error now. Every time I click load zones, or want to add vm or list vms I get following error:

unexpected character at line 1, column 2 [parse.c:690]

In production logs I only see this:
2019-05-29T09:34:38 [I|app|87908a45] Started PUT “/compute_resources/test_connection” for 172.16.12.1 at 2019-05-29 09:34:38 +0000
2019-05-29T09:34:38 [I|app|87908a45] Processing by ComputeResourcesController#test_connection as /
2019-05-29T09:34:38 [I|app|87908a45] Parameters: {“utf8”=>“✓”, “authenticity_token”=>"***************", “compute_resource”=>{“name”=>“GCE - Project”, “description”=>"", “project”=>"", “email”=>"foreman-system-account@", “key_path”=>"/usr/share/foreman/gce.p12", “location_ids”=>["", “1”], “organization_ids”=>["", “2”]}, “cr_id”=>“1”}
2019-05-29T09:34:38 [I|app|87908a45] Current user set to admin (admin)
2019-05-29T09:34:38 [D|app|87908a45] Current location set to Default Location
2019-05-29T09:34:38 [D|app|87908a45] Current organization set to Default Organization
2019-05-29T09:34:38 [D|app|87908a45] Unpermitted parameter: :cr_id
2019-05-29T09:34:38 [I|app|87908a45] Rendered compute_resources/form/_gce.html.erb (6.9ms)
2019-05-29T09:34:38 [I|app|87908a45] Rendered taxonomies/_loc_org_tabs.html.erb (22.3ms)
2019-05-29T09:34:38 [I|app|87908a45] Rendered compute_resources/_form.html.erb (32.2ms)
2019-05-29T09:34:38 [I|app|87908a45] Completed 200 OK in 66ms (Views: 28.9ms | ActiveRecord: 11.8ms)

@pdzionek,
.p12 key file format is deprecated so you will need to generate new .json private key file from your google account and place that file to the same location as .p12 file.

For your reference document link for google compute resource.

@kgaikwad Oh, it helped. I added node successfully. I am also able to list VMs, but I cannot create new VM on this type of resource. In VM Creation Wizard, in “Virtual Machine” tab, i get error:

Failure: undefined method `type’ for #<Fog::Compute::Google::Server:0x00007f51588b4358>

And I am also not able to import these VMs as managed host.

undefined method `type’ for #<Fog::Compute::Google::Server:0x00007f51646c1f08>

So something similar.

@pdzionek,
It would be helpful if you share production.log for those action.

@kgaikwad Here you go

2019-05-30T07:18:26 [I|app|edd15900] Started GET "/notification_recipients" for 172.16.12.1 at 2019-05-30 07:18:26 +0000
2019-05-30T07:18:26 [I|app|edd15900] Processing by NotificationRecipientsController#index as JSON
2019-05-30T07:18:26 [I|app|edd15900] Current user set to admin (admin)
2019-05-30T07:18:26 [I|app|edd15900] Completed 200 OK in 12ms (Views: 0.2ms | ActiveRecord: 1.9ms)
2019-05-30T07:18:27 [I|app|2c03a45e] Started POST "/hosts/compute_resource_selected" for 172.16.12.1 at 2019-05-30 07:18:27 +0000
2019-05-30T07:18:27 [I|app|2c03a45e] Processing by HostsController#compute_resource_selected as */*
2019-05-30T07:18:27 [I|app|2c03a45e]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"***", "host"=>{"name"=>"paul-kisak", "organization_id"=>"2", "location_id"=>"1", "hostgroup_id"=>"", "compute_resource_id"=>"1", "environment_id"=>"", "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"paul-kisak", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "architecture_id"=>"", "operatingsystem_id"=>"", "provision_method"=>"build", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "fakepassword"=>"[FILTERED]"}
2019-05-30T07:18:27 [I|app|2c03a45e] Current user set to admin (admin)
2019-05-30T07:18:30 [I|app|2c03a45e]   Rendered compute_resources_vms/form/gce/_base.html.erb (838.6ms)
2019-05-30T07:18:30 [I|app|2c03a45e]   Rendered compute_resources_vms/form/_volumes.html.erb (29.4ms)
2019-05-30T07:18:30 [I|app|2c03a45e]   Rendered hosts/_compute_detail.html.erb (895.9ms)
2019-05-30T07:18:30 [I|app|2c03a45e]   Rendered hosts/_compute.html.erb (2296.8ms)
2019-05-30T07:18:30 [W|app|2c03a45e] Failed to render compute resource template
ActionView::Template::Error: undefined method `type' for #<Fog::Compute::Google::Server:0x00007fdb5dc0df88>
/usr/share/foreman/app/views/compute_resources_vms/form/_volumes.html.erb:2:in `_afa09cd66990c9e44c39bca647366d3b'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:159:in `block in render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:354:in `instrument_render_template'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:157:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/deface-1.3.2/lib/deface/action_view_extensions.rb:41:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:344:in `block in render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:44:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:43:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:333:in `render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:312:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:49:in `render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:23:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/helpers/rendering_helper.rb:33:in `render'
/usr/share/foreman/app/views/hosts/_compute_detail.html.erb:33:in `_5db7f19cb66276c607113eebf6cbeddc'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:159:in `block in render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:354:in `instrument_render_template'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:157:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/deface-1.3.2/lib/deface/action_view_extensions.rb:41:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:344:in `block in render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:44:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:43:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:333:in `render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:312:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:49:in `render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:23:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/helpers/rendering_helper.rb:33:in `render'
/usr/share/foreman/app/views/hosts/_compute.html.erb:8:in `block in _b68cadb6b6ae379a2ba81c57df34b962'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/helpers/capture_helper.rb:41:in `block in capture'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/helpers/capture_helper.rb:205:in `with_output_buffer'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/helpers/capture_helper.rb:41:in `capture'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/helpers/form_helper.rb:1006:in `fields_for'
/usr/share/foreman/app/views/hosts/_compute.html.erb:1:in `_b68cadb6b6ae379a2ba81c57df34b962'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:159:in `block in render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:354:in `instrument_render_template'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/template.rb:157:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/deface-1.3.2/lib/deface/action_view_extensions.rb:41:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:344:in `block in render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:44:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:43:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:333:in `render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/partial_renderer.rb:312:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:49:in `render_partial'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:23:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/rendering.rb:103:in `_render_template'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/streaming.rb:219:in `_render_template'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/rendering.rb:84:in `render_to_body'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/rendering.rb:25:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:36:in `render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/core_ext/benchmark.rb:14:in `ms'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:46:in `block in render'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:31:in `cleanup_view_runtime'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:45:in `render'
/usr/share/foreman/app/controllers/hosts_controller.rb:151:in `block in compute_resource_selected'
/usr/share/foreman/app/models/taxonomy.rb:78:in `block (2 levels) in as_taxonomy'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:183:in `as_location'
/usr/share/foreman/app/models/taxonomy.rb:77:in `block in as_taxonomy'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:146:in `as_org'
/usr/share/foreman/app/models/taxonomy.rb:76:in `as_taxonomy'
/usr/share/foreman/app/controllers/hosts_controller.rb:144:in `compute_resource_selected'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
/usr/share/foreman/vendor/ruby/2.5.0/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'
/usr/share/foreman/vendor/ruby/2.5.0/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'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.8.0/lib/audited/sweeper.rb:14:in `around'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.8.0/lib/audited/sweeper.rb:14:in `around'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.16/lib/apipie/static_dispatcher.rb:66:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.16/lib/apipie/extractor/recorder.rb:137:in `call'
/usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.16/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
/usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/tempfile_reaper.rb:15:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/etag.rb:25:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/conditional_get.rb:38:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/head.rb:12:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:232:in `context'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:226:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/method_override.rb:22:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/runtime.rb:22:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/secure_headers-6.1.0/lib/secure_headers/middleware.rb:11:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/urlmap.rb:68:in `block in call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/lib/rack/urlmap.rb:53:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.7/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.5.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2019-05-30T07:18:30 [I|app|2c03a45e]   Rendered common/_ajax_error.html.erb (1.3ms)
2019-05-30T07:18:30 [I|app|2c03a45e] Completed 500 Internal Server Error in 2345ms (Views: 7.1ms | ActiveRecord: 12.9ms)
2019-05-30T07:18:30 [I|app|d7f2ff70] Started POST "/hosts/interfaces" for 172.16.12.1 at 2019-05-30 07:18:30 +0000
2019-05-30T07:18:30 [I|app|d7f2ff70] Processing by HostsController#interfaces as */*
2019-05-30T07:18:30 [I|app|d7f2ff70]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"***", "host"=>{"name"=>"paul-kisak", "organization_id"=>"2", "location_id"=>"1", "hostgroup_id"=>"", "compute_resource_id"=>"1", "environment_id"=>"", "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"paul-kisak", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "architecture_id"=>"", "operatingsystem_id"=>"", "provision_method"=>"build", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "fakepassword"=>"[FILTERED]"}
2019-05-30T07:18:30 [I|app|d7f2ff70] Current user set to admin (admin)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/_base_form.html.erb (74.1ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/_virtual_form.html.erb (2.2ms)
2019-05-30T07:18:30 [I|app|d7f2ff70] Deface: 'add_vm_type_to_nic_provider_specific_form' matched starting with 'erb[loud]:contains('f.fields_for')' and ending with 'erb[silent]:contains('end')'
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/_provider_specific_form.html.erb (1.3ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/manageds/_managed.html.erb (105.9ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/_base_form.html.erb (38.3ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/_virtual_form.html.erb (1.5ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/_provider_specific_form.html.erb (0.4ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered nic/manageds/_managed.html.erb (46.9ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered hosts/_interfaces.html.erb (165.1ms)
2019-05-30T07:18:30 [I|app|d7f2ff70]   Rendered hosts/_interfaces_tab.html.erb (171.3ms)
2019-05-30T07:18:30 [I|app|d7f2ff70] Completed 200 OK in 253ms (Views: 169.1ms | ActiveRecord: 24.8ms)

@pdzionek,

Thank you for quick response. I have tested the same scenario but unfortunately not able to reproduce this error.
I am trying to understand your scenario so could you please provide what steps you have followed after updating to 1.22.

@kgaikwad
I wrote that I updated it, but I just created a new VM and installed foreman from a scratch.(I did not want to mess up my current stable foreman) I used Ubuntu 18.04 LTS, installed gce plugin during installation and just added new Compute Resource. I first had that issue with a p12 file, but I switched to json and now I have this problem.

Please check attached debug logs, they maybe will help you understand it better.

foreman-error.log (729.2 KB)

Which plugins do you have installed? (you can find this on the about page)
it seems one of them is modifying the host form in some way that may be causing the error.

1 Like

@tbrisker
The only plugin, which I added is foreman_fog_proxmox

I am also testing it, and it doesn’t work right now, but I guess @tristanrobert is working on some bugs that I reported.

Update:
I removed foreman_fog_proxmox plugin and restarted apache2 and now GCE works. So I guess @tristanrobert has to check it out.

1 Like

@tbrisker What`s next? I pretty sure that one plugin should not break other compute resources. Is there going to be a fix before a new stable release ? Should I raise a ticket somewhere ?

I’m afraid this would need to be fixed in the plugin, i think at https://github.com/theforeman/foreman_fog_proxmox/blob/master/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb#L18. The plugin seems to assume that all compute resources have a type method, which apparently isn’t the case for GCE. There may be other assumptions done inside the plugin that will need to be fixed as well, i’m not familiar with its internals.