diff options
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r-- | ipapython/ipautil.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 92569c3b4..e00f3ef3f 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -246,7 +246,7 @@ def shell_quote(string): return "'" + string.replace("'", "'\\''") + "'" def run(args, stdin=None, raiseonerr=True, - nolog=(), env=None, capture_output=True, skip_output=False, cwd=None): + nolog=(), env=None, capture_output=True, skip_output=False, cwd=None, debug=False): """ Execute a command and return stdin, stdout and the process return code. @@ -295,8 +295,9 @@ def run(args, stdin=None, raiseonerr=True, p_err = subprocess.PIPE arg_string = nolog_replace(' '.join(args), nolog) - root_logger.debug('Starting external process') - root_logger.debug('args=%s' % arg_string) + if debug: + root_logger.info('Starting external process') + root_logger.info('args=%s' % arg_string) try: p = subprocess.Popen(args, stdin=p_in, stdout=p_out, stderr=p_err, @@ -314,7 +315,8 @@ def run(args, stdin=None, raiseonerr=True, if skip_output: p_out.close() # pylint: disable=E1103 - root_logger.debug('Process finished, return code=%s', p.returncode) + if debug: + root_logger.info('Process finished, return code=%s', p.returncode) # The command and its output may include passwords that we don't want # to log. Replace those. |