Blame SOURCES/sos-bz1002943-No-TTY-should-not-imply-batch-mode.patch

6b17e9
From d975e802c6513463cc52efa0cfdfaa2d2de84adf Mon Sep 17 00:00:00 2001
6b17e9
From: "Bryn M. Reeves" <bmr@redhat.com>
6b17e9
Date: Thu, 3 Oct 2013 17:57:42 +0100
6b17e9
Subject: [PATCH 1/2] No TTY should not imply batch mode
6b17e9
6b17e9
Commit 6ea48cbb introduced an isatty() check on stdin and
6b17e9
automatically sets batch mode if we're not attached to a TTY.
6b17e9
6b17e9
Although the logic of this seems simple enough the combination of
6b17e9
this and commit 4b46e04 breaks valid uses that have worked since
6b17e9
sos-1.x, e.g.:
6b17e9
6b17e9
Traceback (most recent call last):
6b17e9
  File "/usr/sbin/sosreport", line 23, in <module>
6b17e9
    main(sys.argv[1:])
6b17e9
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1171, in main
6b17e9
    sos.execute()
6b17e9
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1133, in execute
6b17e9
    self._setup_logging()
6b17e9
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 630, in _setup_logging
6b17e9
    self.opts.batch = True
6b17e9
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 324, in batch
6b17e9
    self._check_options_initialized()
6b17e9
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 229, in _check_options_initialized
6b17e9
    + "from command line")
6b17e9
ValueError: SoSOptions object already initialized from command line
6b17e9
6b17e9
Given the actual semantics of --batch (do not prompt for or read
6b17e9
user input from stdin) there is no need to enable it if stdin is
6b17e9
a pipe or other non-TTY file descriptor.
6b17e9
6b17e9
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
6b17e9
---
6b17e9
 sos/sosreport.py | 4 ----
6b17e9
 1 file changed, 4 deletions(-)
6b17e9
6b17e9
diff --git a/sos/sosreport.py b/sos/sosreport.py
6b17e9
index 908cbed..88c6730 100644
6b17e9
--- a/sos/sosreport.py
6b17e9
+++ b/sos/sosreport.py
6b17e9
@@ -625,10 +625,6 @@ class SoSReport(object):
6b17e9
             pass
6b17e9
 
6b17e9
     def _setup_logging(self):
6b17e9
-
6b17e9
-        if not sys.stdin.isatty():
6b17e9
-            self.opts.batch = True
6b17e9
-
6b17e9
         # main soslog
6b17e9
         self.soslog = logging.getLogger('sos')
6b17e9
         self.soslog.setLevel(logging.DEBUG)
6b17e9
-- 
6b17e9
1.7.11.7
6b17e9