From 9a9d8cec7ccbe13c7787d6ec813d7c1051538c3a Mon Sep 17 00:00:00 2001 From: Tomoki Sekiyama Date: Tue, 8 Jul 2014 17:17:51 -0400 Subject: [PATCH] Sync processutils and log from oslo This change syncs in: 33afb20 Fix broken formatting of processutils.execute log statement 5e3d3a5 Mask passwords included without quotes at the ends of commands 6751b30 Remove extra whitespace The most important part is '33afb20' which was broken cinder debug logging on running commands after last oslo sync. Change-Id: I77e0f943d39bb34ff95bac1e9d63d7450f8c24bf --- cinder/openstack/common/log.py | 6 +++--- cinder/openstack/common/processutils.py | 2 +- etc/cinder/cinder.conf.sample | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cinder/openstack/common/log.py b/cinder/openstack/common/log.py index 3e1e96849..5307e41db 100644 --- a/cinder/openstack/common/log.py +++ b/cinder/openstack/common/log.py @@ -62,7 +62,7 @@ _FORMAT_PATTERNS = [r'(%(key)s\s*[=]\s*[\"\']).*?([\"\'])', r'([\'"].*?%(key)s[\'"]\s*:\s*u?[\'"]).*?([\'"])', r'([\'"].*?%(key)s[\'"]\s*,\s*\'--?[A-z]+\'\s*,\s*u?[\'"])' '.*?([\'"])', - r'(%(key)s\s*--?[A-z]+\s*).*?([\s])'] + r'(%(key)s\s*--?[A-z]+\s*)\S+(\s*)'] for key in _SANITIZE_KEYS: for pattern in _FORMAT_PATTERNS: @@ -181,11 +181,11 @@ log_opts = [ cfg.StrOpt('instance_format', default='[instance: %(uuid)s] ', help='The format for an instance that is passed with the log ' - 'message. '), + 'message.'), cfg.StrOpt('instance_uuid_format', default='[instance: %(uuid)s] ', help='The format for an instance UUID that is passed with the ' - 'log message. '), + 'log message.'), ] CONF = cfg.CONF diff --git a/cinder/openstack/common/processutils.py b/cinder/openstack/common/processutils.py index 1743106aa..ace43c88a 100644 --- a/cinder/openstack/common/processutils.py +++ b/cinder/openstack/common/processutils.py @@ -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': diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample index 6eebf405c..60641aee6 100644 --- a/etc/cinder/cinder.conf.sample +++ b/etc/cinder/cinder.conf.sample @@ -768,11 +768,11 @@ #fatal_deprecations=false # The format for an instance that is passed with the log -# message. (string value) +# message. (string value) #instance_format="[instance: %(uuid)s] " # The format for an instance UUID that is passed with the log -# message. (string value) +# message. (string value) #instance_uuid_format="[instance: %(uuid)s] " # The name of a logging configuration file. This file is -- 2.45.2