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

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