diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 30f3b54b9600609019131ecddde3a4bd59d2e2b2..1736904a29f3fbae1275b83a3e261e88d86ae8e5 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -519,6 +519,7 @@ def main(): """ options, args = ParseOptions() + utils.debug = options.debug for fname in (constants.SSL_CERT_FILE,): if not os.path.isfile(fname): print "config %s not there, will not run." % fname diff --git a/lib/cli.py b/lib/cli.py index 62fa111cce0a8a25aad61e07f4723196f73b4681..7a4d56c058d44145333ec5c1549927751cbd4048 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -453,6 +453,7 @@ def GenericMain(commands, override=None): logger.SetupLogging(debug=options.debug, program=binary) + utils.debug = options.debug try: utils.Lock('cmd', max_retries=options.lock_retries, debug=options.debug) except errors.LockError, err: diff --git a/lib/utils.py b/lib/utils.py index 450db6a32636072a5bfb9c58ec71051f607d1f60..68fac3e78291755fabac75c53694a64802810582 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -44,6 +44,8 @@ from ganeti import errors _locksheld = [] _re_shell_unquoted = re.compile('^[-.,=:/_+@A-Za-z0-9]+$') +debug = False + class RunResult(object): """Simple class for holding the result of running external programs. @@ -78,6 +80,10 @@ class RunResult(object): else: self.fail_reason = "unable to determine termination reason" + if debug and self.failed: + logger.Debug("Command '%s' failed (%s); output: %s" % + (self.cmd, self.fail_reason, self.output)) + def _GetOutput(self): """Returns the combined stdout and stderr for easier usage.