Bug 2196242

Summary: Upgrade to Satellite 6.13 fails on db:seed step with error GraphQL::InvalidNameError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but 'RHEL OpenStack Platform' does not
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: UpgradesAssignee: Evgeni Golov <egolov>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: high    
Version: 6.13.0CC: ahumbe, egolov, jbhatia, lpramuk, pcreech
Target Milestone: 6.13.1Keywords: Triaged, Upgrades
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: foreman-3.5.1.17-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-31 15:28:22 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 Sayan Das 2023-05-08 12:40:14 UTC
Description of problem:

Upgrade to Satellite 6.13 fails on db:seed step with error GraphQL::InvalidNameError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but 'RHEL OpenStack Platform' does not


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

Satellite 6.13.0

How reproducible:

In customer's environment 


Steps to Reproduce: 

( Probably )

1. Install a Satellite 6.12 and configure a Openstack based compute resource 
2. Try upgrading it to Satellite 6.13


Actual results:

Upgrade fails:

2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: Tasks: TOP => db:seed => db:load_config => environment
2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: (See full trace by running task with --trace)
2023-05-08 11:53:15 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: '/usr/sbin/foreman-rake db:seed' returned 1 instead of one of [0]
2023-05-08 11:53:15 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: '/usr/sbin/foreman-rake db:seed' returned 1 instead of one of [0]
2023-05-08 11:53:15 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Evaluated in 21.66 seconds


Seed error:

2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: rake 
aborted!
2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: Graph
QL::InvalidNameError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but 'RHEL OpenStack Platform' does not

2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/graphql-1.13.16/lib/graphql/name_validator.rb:8:in `validate!'
2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/graphql-1.13.16/lib/graphql/schema/enum_value.rb:43:in `initialize'
2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/graphql-1.13.16/lib/graphql/schema/member/accepts_definition.rb:154:in `initialize'
2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/graphql-1.13.16/lib/graphql/schema/enum.rb:48:in `new'
2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/gems/gems/graphql-1.13.16/lib/graphql/schema/enum.rb:48:in `value'
2023-05-08 11:53:15 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]/returns: /usr/share/foreman/app/graphql/types/provider_friendly_name_enum.rb:4:in `block in <class:ProviderFriendlyNameEnum>'


Expected results:

No such issues and compute resources of any supported providers should not halt the upgrade process for any reason at all.


Additional info:

Comment 2 Evgeni Golov 2023-05-08 12:43:33 UTC
I would expect, but didn't test, this to also fail in Azure RM: https://github.com/theforeman/foreman_azure_rm/blob/master/app/models/foreman_azure_rm/azure_rm.rb#L84

Comment 7 Evgeni Golov 2023-05-09 11:02:04 UTC
Created redmine issue https://projects.theforeman.org/issues/36371 from this bug

Comment 8 Bryan Kearney 2023-05-09 12:03:40 UTC
Upstream bug assigned to egolov

Comment 9 Bryan Kearney 2023-05-09 12:03:43 UTC
Upstream bug assigned to egolov

Comment 10 Bryan Kearney 2023-05-09 20:03:30 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36371 has been resolved.

Comment 13 Lukas Pramuk 2023-05-26 12:44:13 UTC
VERIFIED.

@Satellite 6.13.1 Snap3
foreman-3.5.1.17-1.el8sat.noarch

by the following (a bit artificial) reproducer:

1) Perform GraphQL query while monitoring production.log

# curl -X POST -H "Content-Type: application/json" -d '{"query": "{ computeResources \{totalCount, edges \{ node \{id, providerFriendlyName\} \}\} }"}' -u 'admin:changeme' https://$(hostname -f)/api/graphql

FIX:
{"data":{"computeResources":{"totalCount":0,"edges":[]}}}

vs. 

REPRO:
{"error":"An error occurred."}


# tail -f /var/log/foreman/production.log

FIX:
2023-05-26T08:32:27 [I|app|6b4208dd] Started POST "/api/graphql" for <IP_ADDRESS> at 2023-05-26 08:32:27 -0400
2023-05-26T08:32:27 [I|app|6b4208dd] Processing by Api::GraphqlController#execute as JSON
2023-05-26T08:32:27 [I|app|6b4208dd]   Parameters: {"query"=>"{ computeResources {totalCount, edges { node {id, providerFriendlyName} }} }", "graphql"=>{"query"=>"{ computeResources {totalCount, edges { node {id, providerFriendlyName} }} }"}}
2023-05-26T08:32:27 [I|app|6b4208dd] Authorized user admin(Admin User)
2023-05-26T08:32:27 [I|app|6b4208dd] Completed 200 OK in 114ms (Views: 0.2ms | ActiveRecord: 11.3ms | Allocations: 7972)

vs. 

REPRO:
2023-05-26T08:30:44 [I|app|5253ec94] Started POST "/api/graphql" for <IP_ADDRESS> at 2023-05-26 08:30:44 -0400
2023-05-26T08:30:44 [I|app|5253ec94] Processing by Api::GraphqlController#execute as JSON
2023-05-26T08:30:44 [I|app|5253ec94]   Parameters: {"query"=>"{ computeResources {totalCount, edges { node {id, providerFriendlyName} }} }", "graphql"=>{"query"=>"{ computeResources {totalCount, edges { node {id, providerFriendlyName} }} }"}}
2023-05-26T08:30:44 [I|app|5253ec94] Authorized user admin(Admin User)
2023-05-26T08:30:44 [W|app|5253ec94] Action failed
2023-05-26T08:30:44 [I|app|5253ec94] Backtrace for 'Action failed' error (Types::ProviderFriendlyNameEnum::UnresolvedValueError): `ComputeResource.providerFriendlyName` returned `"RHEL OpenStack Platform"` at `computeResources.edges.0.node.providerFriendlyName`, but this isn't a valid value for `ProviderFriendlyNameEnum`. Update the field or resolver to return one of `ProviderFriendlyNameEnum`'s values instead.
...

2023-05-26T08:30:44 [I|app|5253ec94] Completed 500 Internal Server Error in 146ms (Views: 0.4ms | ActiveRecord: 24.2ms | Allocations: 14904)

Comment 17 errata-xmlrpc 2023-05-31 15:28:22 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 (Moderate: Satellite 6.13.1 Async Security Update), 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:3387