You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
class AEsxiServer(object):
def __init__(self, servername, password, username='root'):
self.servername = servername
self.username = username
self.password = password
self.vmlist = []
self.vmstatusdict = {}
self.vmmaclist = {}
self.vmdict = {}
self.inUseDict = {}
def connect(self):
print "connecting to %s" % self.servername
self.server = VIServer()
self.server.connect(self.servername, self.username, self.password)
print "connected to %s" % self.servername
print "Currently server version is: %s %s" \
% (self.server.get_server_type(), self.server.get_api_version())
def get_vmmaclist(self):
for vmPath in self.get_vmlist():
vm = self.server.get_vm_by_path(vmPath)
vminfo = vm.get_properties()
vmmacinfo = vminfo['mac_address']
print vmmacinfo
def main():
print "This is Esxi Server Object"
S=AEsxiServer('xxxx','xxxx')
S.connect()
S.get_vmmaclist()
if __name__ == '__main__':
main()
results:
print vmmacinfo # it will return "None"
S.get_vmmaclist() will return the following errors
Traceback (most recent call last):
File "./AsterEsxiServer.py", line 133, in <module>
main()
File "./AsterEsxiServer.py", line 125, in main
asterS.get_vmmaclist()
File "./AsterEsxiServer.py", line 60, in get_vmmaclist
vmmacinfo = vminfo['mac_address']
KeyError: 'mac_address'
What is the expected output? What do you see instead?
It should output mac address, but it prompts that don't have the key
'mac_address'
BTW, I can get
What version of the product are you using? On what operating system?
RHEL6.5
Please provide any additional information below.
Original issue reported on code.google.com by [email protected] on 30 Dec 2013 at 6:21
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 30 Dec 2013 at 6:21The text was updated successfully, but these errors were encountered: