Blame SOURCES/bz1241648-fence_ipmilan_password_verbose.patch

44709c
From 48bf31cb12ddca8df530739943744f2da7aa94c8 Mon Sep 17 00:00:00 2001
44709c
From: Marek 'marx' Grac <mgrac@redhat.com>
44709c
Date: Fri, 10 Jul 2015 10:55:23 +0200
44709c
Subject: [PATCH 3/3] fence_ipmilan: Do not print password to debug info
44709c
44709c
Resolves: rhbz#1241648
44709c
---
44709c
 fence/agents/lib/fencing.py.py | 6 +++++-
44709c
 1 file changed, 5 insertions(+), 1 deletion(-)
44709c
44709c
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
44709c
index 9a16aee..7fddc47 100644
44709c
--- a/fence/agents/lib/fencing.py.py
44709c
+++ b/fence/agents/lib/fencing.py.py
44709c
@@ -1182,7 +1182,11 @@ def run_command(options, command, timeout=None, env=None):
44709c
 	if timeout is not None:
44709c
 		timeout = float(timeout)
44709c
 
44709c
-	logging.info("Executing: %s\n", command)
44709c
+	# For IPMI password occurs on command line, it should not be part of debug info
44709c
+	log_command = command
44709c
+	if "ipmitool" in log_command:
44709c
+		log_command = re.sub("-P (.+?) -p", "-P [set] -p", log_command)
44709c
+	logging.info("Executing: %s\n", log_command)
44709c
 
44709c
 	try:
44709c
 		process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
44709c
-- 
44709c
1.9.3
44709c