Red Hat Bugzilla – Bug 1461785
Openshift refresh crashes due to template.objects being nil
Last modified: 2017-06-22 15:52:54 EDT
Description of problem:
> We are currently encountering an issue concerning refresh on our Cloudforms installation (CFME 188.8.131.52) with Openshift provider. We always have the following error for Openshift refresh (from evm.log):
[----] E, [2017-06-14T13:27:06.898512 #2877:10f9140] ERROR -- : MIQ(MiqQueue#deliver) Message id: , Error: [undefined method `collect' for nil:NilClass]
[----] E, [2017-06-14T13:27:06.898878 #2877:10f9140] ERROR -- : [EmsRefresh::Refreshers::EmsRefresherMixin::PartialRefreshError]: undefined method `collect' for nil:NilClass Method:[rescue in deliver]
[----] E, [2017-06-14T13:27:06.899031 #2877:10f9140] ERROR -- : /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:50:in `refresh'
[----] E, [2017-06-14T13:28:29.565786 #2877:10f9140] ERROR -- : MIQ(ManageIQ::Providers::Openshift::ContainerManager::Refresher#refresh) EMS: [Kermit], id:  Refresh failed
[----] E, [2017-06-14T13:28:29.566924 #2877:10f9140] ERROR -- : [NoMethodError]: undefined method `collect' for nil:NilClass Method:[rescue in block in refresh]
[----] E, [2017-06-14T13:28:29.567100 #2877:10f9140] ERROR -- : /var/www/miq/vmdb/app/models/manageiq/providers/openshift/container_manager/refresh_parser.rb:150:in `parse_template'
[----] E, [2017-06-14T13:28:29.567165 #2877:10f9140] ERROR -- : MIQ(ManageIQ::Providers::Openshift::ContainerManager::Refresher#refresh) EMS: [Kermit], id:  Unable to perform refresh for the following targets:
[----] E, [2017-06-14T13:28:29.567297 #2877:10f9140] ERROR -- : MIQ(ManageIQ::Providers::Openshift::ContainerManager::Refresher#refresh) --- ManageIQ::Providers::Openshift::ContainerManager [Kermit] id 
It's a blocking point for us because we are using Cloudforms with our Openshift provider in order to generate bills, and if refresh doesn't work, we don't see new Openshift projects created and their metrics consumptions are not collected.
> actually we had one of our customer who created a template without object (we can actually set "null" for object value), that was the one which prevent us refreshing Openshift provider. I had an object on it and it works again ! So thanks for the workaround.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. oc create template / oc edit template, setting `objects: null` instead of a list.
2. refresh openshift from cloudforms
Refresh fails, errors in evm.log
Crash seems here:
The objects array in openshift doesn't have `omitempty`
so I suppose given zero objects we'll still see an empty array,
but an explicit `objects: null` in the template (and maybe omitting `objects:` altogether?) crashes us.