Description of problem:
I can successfully create an Azure provider is successfully created, however during an EMS Refresh the refresh process encounters an error. Below is the error and beginning of the stack trace.
[----] E, [2016-08-17T15:19:26.230101 #60252:c7d990] ERROR -- : MIQ(ManageIQ::Providers::Azure::CloudManager::Refresher#refresh) EMS: [Azure], id: [1000000000011] Refresh failed
[----] E, [2016-08-17T15:19:26.267193 #60252:c7d990] ERROR -- : [NameError]: undefined local variable or method `resource' for #<ManageIQ::Providers::Azure::CloudManager::RefreshParser:0x00000005125a20> Method:[rescue in block in refresh]
[----] E, [2016-08-17T15:19:26.267261 #60252:c7d990] ERROR -- : /var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:131:in `transfer_selected_resource_properties'
/var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:121:in `block in resource_already_collected?'
/var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:116:in `each'
/var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:116:in `each_with_index'
/var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:116:in `resource_already_collected?'
<< CLIPPED >>
The code block being executed is:
def transfer_selected_resource_properties(old_resource, new_resource)
if new_resource.properties.provisioning_state != 'Succeeded'
old_resource.properties.provisioning_state = resource.properties.provisioning_state
end
if new_resource.properties.try(:status_message)
if old_resource.properties.try(:status_message)
old_resource.properties.status_message += "\n#{new_resource.properties.status_message}"
else
old_resource.properties['status_message'] = new_resource.properties.status_message
end
end
end
There is a resource that has a provisioning state that is not Successful and therefore CloudForms attempts to set properties of the old_resource variable from the variable named resource, but there is no variable named "resource" in the current scope.
Based on how the function is being called from the resource_already_collected? function (line 123) I believe the variable named resource should really be named new_resource.
Modified code block:
def transfer_selected_resource_properties(old_resource, new_resource)
if new_resource.properties.provisioning_state != 'Succeeded'
old_resource.properties.provisioning_state = new_resource.properties.provisioning_state
end
if new_resource.properties.try(:status_message)
if old_resource.properties.try(:status_message)
old_resource.properties.status_message += "\n#{new_resource.properties.status_message}"
else
old_resource.properties['status_message'] = new_resource.properties.status_message
end
end
end
Version-Release number of selected component (if applicable):
cfme-5.6.0.13
How reproducible:
requires this Azure account
Description of problem: I can successfully create an Azure provider is successfully created, however during an EMS Refresh the refresh process encounters an error. Below is the error and beginning of the stack trace. [----] E, [2016-08-17T15:19:26.230101 #60252:c7d990] ERROR -- : MIQ(ManageIQ::Providers::Azure::CloudManager::Refresher#refresh) EMS: [Azure], id: [1000000000011] Refresh failed [----] E, [2016-08-17T15:19:26.267193 #60252:c7d990] ERROR -- : [NameError]: undefined local variable or method `resource' for #<ManageIQ::Providers::Azure::CloudManager::RefreshParser:0x00000005125a20> Method:[rescue in block in refresh] [----] E, [2016-08-17T15:19:26.267261 #60252:c7d990] ERROR -- : /var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:131:in `transfer_selected_resource_properties' /var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:121:in `block in resource_already_collected?' /var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:116:in `each' /var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:116:in `each_with_index' /var/www/miq/vmdb/app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb:116:in `resource_already_collected?' << CLIPPED >> The code block being executed is: def transfer_selected_resource_properties(old_resource, new_resource) if new_resource.properties.provisioning_state != 'Succeeded' old_resource.properties.provisioning_state = resource.properties.provisioning_state end if new_resource.properties.try(:status_message) if old_resource.properties.try(:status_message) old_resource.properties.status_message += "\n#{new_resource.properties.status_message}" else old_resource.properties['status_message'] = new_resource.properties.status_message end end end There is a resource that has a provisioning state that is not Successful and therefore CloudForms attempts to set properties of the old_resource variable from the variable named resource, but there is no variable named "resource" in the current scope. Based on how the function is being called from the resource_already_collected? function (line 123) I believe the variable named resource should really be named new_resource. Modified code block: def transfer_selected_resource_properties(old_resource, new_resource) if new_resource.properties.provisioning_state != 'Succeeded' old_resource.properties.provisioning_state = new_resource.properties.provisioning_state end if new_resource.properties.try(:status_message) if old_resource.properties.try(:status_message) old_resource.properties.status_message += "\n#{new_resource.properties.status_message}" else old_resource.properties['status_message'] = new_resource.properties.status_message end end end Version-Release number of selected component (if applicable): cfme-5.6.0.13 How reproducible: requires this Azure account