Blob Blame History Raw
diff -uNr a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
--- a/fence/agents/apc/fence_apc.py	2016-06-17 12:39:29.677024556 +0200
+++ b/fence/agents/apc/fence_apc.py	2016-06-17 12:58:58.234215019 +0200
@@ -14,7 +14,7 @@
 ##        cipher (des/blowfish) have to be defined
 #####
 
-import sys, re
+import sys, re, time
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
@@ -26,6 +26,10 @@
 BUILD_DATE="March, 2008"
 #END_VERSION_GENERATION
 
+# Fix for connection timed out issue in:
+# https://bugzilla.redhat.com/show_bug.cgi?id=1342584
+TIMEDOUT_DELAY = 0.5
+
 def get_power_status(conn, options):
 	exp_result = 0
 	outlets = {}
@@ -78,6 +82,7 @@
 			res = show_re.search(line)
 			if res != None:
 				outlets[res.group(2)] = (res.group(3), res.group(4))
+		time.sleep(TIMEDOUT_DELAY)
 		conn.send_eol("")
 		if exp_result != 0:
 			break
@@ -151,6 +156,7 @@
 
 	while 0 == conn.log_expect(options,
 			["Press <ENTER>"] + options["--command-prompt"], int(options["--shell-timeout"])):
+		time.sleep(TIMEDOUT_DELAY)
 		conn.send_eol("")
 
 	conn.send_eol(options["--plug"]+"")
@@ -171,6 +177,7 @@
 	conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", int(options["--shell-timeout"]))
 	conn.send_eol("YES")
 	conn.log_expect(options, "Press <ENTER> to continue...", int(options["--shell-timeout"]))
+	time.sleep(TIMEDOUT_DELAY)
 	conn.send_eol("")
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	conn.send(chr(03))