From: Walter A. Boring IV <walter.boring@hp.com>
Date: Thu, 16 Apr 2015 17:44:10 +0000 (-0700)
Subject: Mask passwords with iscsiadm commands
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=64d7923f3665ce5f40572980e1ea65b3c4df02b7;p=openstack-build%2Fcinder-build.git

Mask passwords with iscsiadm commands

This patch adds the fix that exists in the nova
libvirt volume code to use oslo_utils strutils
to mask passwords that might show up in debug log
messages.

Change-Id: I5c321d6b2627f186ff3dfe64ee7ad71f27a95cf0
Closes-Bug: 1445137
---

diff --git a/cinder/brick/initiator/connector.py b/cinder/brick/initiator/connector.py
index f18bf5fc2..449f83e9e 100644
--- a/cinder/brick/initiator/connector.py
+++ b/cinder/brick/initiator/connector.py
@@ -23,6 +23,7 @@ import time
 from oslo_concurrency import lockutils
 from oslo_concurrency import processutils as putils
 from oslo_log import log as logging
+from oslo_utils import strutils
 import six
 
 from cinder.brick import exception
@@ -451,8 +452,10 @@ class ISCSIConnector(InitiatorConnector):
                                    *iscsi_command, run_as_root=True,
                                    root_helper=self._root_helper,
                                    check_exit_code=check_exit_code)
-        LOG.debug("iscsiadm %(cmd)s: stdout=%(out)s stderr=%(err)s",
-                  {'cmd': iscsi_command, 'out': out, 'err': err})
+        msg = ("iscsiadm %(cmd)s: stdout=%(out)s stderr=%(err)s",
+               {'cmd': iscsi_command, 'out': out, 'err': err})
+        LOG.debug(strutils.mask_password(msg))
+
         return (out, err)
 
     def _iscsiadm_update(self, connection_properties, property_key,