From 83a4140703e3493c27c4c44e83b91bfd468821d9 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 9 Jul 2019 14:41:07 -0400 Subject: [PATCH] Allow enabling debug mode in config Makes debugging easier without modifying code. --- node-daemon/pvcd/Daemon.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/node-daemon/pvcd/Daemon.py b/node-daemon/pvcd/Daemon.py index cd3e85cc..3a9c1065 100644 --- a/node-daemon/pvcd/Daemon.py +++ b/node-daemon/pvcd/Daemon.py @@ -22,8 +22,6 @@ # Version string for startup output version = '0.4' -# Debugging output mode -debug = False import kazoo.client import libvirt @@ -164,6 +162,17 @@ def readConfig(pvcd_config_file, myhostname): exit(1) config = config_general + # Handle debugging config + try: + config_debug = { + 'debug': o_config['debug'] + } + except: + config_debug = { + 'debug': False + } + config = {**config, **config_debug} + # Handle the networking config if config['enable_networking']: try: @@ -250,6 +259,9 @@ def readConfig(pvcd_config_file, myhostname): # Get the config object from readConfig() config = readConfig(pvcd_config_file, myhostname) +debug = config['debug'] +if debug: + print('DEBUG MODE ENABLED') # Handle the enable values enable_hypervisor = config['enable_hypervisor']