summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2016-06-10 14:12:27 -0500
committerGitHub <noreply@github.com>2016-06-10 14:12:27 -0500
commita73122191a7aba80f97332687a2e03cfb0336981 (patch)
tree1858ed941df05d2630c3ddb211f570b3d4f9a989
parent4dae3ae0e5a855de0de7d143556b083cb6237b9d (diff)
parent6956bbd4ed6ba936663f1e88507de2e54a01d641 (diff)
downloadtalos-skeleton-a73122191a7aba80f97332687a2e03cfb0336981.tar.gz
talos-skeleton-a73122191a7aba80f97332687a2e03cfb0336981.zip
Merge pull request #99 from Kenthliu/openbmc
Fix the sensor scandirectory recovery bug when poll or readattribute fail
-rwxr-xr-xbin/hwmon.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/hwmon.py b/bin/hwmon.py
index 66159ee..9f4b1d9 100755
--- a/bin/hwmon.py
+++ b/bin/hwmon.py
@@ -47,10 +47,13 @@ class Hwmons():
self.cache = {}
def readAttribute(self,filename):
- val = ""
+ val = "-1"
+ try:
with open(filename, 'r') as f:
for line in f:
val = line.rstrip('\n')
+ except (OSError, IOError):
+ print "Cannot read attributes:", filename
return val
def writeAttribute(self,filename,value):
@@ -78,6 +81,7 @@ class Hwmons():
self.writeAttribute(attribute,rtn[1])
except:
print "HWMON: Attibute no longer exists: "+attribute
+ self.sensors.pop(objpath,None)
if attribute in self.cache:
del self.cache[attribute]
return False
OpenPOWER on IntegriCloud