Return empty AR relation instead of nil for ::InfraManager#cloud_tenants #184
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
InfraProvider don't have relation to cloud_tenants - there was
created only empty method returning nil to preserve consitency - but on
some places is expected AR relation object.
For example screen add new subnet, there are listed network managers and
their parent manager's cloud_tenants but they can be infra manager whithout
cloud_tenants.
Such place, where was expected AR Relation object is here:
https://github.com/ManageIQ/manageiq-api/blob/master/app/controllers/api/subcollections/cloud_tenants.rb#L5
which was reached for example by this request:
http://localhost:3000/api/providers/:id/cloud_tenants but it fails later
when object has been infra manager and the method cloud_tenants_query_resource
was returning nil.
@miq-bot add_label graprindashvili/yes, bug
cc @gtanzillo
@miq-bot assign @aufi
Reproducer
Links
it was found during BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1463422