Bug #22798
VMware: Exception listing VMs in the root of the datacenter
Description
When listing virtual machines under a compute_resource on VMware vSphere a folder hash is built of all folders under the datacenter, but the datacenter's vmFolder is skipped in the PropertyFilterSpec.
This causes VMs which have the vmFolder as their parent to throw an undefined method '[]' for nil:NilClass error when they try to access 'folder_inventory[vm['parent']._ref][:path]'.
Traceback:
2018-03-06T11:11:34 fd0ae69d [app] [W] Error has occurred while listing VMs on dev-vc65 (VMware)
| NoMethodError: undefined method `[]' for nil:NilClass
| /home/agrare/src/foreman/app/services/fog_extensions/vsphere/mini_servers.rb:61:in `lookup_parent_folders'
| /home/agrare/src/foreman/app/services/fog_extensions/vsphere/mini_servers.rb:62:in `lookup_parent_folders'
| /home/agrare/src/foreman/app/services/fog_extensions/vsphere/mini_servers.rb:56:in `block in set_folder_paths'
| /home/agrare/src/foreman/app/services/fog_extensions/vsphere/mini_servers.rb:55:in `each'
| /home/agrare/src/foreman/app/services/fog_extensions/vsphere/mini_servers.rb:55:in `set_folder_paths'
| /home/agrare/src/foreman/app/services/fog_extensions/vsphere/mini_servers.rb:50:in `generate_folder_inventory'
| /home/agrare/src/foreman/app/services/fog_extensions/vsphere/mini_servers.rb:21:in `all'
Related issues
Associated revisions
History
#1
Updated by The Foreman Bot over 4 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/5297 added
#2
Updated by Ohad Levy over 4 years ago
- Category set to Compute resources - VMware
#3
Updated by Ohad Levy over 4 years ago
- Legacy Backlogs Release (now unused) set to 330
#4
Updated by Ohad Levy over 4 years ago
- Related to Feature #22258: VMWare: Speed up VM listing added
#5
Updated by Adam Grare over 4 years ago
- % Done changed from 0 to 100
- Status changed from Ready For Testing to Closed
Applied in changeset 68e96c10b596d67106a3ed49535231019d8507b4.
Fixes #22798 - VMware: Fix exception listing VMs
If a VM is in the root of the datacenter its parent is the vmFolder.
This folder was being skipped by the PropertyFilterSpec causing an
undefined method error '[]' for nil:NilClass when accessing the
vm['parent'] key.