Bug 2163456

Summary: (ActiveModel::UnknownAttributeError): unknown attribute 'project' for ForemanGoogle::GCE.
Product: Red Hat Satellite Reporter: addubey
Component: Compute Resources - GCEAssignee: Leos Stejskal <lstejska>
Status: CLOSED ERRATA QA Contact: addubey
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: gtalreja, lstejska, rlavi, zhunting
Target Milestone: 6.13.0Keywords: EasyFix, Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: foreman_google-1.0.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-03 13:24:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description addubey 2023-01-23 14:44:25 UTC
Description of problem: With 6.13 project and email attributes removed, when using key_path and zones API still fails to create a CR.

Version-Release number of selected component (if applicable):
6.13 snap 7 

How reproducible: 100%


Steps to Reproduce:
1. Try to create a GCE-CR with API/CLI.

2023-01-23T09:10:44 [I|app|7099078d] Completed 200 OK in 361ms (Views: 171.2ms | ActiveRecord: 25.8ms | Allocations: 77953)
2023-01-23T09:10:57 [I|app|a3d0d9f3] Started POST "/api/v2/compute_resources" for 10.74.18.33 at 2023-01-23 09:10:57 -0500
2023-01-23T09:10:57 [I|app|a3d0d9f3] Processing by Api::V2::ComputeResourcesController#create as JSON
2023-01-23T09:10:57 [I|app|a3d0d9f3]   Parameters: {"compute_resource"=>{"name"=>"GemYveByvx", "provider"=>"GCE", "key_path"=>"/usr/share/foreman/test_key.json", "project"=>"test-automation", "zone"=>"test_zone", "url"=>"ftp://CCakwLNSJu.biz", "email"=>"θ―°ιšπ›€δ˜΄ηžšγ‚€δΈ«π’ƒ°π˜‡†ε­£μ‘§γ–ζ€πŽ€π’‡’ζ¬…ο΄«λ»ƒδΎ£", "location_ids"=>[34], "organization_ids"=>[33]}, "apiv"=>"v2"}
2023-01-23T09:10:57 [I|app|a3d0d9f3] Authorized user admin(Admin User)
2023-01-23T09:10:57 [W|app|a3d0d9f3] Action failed
2023-01-23T09:10:57 [I|app|a3d0d9f3] Backtrace for 'Action failed' error (ActiveModel::UnknownAttributeError): unknown attribute 'project' for ForemanGoogle::GCE.

Actual results:


Expected results:


Additional info: 
Tried removing :project & :email from https://github.com/theforeman/foreman_google/blob/develop/app/controllers/concerns/foreman/controller/parameters/compute_resource_extension.rb#L10 works to create a gce cr.

Comment 1 Leos Stejskal 2023-01-24 12:49:22 UTC
Hi,
removing :project & :email from the compute_resource_extension.rb doesn't have any effect,
but still those parameters shouldn't be there, neither the key_pair.

It's also a bug in terms of backwards API compatibility,
we load the :project and :email from json file now,
however we should keep the parameters and mark them as deprecated.

My proposed solution:
* remove obsolete params from the compute_resource_extension.rb
* Put back :project & :email API params, but mark them as deprecated with information about new approach (loading values from .json file)

Comment 2 Leos Stejskal 2023-01-24 13:39:10 UTC
Created redmine issue https://projects.theforeman.org/issues/35986 from this bug

Comment 3 addubey 2023-01-25 11:25:14 UTC
Yeah, that would be a good thing!

Comment 7 errata-xmlrpc 2023-05-03 13:24:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.13 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2097