Project

General

Profile

Actions

Bug #36370

closed

Can't query plugin CRs via GraphQL

Added by Evgeni Golov 11 months ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
VM management
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2196436

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"]
Actions #1

Updated by The Foreman Bot 11 months ago

  • Status changed from New to Ready For Testing
  • Assignee set to Evgeni Golov
  • Pull request https://github.com/theforeman/foreman/pull/9701 added
Actions #2

Updated by Evgeni Golov 11 months ago

  • Subject changed from Can't query plugin CRs via GraphQL to Can't query plugin CRs via GraphQL
  • Description updated (diff)
Actions #3

Updated by The Foreman Bot 11 months ago

  • Pull request https://github.com/theforeman/foreman/pull/9702 added
Actions #4

Updated by Evgeni Golov 11 months ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/9702)
Actions #5

Updated by The Foreman Bot 11 months ago

  • Fixed in Releases 3.7.0 added
Actions #6

Updated by Evgeni Golov 11 months ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by Ewoud Kohl van Wijngaarden 11 months ago

  • Triaged changed from No to Yes
Actions

Also available in: Atom PDF