Blame SOURCES/bz1470813-fencing-3-make-timeout-0-mean-forever.patch

92e554
From 4cf6887e98c712b99f741dbfe54932c60e93741b Mon Sep 17 00:00:00 2001
92e554
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
92e554
Date: Tue, 3 Nov 2020 14:30:12 +0100
92e554
Subject: [PATCH] fencing: fix to make timeout(s)=0 be treated as forever for
92e554
 agents using pexpect
92e554
92e554
---
92e554
 lib/fencing.py.py | 7 +++++--
92e554
 1 file changed, 5 insertions(+), 2 deletions(-)
92e554
92e554
diff --git a/lib/fencing.py.py b/lib/fencing.py.py
92e554
index 4639a9a5..fa34f13a 100644
92e554
--- a/lib/fencing.py.py
92e554
+++ b/lib/fencing.py.py
92e554
@@ -500,10 +500,13 @@ def __init__(self, options, command, **kwargs):
92e554
 		self.opt = options
92e554
 
92e554
 	def log_expect(self, pattern, timeout):
92e554
-		result = self.expect(pattern, timeout)
92e554
+		result = self.expect(pattern, timeout if timeout != 0 else None)
92e554
 		logging.debug("Received: %s", self.before + self.after)
92e554
 		return result
92e554
 
92e554
+	def read_nonblocking(self, size, timeout):
92e554
+		return pexpect.spawn.read_nonblocking(self, size=100, timeout=timeout if timeout != 0 else None)
92e554
+
92e554
 	def send(self, message):
92e554
 		logging.debug("Sent: %s", message)
92e554
 		return pexpect.spawn.send(self, message)
92e554
@@ -516,7 +519,7 @@ def frun(command, timeout=30, withexitstatus=False, events=None,
92e554
 	 extra_args=None, logfile=None, cwd=None, env=None, **kwargs):
92e554
 	if sys.version_info[0] > 2:
92e554
 		kwargs.setdefault('encoding', 'utf-8')
92e554
-	return pexpect.run(command, timeout=timeout,
92e554
+	return pexpect.run(command, timeout=timeout if timeout != 0 else None,
92e554
 			   withexitstatus=withexitstatus, events=events,
92e554
 			   extra_args=extra_args, logfile=logfile, cwd=cwd,
92e554
 			   env=env, **kwargs)