prevent breaking everything
paulfantom committed
Jun 12, 2016 at 14:25 UTC
5fe4d48d6a8d73861d9cabfd82fe6bbc0b400d1b
1 file changed
+9
-2
plugins.d/python.d.plugin
+9
-2
@@ -178,7 +178,7 @@ class PythonCharts(object):
178
except AttributeError:
179
self.disable_module(mod, "no update")
180
return
181
- except UnboundLocalError:
181
+ except (UnboundLocalError, Exception):
182
self.disable_module(mod, "misbehaving")
183
return
184
t_end = time.time()
@@ -201,7 +201,14 @@ class PythonCharts(object):
201
next_runs = []
202
for mod in self.modules:
203
self.update_module(mod)
204
- next_runs.append(self.timetable[mod.__name__]['next'])
204
+ try:
205
+ next_runs.append(self.timetable[mod.__name__]['next'])
206
+ except KeyError:
207
+ pass
208
+ if len(next_runs) == 0:
209
+ debug("No plugins loaded")
210
+ sys.stdout.write("DISABLE\n")
211
+ sys.exit(1)
212
time.sleep(min(next_runs) - time.time())
213
214