File pssh_quiet.patch of Package pssh

diff -aur pssh-2.3.1.orig/man/man1/pssh.1 pssh-2.3.1/man/man1/pssh.1
--- pssh-2.3.1.orig/man/man1/pssh.1	2012-02-02 11:13:09.000000000 -0500
+++ pssh-2.3.1/man/man1/pssh.1	2012-03-15 21:00:50.289055042 -0400
@@ -7,7 +7,7 @@
 
 .SH SYNOPSIS
 .B pssh
-.RB [ \-vAiIP ]
+.RB [ \-vqAiIP ]
 .RB [ \-h
 .IR hosts_file ]
 .RB [ \-H
@@ -31,7 +31,7 @@
 .I command ...
 
 .B pssh \-I
-.RB [ \-vAiIP ]
+.RB [ \-vqAiIP ]
 .RB [ \-h
 .IR hosts_file ]
 .RB [ \-H
@@ -237,6 +237,15 @@
 options.
 
 .TP
+.B \-q
+.PD 0
+.TP
+.B \-\-quiet
+Don't print status messages. With
+.B \-i
+prepend host names to the output.
+
+.TP
 .B \-I
 .PD 0
 .TP
diff -aur pssh-2.3.1.orig/psshlib/cli.py pssh-2.3.1/psshlib/cli.py
--- pssh-2.3.1.orig/psshlib/cli.py	2012-02-02 11:13:09.000000000 -0500
+++ pssh-2.3.1/psshlib/cli.py	2012-03-15 21:09:54.406252639 -0400
@@ -44,6 +44,8 @@
             metavar='OPTION', help='SSH option (OPTIONAL)')
     parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
             help='turn on warning and diagnostic messages (OPTIONAL)')
+    parser.add_option('-q', '--quiet', dest='quiet', action='store_true',
+            help='turn off informational and status messages (OPTIONAL)')
     parser.add_option('-A', '--askpass', dest='askpass', action='store_true',
             help='Ask for a password (OPTIONAL)')
     parser.add_option('-x', '--extra-args', action='callback', type='string',
@@ -65,6 +67,7 @@
             ('errdir', 'PSSH_ERRDIR'),
             ('timeout', 'PSSH_TIMEOUT'),
             ('verbose', 'PSSH_VERBOSE'),
+            ('quiet', 'PSSH_QUIET'),
             ('print_out', 'PSSH_PRINT'),
             ('askpass', 'PSSH_ASKPASS'),
             ('inline', 'PSSH_INLINE'),
diff -aur pssh-2.3.1.orig/psshlib/task.py pssh-2.3.1/psshlib/task.py
--- pssh-2.3.1.orig/psshlib/task.py	2012-02-02 11:13:09.000000000 -0500
+++ pssh-2.3.1/psshlib/task.py	2012-03-15 21:12:11.373540315 -0400
@@ -56,6 +56,7 @@
 
         # Set options.
         self.verbose = opts.verbose
+        self.quiet = opts.quiet
         try:
             self.print_out = bool(opts.print_out)
         except AttributeError:
@@ -188,7 +189,10 @@
             buf = os.read(fd, BUFFER_SIZE)
             if buf:
                 if self.inline or self.inline_stdout:
-                    self.outputbuffer += buf
+                    if self.quiet:
+                        self.outputbuffer += "%s: %s" % (self.host, buf)
+                    else:
+                        self.outputbuffer += buf
                 if self.outfile:
                     self.writer.write(self.outfile, buf)
                 if self.print_out:
@@ -264,10 +268,11 @@
             failure = "[FAILURE]"
             stderr = "Stderr: "
         host = self.pretty_host
-        if self.failures:
-            print(' '.join((progress, tstamp, failure, host, error)))
-        else:
-            print(' '.join((progress, tstamp, success, host)))
+        if not self.quiet:
+            if self.failures:
+                print(' '.join((progress, tstamp, failure, host, error)))
+            else:
+                print(' '.join((progress, tstamp, success, host)))
         # NOTE: The extra flushes are to ensure that the data is output in
         # the correct order with the C implementation of io.
         if self.outputbuffer:
@@ -286,3 +291,4 @@
             except AttributeError:
                 sys.stdout.write(self.errorbuffer)
 
+# vim:ts=4:sw=4:et:
openSUSE Build Service is sponsored by