-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Full error:
File "/home/bob/.local/lib/python3.6/site-packages/rvtools/vinfo/vinfo.py", line 8, in get_obj
obj = container.view[0].name
IndexError: list index out of range
Here is the function where it is failing:
def get_obj(content, vimtype):
obj = None
container = content.viewManager.CreateContainerView(content.rootFolder, vimtype, True)
obj = container.view[0].name
# for c in container.view:
# if name:
# if c.name == name:
# obj = c
# break
# else:
# obj = c
# break
return obj
Trouble shooting:
- Tried using the ~/.rvtools conf file, also used directly inline.
- Edited vinfo.py to do some print statements to backtrack, Here is the function, added the following print statements:
def get_obj(content, vimtype):
obj = None
container = content.viewManager.CreateContainerView(content.rootFolder, vimtype, True)
print("!!!!!!!!!!!!!!1")
print(container.view[0].name)
print("!!!!!!!!!!!!!!2")
obj = container.view[0].name
# for c in container.view:
# if name:
# if c.name == name:
# obj = c
# break
# else:
# obj = c
# break
return obj
Here is the output I get now:
bob@Ubuntu-vm:~$ rvtools -s 10.10.10.10 -u administrator@vsphere.local -p admin123 -d ./vmware/
Using flags
vcenter: 10.10.10.10
user: administrator@vsphere.local
## Processing vInfo module
Machine Name: vm01
Powerstate: poweredOn
Template: False
Config status: green
DNS Name: localhost
Connection state: connected
Guest state: running
Heartbeat: green
Consolidation needed: False
Suspend time:
Change version: 2020-11-11T18:44:52.989107Z
CPUs: 2
Latency sensitivy: normal
Memory: 16384
Nics: 1
Disks: 1
Network #1: VM Network
Network #2:
Network #3:
Network #4:
Num monitors: 1
Video ram KB: 4096
FT state: notConfigured
Boot delay: 0
Boot retry delay: 10000
Boot retry enabled: False
Firmware: bios
Path: [datadisk-01] vm01/vm01.vmx
!!!!!!!!!!!!!!1
MyDataCenter
!!!!!!!!!!!!!!2
Datacenter: MyDataCenter
!!!!!!!!!!!!!!1
Traceback (most recent call last):
File "/home/bob/.local/bin/rvtools", line 8, in <module>
rvtools.main()
File "/home/bob/.local/lib/python3.6/site-packages/rvtools/rvtools.py", line 92, in main
vinfo_collect(service_instance, directory)
File "/home/bob/.local/lib/python3.6/site-packages/rvtools/vinfo/vinfo.py", line 364, in vinfo_collect
cluster = get_obj(content, [vim.ClusterComputeResource])
File "/home/bob/.local/lib/python3.6/site-packages/rvtools/vinfo/vinfo.py", line 9, in get_obj
print(container.view[0].name)
IndexError: list index out of range
- Note when I force the string "MyDataCenter" into "datacenter" for line 358, then the error appears on line 636 for the cluster.
Workaround
- I ended up not using the "get_obj" function, and just defined my datacenter and cluster names as strings. This seemed to work. Also not we do not have a cluster, our hosts are attached directly to the datacenter (Wonder if this is the issue?), I put "none" for cluster.
I am not a python guru, so any feedback you could provide would be helpful. It looks like the function is trying to pull the datacenter name out of the object, and it looks like it succeeds based on the sytnax container.view[0].name, but for whatever reason the get_obj function fails.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working