"Not Found" message when creating GCE compute resource

Hi, I’m using Foreman version 1.14.3 and having issue while creating GCE compute resource, it always show an message “Not Found” when I pressed the load zone button. I have do everything as the instruction here: Foreman :: Manual

the Client Email has all of the permission in the project, Compute Engine API is also enable, even I chmod 777 for the .p12 file, but still cannot load all of the Google Cloud zones.

Please HELP!!!

Hey, I am afraid we won’t be able to help without more context. “Not Found” is not enough. Start digging in production.log, increase logging verbosity to DEBUG and try again. Try to capture CR debug data via

https://projects.theforeman.org/projects/foreman/wiki/Troubleshooting#section-13

Hi, thanks for your answer, but I have tried to config as the instruction that I mentioned before but still having that error message. Here is what I got when I press Load Zones.

2018-06-11T14:46:12 7e9cfe0f [app] [I] Processing by ComputeResourcesController#test_connection as /
2018-06-11T14:46:12 7e9cfe0f [app] [I] Parameters: {“utf8”=>“✓”, “authenticity_token”=>“GdHwhZk21G6smHGbuq9k0WxYonJNPBlPivLQbUWsHG0UmbhdzAYFOZ7whed/1TmU3GyiN8SqG+OQYEIKvlh7Zw==”, “compute_resource”=>{“name”=>“gce”, “provider”=>“GCE”, “description”=>"", “project”=>“hoangtrinh-206904”, “email”=>"220283792330-compute@developer.gserviceaccount.com", “key_path”=>"/home/ubuntu/hoangtrinh-954248ea916a.p12"}, “cr_id”=>“null”}
2018-06-11T14:46:14 7e9cfe0f [app] [I] Rendered compute_resources/form/_gce.html.erb (512.9ms)
2018-06-11T14:46:14 7e9cfe0f [app] [I] Rendered taxonomies/_loc_org_tabs.html.erb (0.0ms)
2018-06-11T14:46:14 7e9cfe0f [app] [I] Rendered compute_resources/_form.html.erb (516.5ms)
2018-06-11T14:46:14 7e9cfe0f [app] [I] Completed 200 OK in 1736ms (Views: 516.9ms | ActiveRecord: 0.8ms)

18-06-12T02:58:25 e58efd3b [app] [I] Started PUT “/compute_resources/test_connection” for 125.212.208.58 at 2018-06-12 02:58:25 +0000
2018-06-12T02:58:25 e58efd3b [app] [I] Processing by ComputeResourcesController#test_connection as /
2018-06-12T02:58:25 e58efd3b [app] [I] Parameters: {“utf8”=>“✓”, “authenticity_token”=>“8Z3q7FkuDkjw8hNrh5jQUlLa9unT+7EqGRNZGVuGA6yYb13OphD0M4RmBPrc/duVcQqYLtTlbn7/QX7yXrJv6g==”, “compute_resource”=>{“name”=>“gce”, “provider”=>“GCE”, “description”=>"", “project”=>“hoangtrinh-206904”, “email”=>"220283792330-compute@developer.gserviceaccount.com", “key_path”=>"/usr/share/foreman/hoangtrinh-954248ea916a.p12"}, “cr_id”=>""}
2018-06-12T02:58:25 e58efd3b [app] [I] Current user: admin (administrator)
2018-06-12T02:58:25 e58efd3b [app] [D] Setting current user thread-local variable to admin
2018-06-12T02:58:25 e58efd3b [app] [D] Unpermitted parameters: :utf8, :authenticity_token, :cr_id, :locale
2018-06-12T02:58:25 e58efd3b [app] [D] Google::APIClient - Initializing client with options {:application_name=>“fog”, :application_version=>“0.1.0”}
2018-06-12T02:58:25 e58efd3b [app] [D] Google::APIClient::Request Sending API request get https://www.googleapis.com/discovery/v1/apis/compute/v1/rest {“User-Agent”=>“fog/0.1.0 google-api-ruby-client/0.8.6 Linux/4.4.0-1060-aws\n (gzip)”, “Accept-Encoding”=>“gzip”, “Content-Type”=>""}
2018-06-12T02:58:25 e58efd3b [app] [D] Decompressing gzip encoded response (88161 bytes)
2018-06-12T02:58:25 e58efd3b [app] [D] Decompressed (1367101 bytes)
2018-06-12T02:58:25 e58efd3b [app] [D] Google::APIClient::Request Result: 200 {“expires”=>“Tue, 12 Jun 2018 03:01:47 GMT”, “date”=>“Tue, 12 Jun 2018 02:56:47 GMT”, “etag”=>"“Zkyw9ACJZUvcYmlFaKGChzhmtnE/iIle7JnS-3QsRu7zF_GBvrXnSz4"”, “vary”=>“Origin, X-Origin”, “content-type”=>“application/json; charset=UTF-8”, “x-content-type-options”=>“nosniff”, “x-frame-options”=>“SAMEORIGIN”, “x-xss-protection”=>“1; mode=block”, “server”=>“GSE”, “content-length”=>“88161”, “age”=>“98”, “cache-control”=>“public, max-age=300, must-revalidate, no-transform”, “alt-svc”=>“quic=”:443"; ma=2592000; v=“43,42,41,39,35"”, “connection”=>“close”}
2018-06-12T02:58:25 e58efd3b [app] [D] Google::APIClient::Request Sending API request get https://www.googleapis.com/discovery/v1/apis/resourceviews/v1beta1/rest {“User-Agent”=>“fog/0.1.0 google-api-ruby-client/0.8.6 Linux/4.4.0-1060-aws\n (gzip)”, “Accept-Encoding”=>“gzip”, “Content-Type”=>""}
2018-06-12T02:58:26 e58efd3b [app] [D] Decompressing gzip encoded response (120 bytes)
2018-06-12T02:58:26 e58efd3b [app] [D] Decompressed (165 bytes)
2018-06-12T02:58:26 e58efd3b [app] [D] Google::APIClient::Request Result: 404 {“vary”=>“Origin, X-Origin”, “content-type”=>“application/json; charset=UTF-8”, “date”=>“Tue, 12 Jun 2018 02:58:26 GMT”, “expires”=>“Tue, 12 Jun 2018 02:58:26 GMT”, “cache-control”=>“private, max-age=0”, “x-content-type-options”=>“nosniff”, “x-frame-options”=>“SAMEORIGIN”, “x-xss-protection”=>“1; mode=block”, “server”=>“GSE”, “alt-svc”=>“quic=”:443"; ma=2592000; v=“43,42,41,39,35"”, “connection”=>“close”, “transfer-encoding”=>“chunked”}
2018-06-12T02:58:26 e58efd3b [app] [D] Google::APIClient - Initializing client with options {:application_name=>“fog”, :application_version=>“0.1.0”}

This looks like a change in the API on the Google side. I’d start with updating GCE client library. My wild guess - try newer Foreman that might work. 1.14 is quite old now.

I tried to install foreman version 1.17 but the issue still happended, I also update the google-api-ruby-client to version 0.23.0 and I have this error message:

When I also tried to update fog-google to version 1.4, this happened :frowning:

image

Do I need to get into the code and solve this ?

I don’t know, you need to start digging I guess sorry :frowning:

To expand a little, GCE was added to core a long time ago, but no one has really maintained it. We don’t have any GCE experts (that I know of!) in the community, so debugging this isn’t going to be easy.

Do send over the logs from when you got the “Something went wrong” page, as that may be easier to troubleshoot. However my gut feeling is that this is going to require changes in either Fog itself, or in how we implement Fog for GCE. Either way, yes, it’s going to need code changes.

We should probably move GCE to a plugin and look for maintainers, but that’s not relevant to this Support issue - I will take that over to #development :slight_smile:

Thanks for the response. I have been digging in the source code and trying to fix the issue, and I found out why this caused the “Something went wrong” on the UI. Because fog-google library has been changed for some reasons, I am still looking for the solution to make this works

Had a look into while trying to setup a dev environment, looks like multiple problems:

  • Legacy APIs that no longer work on the Google side
  • fog-google is outdated (in the tfm version)
  • google-api-client is a bit old

Sadly I’m not a GCE user or expert :laughing:

P.S. Hi @Gwmngilfen!

2 Likes

Hey @lazyfrosch, good to have you here :slight_smile:

So Fog is a tricky thing for us to upgrade, as it impacts all the compute resources. The breakout of fog/core into providers is helping, but it’s slow going, and there’s not much we can do about that.

Looking at the linked poll, it seems we’re mostly agreed that GCE should be moved to a plugin - this would give it a little more flexibility to update dependencies (to a point) and iterate faster as the APIs change. The only issue is finding a maintainer for that plugin… :smiley:

Have someone even got this working? If so, with what rpms, foreman version, and did you get it working with the guide (5.2.4GoogleComputeEngineNotes)?

I’m getting the same error message (“Unable to save - Not Found”.)… :confused:
#Using foreman:
1.17.4

#These are the rpms that are installed:
tfm-rubygem-fog-google-0.1.0-3.el7.noarch
tfm-rubygem-google-api-client-0.8.2-6.el7.noarch
foreman-gce-1.17.4-1.el7.noarch

Created a service account just as it was described here:
https://theforeman.org/manuals/1.19/index.html#5.2.4GoogleComputeEngineNotes

#From the production.log:

2018-10-25T15:48:15 0e9f1cc2 [app] [I] Processing by ComputeResourcesController#test_connection as /
2018-10-25T15:48:15 0e9f1cc2 [app] [I] Parameters: {“utf8”=>"<9C><93>", “authenticity_token”=>“Kxpq4zdG8cvVwDhkKP6C2gl5UVqvwCuyyQLPLQu52O6Nt9yJTzD2BYYX7omcDvVCdXmAuJRHPFGRdPXsVN5k+g==”, “compute_resource”=>{“name”=>“GCE”, “description”=>"", “project”=>“foreman-220312”, “email”=>"foreman-service-account@foreman-220312.iam.gserviceaccount.com", “key_path”=>"/home/foreman/foreman-083f3b059831.p12", “location_ids”=>["", “1”], “organization_ids”=>["", “2”, “3”]}, “cr_id”=>“8”}

I have solved this issue, had to write my own plugin :frowning: will try to share with you when I finish all the wrapping-up work.

1 Like

Hi @hoangtrinh, did you manage to finish all the wrapping of the plugin you created?

1 Like