Hello community,
here is the log from the commit of package pssh for openSUSE:Factory checked in at 2012-02-16 12:26:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pssh (Old)
and /work/SRC/openSUSE:Factory/.pssh.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pssh", Maintainer is "DMuhamedagic@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:Factory/pssh/pssh.changes 2012-01-09 21:44:15.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.pssh.new/pssh.changes 2012-02-16 12:26:42.000000000 +0100
@@ -1,0 +2,9 @@
+Tue Feb 14 03:15:49 UTC 2012 - tserong@suse.com
+
+- exit gracefully when pacemaker is not running (--pcmk_nodes)
+- update --quiet option to suppress all status output
+- add /usr/bin to the search path for pssh-askpass
+- add -C (--pcmk_nodes) option (get host names from cluster: crm_node -l)
+- add -q (--quiet) option (suppresses status output)
+
+-------------------------------------------------------------------
New:
----
pssh_askpass_dir.patch
pssh_pcmk_nodes.patch
pssh_quiet.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ pssh.spec ++++++
--- /var/tmp/diff_new_pack.bqEtHM/_old 2012-02-16 12:26:43.000000000 +0100
+++ /var/tmp/diff_new_pack.bqEtHM/_new 2012-02-16 12:26:43.000000000 +0100
@@ -24,6 +24,9 @@
Source: http://parallel-ssh.googlecode.com/files/pssh-%{version}.tar.gz
Patch1: pssh-remove_shebangs.patch
Patch2: pssh-man_dir.patch
+Patch3: pssh_quiet.patch
+Patch4: pssh_pcmk_nodes.patch
+Patch5: pssh_askpass_dir.patch
Url: http://code.google.com/p/parallel-ssh/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
@@ -64,6 +67,9 @@
%setup -q
%patch1
%patch2
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
%build
%__python ./setup.py build
++++++ pssh_askpass_dir.patch ++++++
diff --git a/psshlib/askpass_client.py b/psshlib/askpass_client.py
index 5dc6dc6..2ab67ba 100644
--- a/psshlib/askpass_client.py
+++ b/psshlib/askpass_client.py
@@ -26,6 +26,7 @@ import textwrap
bin_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
askpass_bin_path = os.path.join(bin_dir, 'pssh-askpass')
ASKPASS_PATHS = (askpass_bin_path,
+ '/usr/bin/pssh-askpass',
'/usr/libexec/pssh/pssh-askpass',
'/usr/local/libexec/pssh/pssh-askpass',
'/usr/lib/pssh/pssh-askpass',
++++++ pssh_pcmk_nodes.patch ++++++
commit 9341f843f7eff49da9e909b9b0c87c9d5396155e
Author: Dejan Muhamedagic
Date: Mon Aug 15 14:24:35 2011 +0200
add -C/--pcmk_nodes option to get list of nodes from Pacemaker
diff --git a/bin/pnuke b/bin/pnuke
index 2b4feb5..a0eabdc 100755
--- a/bin/pnuke
+++ b/bin/pnuke
@@ -40,7 +40,7 @@ def parse_args():
if len(args) > 1:
parser.error('Extra arguments given after the pattern.')
- if not opts.host_files and not opts.host_strings:
+ if not opts.host_files and not opts.host_strings and not opts.pcmk_nodes:
parser.error('Hosts not specified.')
return opts, args
@@ -90,4 +90,6 @@ if __name__ == "__main__":
if opts.host_strings:
for s in opts.host_strings:
hosts.extend(psshutil.parse_host_string(s, default_user=opts.user))
+ if opts.pcmk_nodes:
+ hosts += psshutil.get_pcmk_nodes()
do_pnuke(hosts, pattern, opts)
diff --git a/bin/prsync b/bin/prsync
index b66443b..85c4959 100755
--- a/bin/prsync
+++ b/bin/prsync
@@ -55,7 +55,7 @@ def parse_args():
if len(args) > 2:
parser.error('Extra arguments given after the remote path.')
- if not opts.host_files and not opts.host_strings:
+ if not opts.host_files and not opts.host_strings and not opts.pcmk_nodes:
parser.error('Hosts not specified.')
return opts, args
@@ -122,4 +122,6 @@ if __name__ == "__main__":
if opts.host_strings:
for s in opts.host_strings:
hosts.extend(psshutil.parse_host_string(s, default_user=opts.user))
+ if opts.pcmk_nodes:
+ hosts += psshutil.get_pcmk_nodes()
do_prsync(hosts, local, remote, opts)
diff --git a/bin/pscp b/bin/pscp
index 3caf455..4f8c56b 100755
--- a/bin/pscp
+++ b/bin/pscp
@@ -47,7 +47,7 @@ def parse_args():
if len(args) < 2:
parser.error('Remote path not specified.')
- if not opts.host_files and not opts.host_strings:
+ if not opts.host_files and not opts.host_strings and not opts.pcmk_nodes:
parser.error('Hosts not specified.')
return opts, args
@@ -105,4 +105,6 @@ if __name__ == "__main__":
if opts.host_strings:
for s in opts.host_strings:
hosts.extend(psshutil.parse_host_string(s, default_user=opts.user))
+ if opts.pcmk_nodes:
+ hosts += psshutil.get_pcmk_nodes()
do_pscp(hosts, localargs, remote, opts)
diff --git a/bin/pslurp b/bin/pslurp
index 5797e7c..2336a15 100755
--- a/bin/pslurp
+++ b/bin/pslurp
@@ -52,7 +52,7 @@ def parse_args():
if len(args) > 2:
parser.error('Extra arguments given after the local path.')
- if not opts.host_files and not opts.host_strings:
+ if not opts.host_files and not opts.host_strings and not opts.pcmk_nodes:
parser.error('Hosts not specified.')
return opts, args
@@ -126,4 +126,6 @@ if __name__ == "__main__":
if opts.host_strings:
for s in opts.host_strings:
hosts.extend(psshutil.parse_host_string(s, default_user=opts.user))
+ if opts.pcmk_nodes:
+ hosts += psshutil.get_pcmk_nodes()
do_pslurp(hosts, remote, local, opts)
diff --git a/bin/pssh b/bin/pssh
index f9af471..25daa9c 100755
--- a/bin/pssh
+++ b/bin/pssh
@@ -51,7 +51,7 @@ def parse_args():
if len(args) == 0 and not opts.send_input:
parser.error('Command not specified.')
- if not opts.host_files and not opts.host_strings:
+ if not opts.host_files and not opts.host_strings and not opts.pcmk_nodes:
parser.error('Hosts not specified.')
return opts, args
@@ -109,6 +109,10 @@ if __name__ == "__main__":
_, e, _ = sys.exc_info()
sys.stderr.write('Could not open hosts file: %s\n' % e.strerror)
sys.exit(1)
+ if opts.pcmk_nodes:
+ hosts = psshutil.get_pcmk_nodes()
+ if not hosts:
+ sys.exit(1)
if opts.host_strings:
for s in opts.host_strings:
hosts.extend(psshutil.parse_host_string(s, default_user=opts.user))
diff --git a/psshlib/cli.py b/psshlib/cli.py
index e11645a..e950581 100644
--- a/psshlib/cli.py
+++ b/psshlib/cli.py
@@ -28,6 +28,8 @@ def common_parser():
parser.add_option('-H', '--host', dest='host_strings', action='append',
metavar='HOST_STRING',
help='additional host entries ("[user@]host[:port]")')
+ parser.add_option('-C', '--pcmk_nodes', dest='pcmk_nodes', action='store_true',
+ help='get nodes from pacemaker')
parser.add_option('-l', '--user', dest='user',
help='username (OPTIONAL)')
parser.add_option('-p', '--par', dest='par', type='int',
diff --git a/psshlib/psshutil.py b/psshlib/psshutil.py
index ae1a24c..0700ef5 100644
--- a/psshlib/psshutil.py
+++ b/psshlib/psshutil.py
@@ -4,6 +4,7 @@
import fcntl
import string
import sys
+import subprocess
HOST_FORMAT = 'Host format is [user@]host[:port] [user]'
@@ -98,6 +99,33 @@ def parse_host(host, default_user=None, default_port=None):
host, port = host.rsplit(':', 1)
return (host, port, user)
+def get_pcmk_nodes():
+ """Get the list of nodes from crm_node -l.
+
+ Returns a list of (host, port, user) triples.
+ """
+ hosts = []
+ if subprocess.call("which crm_node >/dev/null 2>&1", shell=True) != 0:
+ sys.stderr.write('crm_node not available\n')
+ return hosts
+ cmd = "crm_node -l"
+ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ try:
+ outp = p.communicate()[0]
+ p.wait()
+ rc = p.returncode
+ except IOError, msg:
+ sys.stderr.write('%s failed: %s\n' % (cmd,msg))
+ return hosts
+ if rc != 0:
+ sys.stderr.write('%s failed: exit code %d\n' % (cmd,rc))
+ return hosts
+ for s in outp.split('\n'):
+ a = s.split()
+ if len(a) != 3:
+ continue
+ hosts.append((a[1], None, None))
+ return hosts
def set_cloexec(filelike):
"""Sets the underlying filedescriptor to automatically close on exec.
@@ -106,3 +134,5 @@ def set_cloexec(filelike):
not require the close_fds option.
"""
fcntl.fcntl(filelike.fileno(), fcntl.FD_CLOEXEC, 1)
+
+# vim:ts=4:sw=4:et:
++++++ pssh_quiet.patch ++++++
commit f0c10276e6bfd3f61648d0a19a5d1d1c194c4080
Author: Dejan Muhamedagic
Date: Mon Aug 8 16:50:04 2011 +0200
add --quiet option
diff --git a/man/man1/pssh.1 b/man/man1/pssh.1
index bb1b4d3..fcc40bd 100644
--- a/man/man1/pssh.1
+++ b/man/man1/pssh.1
@@ -7,7 +7,7 @@ pssh \(em parallel ssh program
.SH SYNOPSIS
.B pssh
-.RB [ \-vAiIP ]
+.RB [ \-vqAiIP ]
.RB [ \-h
.IR hosts_file ]
.RB [ \-H
@@ -31,7 +31,7 @@ pssh \(em parallel ssh program
.I command ...
.B pssh \-I
-.RB [ \-vAiIP ]
+.RB [ \-vqAiIP ]
.RB [ \-h
.IR hosts_file ]
.RB [ \-H
@@ -224,6 +224,15 @@ and
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 --git a/psshlib/cli.py b/psshlib/cli.py
index 1686ba9..e11645a 100644
--- a/psshlib/cli.py
+++ b/psshlib/cli.py
@@ -42,6 +42,8 @@ def common_parser():
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',
@@ -63,6 +65,7 @@ def common_defaults(**kwargs):
('errdir', 'PSSH_ERRDIR'),
('timeout', 'PSSH_TIMEOUT'),
('verbose', 'PSSH_VERBOSE'),
+ ('quiet', 'PSSH_QUIET'),
('print_out', 'PSSH_PRINT'),
('askpass', 'PSSH_ASKPASS'),
('inline', 'PSSH_INLINE'),
diff --git a/psshlib/task.py b/psshlib/task.py
index 28136bf..2fe362a 100644
--- a/psshlib/task.py
+++ b/psshlib/task.py
@@ -56,6 +56,7 @@ class Task(object):
# Set options.
self.verbose = opts.verbose
+ self.quiet = opts.quiet
try:
self.print_out = bool(opts.print_out)
except AttributeError:
@@ -183,7 +184,10 @@ class Task(object):
buf = os.read(fd, BUFFER_SIZE)
if buf:
if self.inline:
- 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:
@@ -259,10 +263,11 @@ class Task(object):
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:
@@ -281,3 +286,4 @@ class Task(object):
except AttributeError:
sys.stdout.write(self.errorbuffer)
+# vim:ts=4:sw=4:et:
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org