Skip to content

Commit

Permalink
Fixed TypeError
Browse files Browse the repository at this point in the history
Mattikin committed Apr 17, 2015
1 parent 6769e2e commit 645febb
Showing 3 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions ZenPacks/community/VMwareESXiMonitor/ESXiDatastore.py
Original file line number Diff line number Diff line change
@@ -39,22 +39,22 @@ def device(self):
def usedSpace(self):
capacity = self.capacity
free = self.freeSpace()
if capacity is None or free is None:
return None
return capacity - free
if capacity is not None and free is not None:
return capacity - free
return None

def freeSpace(self):
free = self.cacheRRDValue('diskFreeSpace')
if free is None or isnan(free):
return None
return long(free)
def freeSpace(self, default = None):
free = self.cacheRRDValue('diskFreeSpace', default)
if free is not None and free != 'Unknown' and not isnan(free):
return long(free)
return None

def usedPercent(self):
capacity = self.capacity
used = self.usedSpace()
if capacity is None or used is None:
return 'Unknown'
return round(100.0 * used / capacity)
if capacity is not None and used is not None:
return round(100.0 * used / capacity)
return 'Unknown'

InitializeClass(ESXiDatastore)

22 changes: 11 additions & 11 deletions ZenPacks/community/VMwareESXiMonitor/ESXiVM.py
Original file line number Diff line number Diff line change
@@ -38,17 +38,17 @@ class ESXiVM(DeviceComponent, ManagedEntity):
def device(self):
return self.esxiHost()

def adminStatus(self):
status = self.cacheRRDValue('adminStatus')
if status is None or isnan(status):
return None
return int(status)

def operStatus(self):
status = self.cacheRRDValue('operStatus')
if status is None or isnan(status):
return None
return int(status)
def adminStatus(self, default = None):
status = self.cacheRRDValue('adminStatus', default)
if status is not None and status != 'Unknown' and not isnan(status):
return int(status)
return None

def operStatus(self, default = None):
status = self.cacheRRDValue('operStatus', default)
if status is not None and status != 'Unknown' and not isnan(status):
return int(status)
return None

InitializeClass(ESXiVM)

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.community.VMwareESXiMonitor"
VERSION = "2.0.4"
VERSION = "2.0.5"
AUTHOR = "Eric Enns, Matthias Kittl"
LICENSE = ""
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.community']

0 comments on commit 645febb

Please sign in to comment.