Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2196436

Summary: Can't query plugin CRs via GraphQL
Product: Red Hat Satellite Reporter: Evgeni Golov <egolov>
Component: Compute ResourcesAssignee: Evgeni Golov <egolov>
Status: CLOSED ERRATA QA Contact: sganar
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: lstejska, sganar, shwsingh
Target Milestone: 6.14.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:19:23 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 Evgeni Golov 2023-05-09 07:03:43 UTC
Description of problem:
When trying to query a CR that was created from a plugin (like Azure or Google) via GraphQL, an error occurs.

Version-Release number of selected component (if applicable):
6.13.0, but should happen on any other too

How reproducible:
100%

Steps to Reproduce:
1. create an Azure (or in 6.13 Google) CR
2.  curl -X POST -H "Content-Type: application/json" -d '{"query": "{ computeResource(id: \"MDE6Rm9yZW1hbkF6dXJlUm06OkF6dXJlUm0tMTI=\") \{id, provider\} }"}' -u admin:changeme https://$(hostname -f)/api/graphql (replace the ID with the right for your install

Actual results:
{"error":"An error occurred."}

Expected results:
{"data":"computeResource":"id":"MDE6Rm9yZW1hbkF6dXJlUm06OkF6dXJlUm0tMTI=","provider":"AzureRm"}}}

Additional info:
In production log, we see the following error:
2023-05-09T06:43:41 [W|app|02510a9d] Action failed
2023-05-09T06:43:41 [I|app|02510a9d] Backtrace for 'Action failed' error (Types::ProviderEnum::UnresolvedValueError): `ComputeResource.provider` returned `"AzureRm"` at `computeResource.provider`, but this isn't a valid value for `
ProviderEnum`. Update the field or resolver to return one of `ProviderEnum`'s values instead.
 02510a9d | /usr/share/gems/gems/graphql-1.13.16/lib/graphql/schema/enum.rb:161:in `coerce_result'

This is because app/graphql/types/provider_enum.rb uses `supported_providers` and not `all_providers` to obtain the list of providers.

irb(main):001:0> ::ComputeResource.supported_providers.keys
=> ["Libvirt", "Ovirt", "EC2", "Vmware", "Openstack"]
irb(main):002:0> ::ComputeResource.all_providers.keys
=> ["Libvirt", "Ovirt", "EC2", "Vmware", "Openstack", "AzureRm", "GCE"]

Comment 1 Evgeni Golov 2023-05-09 07:08:42 UTC
The same is also true for the ProviderFriendlyNameEnum, but changing that my Satellite refuses to start due to BZ#2196242

Comment 2 Evgeni Golov 2023-05-09 07:12:17 UTC
Created redmine issue https://projects.theforeman.org/issues/36370 from this bug

Comment 3 Bryan Kearney 2023-05-09 08:03:35 UTC
Upstream bug assigned to egolov

Comment 4 Bryan Kearney 2023-05-09 08:03:37 UTC
Upstream bug assigned to egolov

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

Comment 6 sganar 2023-07-12 10:48:47 UTC
Verified.

Tested on Satellite 6.14.0 Snap 6.0

Steps followed: 
1. create an Azure (or Google) CR
2. curl -X POST -H "Content-Type: application/json" -d '{"query": "{ computeResource(id: \"MDE6Q29tcHV0ZVJlc291cmNlLTE=\") \{id, provider\} }"}' -u admin:passwd https://$(hostname -f)/api/graphql

Observation:
No error observed.
 
{"data":{"computeResource":{"id":"MDE6Q29tcHV0ZVJlc291cmNlLTE=","provider":"AzureRm"}}}

Comment 9 errata-xmlrpc 2023-11-08 14:19:23 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.14 security and bug fix 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:6818