Blob Blame History Raw
From 48bf31cb12ddca8df530739943744f2da7aa94c8 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Fri, 10 Jul 2015 10:55:23 +0200
Subject: [PATCH 3/3] fence_ipmilan: Do not print password to debug info

Resolves: rhbz#1241648
---
 fence/agents/lib/fencing.py.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 9a16aee..7fddc47 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1182,7 +1182,11 @@ def run_command(options, command, timeout=None, env=None):
 	if timeout is not None:
 		timeout = float(timeout)
 
-	logging.info("Executing: %s\n", command)
+	# For IPMI password occurs on command line, it should not be part of debug info
+	log_command = command
+	if "ipmitool" in log_command:
+		log_command = re.sub("-P (.+?) -p", "-P [set] -p", log_command)
+	logging.info("Executing: %s\n", log_command)
 
 	try:
 		process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
-- 
1.9.3