Bug #30067
openIf there is no VPC networks in the google project, Satellite throws error 'undefined method `map' for nil:NilClass'
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1797693
Description of problem:
If there are no VPC networks on the google-project, that is being used as the Compute resource in Satellite, while adding this compute resource to compute profile, throws below error:
undefined method `map' for nil:NilClass
Version-Release number of selected component (if applicable):
6.6.1
How reproducible:
Always
Steps to Reproduce:
1. In GCP create a project without VPC network
2. Add this google-project as a Compute Resource in the Satellite
3. Now add a compute profile against this Compute Resource
Actual results:
undefined method `map' for nil:NilClass
Expected results:
It should throw error message like "no networks found" instead of "undefined method `map' for nil:NilClass" if there is no usable networks found.
Additional info:
traceback:
ActionView::Template::Error
undefined method `map' for nil:NilClass
/usr/share/foreman/app/models/compute_resources/foreman/model/gce.rb:55:in `networks'
/usr/share/foreman/app/views/compute_resources_vms/form/gce/_base.html.erb:12:in `_cd15ab8a735912d31b6d3db26f2232e2'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/template.rb:159:in `block in render'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/template.rb:354:in `instrument_render_template'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/template.rb:157:in `render'
/opt/theforeman/tfm/root/usr/share/gems/gems/deface-1.3.2/lib/deface/action_view_extensions.rb:41:in `render'
No data to display