summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b96e6dd)
raw | patch | inline | side by side (parent: b96e6dd)
author | Peter Warasin <peter@endian.com> | |
Mon, 27 Jun 2011 18:10:51 +0000 (20:10 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 22 Aug 2011 16:51:57 +0000 (18:51 +0200) |
raise a KeyError if getval() or getthreshold() unixsock returns replies an
error because of request of an unknown identifier
Signed-off-by: Florian Forster <octo@collectd.org>
error because of request of an unknown identifier
Signed-off-by: Florian Forster <octo@collectd.org>
contrib/collectd_unixsock.py | patch | blob | history |
index ebe040d6a11846ab77fe446112668e29354f904f..1b8e6b174ed8d8ad1a7abc1237842e03d5908075 100644 (file)
"""
numvalues = self._cmd('GETTHRESHOLD "%s"' % identifier)
lines = []
- if numvalues:
- lines = self._readlines(numvalues)
+ if not numvalues or numvalues < 0:
+ raise KeyError("Identifier '%s' not found" % identifier)
+ lines = self._readlines(numvalues)
return lines
def getval(self, identifier, flush_after=True):
"""
numvalues = self._cmd('GETVAL "%s"' % identifier)
lines = []
- if numvalues:
- lines = self._readlines(numvalues)
+ if not numvalues or numvalues < 0:
+ raise KeyError("Identifier '%s' not found" % identifier)
+ lines = self._readlines(numvalues)
if flush_after:
self.flush(identifiers=[identifier])
return lines