@cryptotaxi247 / netdata-1 / commits / 6966e00a3

set global variables at the beginning

paulfantom committed Jun 11, 2016 at 17:28 UTC 6966e00a3b909413ab5fa16240b8d3d9a526fd58
1 file changed +4 -3
plugins.d/python.d.plugin
+4 -3
@@ -219,7 +219,7 @@ def debug(*args):
219
220 def parse_cmdline(directory, *commands):
221 # TODO number -> interval
222 - global DEBUG_FLAG, PROGRAM
222 + global DEBUG_FLAG
223 DEBUG_FLAG = False
224 interval = None
225
@@ -239,7 +239,6 @@ def parse_cmdline(directory, *commands):
239 except ValueError:
240 pass
241
242 - PROGRAM = commands[0].split('/')[-1].split('.plugin')[0]
242 debug("started from", commands[0], "with options:", *commands[1:])
243
244 return {'interval': interval,
@@ -248,6 +247,9 @@ def parse_cmdline(directory, *commands):
247
248 # if __name__ == '__main__':
249 def run():
250 + global DEBUG_FLAG, PROGRAM
251 + DEBUG_FLAG = True
252 + PROGRAM = sys.argv[0].split('/')[-1].split('.plugin')[0]
253 # parse env variables
254 # https://github.com/firehol/netdata/wiki/External-Plugins#environment-variables
255 main_dir = os.getenv('NETDATA_PLUGINS_DIR',
@@ -282,7 +284,6 @@ def run():
284 interval = int(conf['interval'])
285 except (KeyError, TypeError):
286 pass # default interval
285 - global DEBUG_FLAG
287 try:
288 DEBUG_FLAG = bool(conf['debug'])
289 except (KeyError, TypeError):