Fix broken formatting of processutils.execute log statement
The processutils.execute function will log a message about each command it runs which looks like this: Running cmd (subprocess): /bin/echo hello world In the following commit: commit cdcc19c1d78a4a88daabfb64b27abd4924aa442d Author: Brad Pokorny <bpokorny@us.ibm.com> Date: Sun May 18 18:26:33 2014 +0000 Mask passwords that are included in commands The command is passthrough through logging.mask_password first. Unfortunately this method expects a string as its parameter, but is given a list of strings instead. This causes it to stringify the list object. The result is that the log message ends up being mangled to look like this: Running cmd (subprocess): [ ' / b i n / e c h o ' , ' h e l l o w o r l d ' ] The execute method should have been masking the password after turning the list of strings into a single string, instead of before. Change-Id: I994a3449a6a88e7ba1dd24b1e65183c018e4c3a3
This commit is contained in:
@@ -157,7 +157,7 @@ def execute(*cmd, **kwargs):
|
||||
attempts -= 1
|
||||
try:
|
||||
LOG.log(loglevel, 'Running cmd (subprocess): %s',
|
||||
' '.join(logging.mask_password(cmd)))
|
||||
logging.mask_password(' '.join(cmd)))
|
||||
_PIPE = subprocess.PIPE # pylint: disable=E1101
|
||||
|
||||
if os.name == 'nt':
|
||||
|
||||
Reference in New Issue
Block a user