@cryptotaxi247 / netdata-1 / commits / 12aaef0f8

check if modules provided by cli param exist

paulfantom committed Jun 11, 2016 at 21:03 UTC 12aaef0f8e94e125654e9b790702979da1a5f5e3
1 file changed +7 -3
plugins.d/python.d.plugin
+7 -3
@@ -35,9 +35,13 @@ class PythonCharts(object):
35 self.modules = []
36 if len(modules) > 0:
37 for m in modules:
38 - self.modules.append(
39 - self.import_plugin(
40 - modules_path + m + ".chart.py"))
38 + mod = self.import_plugin(modules_path + m + ".chart.py")
39 + if mod is not None:
40 + self.modules.append(mod)
41 + if len(self.modules) == 0:
42 + debug("cannot find provided module(s)", modules_path)
43 + sys.stdout.write("DISABLE\n")
44 + sys.exit(1)
45 else:
46 self.load_modules(modules_path)
47 if len(self.modules) == 0: