Skip to contentSkip to conversation

master - lvmdbusd/lvmdb.py: Make stand alone execution work

PATCH tasleson 1 participant 1 message Aug 29, 2016

lore
Share & tools
lore

tasleson

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1870b3293a26f6d946e8451a10e8c9762ae9f31c
Commit:        1870b3293a26f6d946e8451a10e8c9762ae9f31c
Parent:        96a0604bd036d78af964392460d0309456b58b1a
Author:        Tony Asleson <[email protected]>
AuthorDate:    Mon Aug 29 14:52:41 2016 -0500
Committer:     Tony Asleson <[email protected]>
CommitterDate: Mon Aug 29 15:26:56 2016 -0500

lvmdbusd/lvmdb.py: Make stand alone execution work

This was broken when the args were moved to cfg

---
 daemons/lvmdbusd/cmdhandler.py |   10 +++++-----
 daemons/lvmdbusd/utils.py      |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
daemons/lvmdbusd/cmdhandler.py +5 -5
index 877f17c..9b0c877 100644
@@ -38,10 +38,6 @@ total_count = 0
 # at the same time.
 cmd_lock = threading.RLock()
 
-# The actual method which gets called to invoke the lvm command, can vary
-# from forking a new process to using lvm shell
-_t_call = None
-
 
 class LvmExecutionMeta(object):
 
@@ -113,12 +109,16 @@ def call_lvm(command, debug=False):
 		_debug_c(command, process.returncode, (stdout_text, stderr_text))
 
 	if process.returncode == 0:
-		if cfg.args.debug and out[1] and len(out[1]) and 'help' not in command:
+		if cfg.args and cfg.args.debug and out[1] and len(out[1]) and \
+				'help' not in command:
 			log_error('WARNING: lvm is out-putting text to STDERR on success!')
 			_debug_c(command, process.returncode, (stdout_text, stderr_text))
 
 	return process.returncode, stdout_text, stderr_text
 
+# The actual method which gets called to invoke the lvm command, can vary
+# from forking a new process to using lvm shell
+_t_call = call_lvm
 
 def _shell_cfg():
 	global _t_call
daemons/lvmdbusd/utils.py +1 -1
index 06301cd..7d217df 100644
@@ -262,7 +262,7 @@ def _common_log(msg, *attributes):
 # @param msg    Message to output to stdout
 # @return None
 def log_debug(msg, *attributes):
-	if cfg.args.debug:
+	if cfg.args and cfg.args.debug:
 		_common_log(msg, *attributes)