Permalink
Browse files

resolved conflicts while merging upstream.

  • Loading branch information...
2 parents 4821258 + 7481fe3 commit aaff5caf13a223c02cd7aaa3e1a0407b5d5cbf94 @agentzh committed Aug 25, 2011
View
@@ -1,3 +1,9 @@
+0.025
+- update variable format check to \w[-\.\w]*
+- added SSH_BATCH_PASSPHRASE for -P and SSH_BATCH_PASSWORD env for -w
+- added passphrase support
+- added some doc for tty option
+
0.024
- tonodes: added rsync archive, update and compress mode. (liseen)
- fornodes: trim expressions when parsing them. (liseen)
View
@@ -8,7 +8,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
-generated_by: 'Module::Install version 1.00'
+generated_by: 'Module::Install version 1.01'
license: bsd
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -30,4 +30,4 @@ requires:
resources:
license: http://opensource.org/licenses/bsd-license.php
repository: http://github.com/agentzh/sshbatch
-version: 0.024
+version: 0.026
View
@@ -8,6 +8,8 @@ author ('Agent Zhang <agentzh@yahoo.cn>');
perl_version ('5.006001');
all_from ('lib/SSH/Batch.pm');
+repository 'http://github.com/agentzh/sshbatch';
+
requires ('Set::Scalar' => '1.23');
requires ('File::HomeDir');
requires ('Net::OpenSSH' => '0.34');
@@ -28,6 +30,5 @@ install_script ('bin/tonodes');
install_script ('bin/key2nodes');
auto_install();
-repository 'http://github.com/agentzh/sshbatch';
WriteAll();
View
12 README
@@ -47,6 +47,12 @@ SYNOPSIS
# or prompt for password if sudo required...
$ atnodes 'sudo apachectl restart' '{ps}' -w
+ # use -P to prompt for passphrase (no echo back)
+ $ atnodes hostname '{ps}' -u agentz -P
+
+ # run sudo command if tty required...
+ $ atnodes -tty 'sudo apachectl restart' '{ps}'
+
# or specify a timeout:
$ atnodes 'ping foo.com' '{ps}' -t 3
@@ -185,9 +191,9 @@ TIPS
sudo: sorry, you must have a tty to run sudo
- then you should probably comment out the "Defaults requiretty" line
- in your server's /etc/sudoers file (or just do this for your own
- account).
+ then you should add option -tty, or you can probably comment out the
+ "Defaults requiretty" line in your server's /etc/sudoers file (best
+ just to do this for your own account).
Passing custom options to the underlying "ssh"
By default, "atnodes" relies on Net::OpenSSH to locate the OpenSSH
View
@@ -19,7 +19,7 @@ if (!@ARGV) {
}
my $list_hosts_only = 0;
-my ($user, $port, $timeout, $verbose, $ask_for_pass);
+my ($user, $port, $timeout, $verbose, $ask_for_pass, $ask_for_passphrase);
my $concurrency = 20;
my (@cmd, @exprs, $ssh_cmd);
$ssh_cmd = $ENV{SSH_BATCH_SSH_CMD};
@@ -57,6 +57,8 @@ for (@ARGV) {
$verbose = 1;
} elsif ($group eq 'w') {
$ask_for_pass = 1;
+ } elsif ($group eq 'P') {
+ $ask_for_passphrase = 1;
} elsif ($group eq 'c') {
$fetch_value = sub { $concurrency = shift };
} elsif ($group eq 'ssh') {
@@ -122,15 +124,32 @@ if ($list_hosts_only) {
exit(0);
}
-my $password;
-if ($ask_for_pass) {
- print STDERR "Password:";
- ReadMode(2);
- while (not defined ($password = ReadLine(0))) {
+my ($passphrase, $password);
+if ($ask_for_passphrase) {
+ $passphrase = $ENV{SSH_BATCH_PASSPHRASE};
+ if (!$passphrase) {
+ print STDERR "Passphrase:";
+ ReadMode(2);
+ while (not defined ($passphrase = ReadLine(0))) {
+ }
+ ReadMode(0);
+ print "\n";
+ chomp $passphrase;
+ }
+ if (!$passphrase) {
+ die "No passphrase specified.\n";
+ }
+} elsif ($ask_for_pass) {
+ $password = $ENV{SSH_BATCH_PASSWORD};
+ if (!$password) {
+ print STDERR "Password:";
+ ReadMode(2);
+ while (not defined ($password = ReadLine(0))) {
+ }
+ ReadMode(0);
+ print "\n";
+ chomp $password;
}
- ReadMode(0);
- print "\n";
- chomp $password;
if (!$password) {
die "No password specified.\n";
}
@@ -151,6 +170,7 @@ while (1) {
defined $timeout ? (timeout => $timeout) : (),
defined $user ? (user => $user) : (),
defined $port ? (port => $port) : (),
+ defined $passphrase ? (passphrase => $passphrase) : (),
defined $password ? (password => $password) : (),
defined $ssh_cmd ? (ssh_cmd => $ssh_cmd) : (),
);
@@ -263,7 +283,8 @@ USAGE:
atnodes [OPTIONS] COMMAND HOST_PATTERN... [OPTIONS]
OPTIONS:
- -c <num> Set SSH concurrency limit. (default: 20, when -tty is on, this setting will no use)
+ -c <num> Set SSH concurrency limit. (default: 20,
+ when -tty is on, this setting will no use)
-h Print this help.
-l List the hosts and do nothing else.
-L Use the line-mode output format, i.e., prefixing
@@ -275,7 +296,10 @@ OPTIONS:
-t <timeout> Specify timeout for net traffic.
-u <user> User account for SSH login.
-v Be verbose.
- -w Prompt for password (used for login and sudo).
+ -w Prompt for password (used for login and sudo,
+ could be privided by SSH_BATCH_PASSWORD).
+ -P Prompt for passphrase (used for login,
+ could be privided by SSH_BATCH_PASSPHRASE).
-tty Pseudo-tty.
_EOC_
if ($exit_code == 0) {
@@ -312,6 +336,12 @@ atnodes - Run commands on clusters
# or prompt for password if sudo required...
$ atnodes 'sudo apachectl restart' '{ps}' -w
+ # use -P to prompt for passphrase (no echo back)
+ $ atnodes hostname '{ps}' -u agentz -P
+
+ # run sudo command if tty required...
+ $ atnodes -tty 'sudo apachectl restart' '{ps}'
+
# or specify a timeout:
$ atnodes 'ping foo.com' '{ps}' -t 3
@@ -322,7 +352,8 @@ atnodes - Run commands on clusters
=head1 OPTIONS
- -c <num> Set SSH concurrency limit. (default: 20, when -tty is on, this setting will no use)
+ -c <num> Set SSH concurrency limit. (default: 20,
+ when -tty is on, this setting will no use)
-h Print this help.
-l List the hosts and do nothing else.
-L Use the line-mode output format, i.e., prefixing
@@ -334,8 +365,11 @@ atnodes - Run commands on clusters
-t <timeout> Specify timeout for net traffic.
-u <user> User account for SSH login.
-v Be verbose.
- -w Prompt for password (used for login and sudo).
- -tty Use pseudo-tty.
+ -w Prompt for password (used for login and sudo,
+ could be privided by SSH_BATCH_PASSWORD).
+ -P Prompt for passphrase (used for login,
+ could be privided by SSH_BATCH_PASSPHRASE).
+ -tty Pseudo-tty.
=head1 PREREQUISITES
View
@@ -18,7 +18,7 @@ if (!@ARGV) {
}
my $list_hosts_only = 0;
-my ($user, $port, $timeout, $verbose, $ask_for_pass, $recursive, $use_glob);
+my ($user, $port, $timeout, $verbose, $ask_for_pass, $ask_for_passphrase, $recursive, $use_glob);
my ($bwlimit, $use_rsync);
my $concurrency = 20;
my (@files, @exprs);
@@ -59,6 +59,8 @@ for (@ARGV) {
$verbose = 1;
} elsif ($group eq 'w') {
$ask_for_pass = 1;
+ } elsif ($group eq 'P') {
+ $ask_for_passphrase = 1;
} elsif ($group eq 'r') {
$recursive = 1;
} elsif ($group eq 'g') {
@@ -175,16 +177,32 @@ if ($verbose) {
if ($list_hosts_only) {
exit(0);
}
-
-my $password;
-if ($ask_for_pass) {
- print STDERR "Password:";
- ReadMode(2);
- while (not defined ($password = ReadLine(0))) {
+my ($passphrase, $password);
+if ($ask_for_passphrase) {
+ $passphrase = $ENV{SSH_BATCH_PASSPHRASE};
+ if (!$passphrase) {
+ print STDERR "Passphrase:";
+ ReadMode(2);
+ while (not defined ($passphrase = ReadLine(0))) {
+ }
+ ReadMode(0);
+ print "\n";
+ chomp $passphrase;
+ }
+ if (!$passphrase) {
+ die "No passphrase specified.\n";
+ }
+} elsif ($ask_for_pass) {
+ $password = $ENV{SSH_BATCH_PASSWORD};
+ if (!$password) {
+ print STDERR "Password:";
+ ReadMode(2);
+ while (not defined ($password = ReadLine(0))) {
+ }
+ ReadMode(0);
+ print "\n";
+ chomp $password;
}
- ReadMode(0);
- print "\n";
- chomp $password;
if (!$password) {
die "No password specified.\n";
}
@@ -206,6 +224,7 @@ while (1) {
defined $timeout ? (timeout => $timeout) : (),
defined $user ? (user => $user) : (),
defined $port ? (port => $port) : (),
+ defined $passphrase ? (passphrase => $passphrase) : (),
defined $password ? (password => $password) : (),
);
if ($ssh->error) {
@@ -341,7 +360,10 @@ OPTIONS:
-t <timeout> Specify timeout for net traffic.
-u <user> User account for SSH login.
-v Be verbose.
- -w Prompt for password (used mostly for login and sudo).
+ -w Prompt for password (used mostly for login and sudo,
+ could be privided by SSH_BATCH_PASSWORD).
+ -P Prompt for passphrase (used mostly for login,
+ could be privided by SSH_BATCH_PASSPHRASE).
_EOC_
if ($exit_code == 0) {
print $msg;
@@ -381,7 +403,7 @@ tonodes - Upload local files/directories to remote clusters
=head1 OPTIONS
-c <num> Set SSH concurrency limit. (default: 20)
- -b bandwidth limit, specified in Kbits/sec.
+ -b <num> bandwidth limit in Kbits/sec.
-g Use glob to process the input files/directories.
-h Print this help.
-l List the hosts and do nothing else.
@@ -390,15 +412,17 @@ tonodes - Upload local files/directories to remote clusters
(could be controlled by the env SSH_BATCH_LINE_MODE)
-p <port> Port for the remote SSH service.
-r Recurse into directories too.
- -t <timeout> Specify timeout for net traffic.
- -u <user> User account for SSH login.
- -v Be verbose.
- -w Prompt for password (used mostly for login and sudo).
-
-rsync Use "rsync" to transfer files.
-archive Enable rsync archive mode
-update Enable rsync update
-compress Enable rsync compress
+ -t <timeout> Specify timeout for net traffic.
+ -u <user> User account for SSH login.
+ -v Be verbose.
+ -w Prompt for password (used mostly for login and sudo,
+ could be privided by SSH_BATCH_PASSWORD).
+ -P Prompt for passphrase (used mostly for login,
+ could be privided by SSH_BATCH_PASSPHRASE).
=head1 DESCRIPTION
View
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.00';
+ $VERSION = '1.01';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -467,4 +467,4 @@ sub _CLASS ($) {
1;
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2011 Adam Kennedy.
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
}
# Suspend handler for "redefined" warnings
@@ -9,7 +9,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
Oops, something went wrong.

0 comments on commit aaff5ca

Please sign in to comment.