Skip to content
Browse files

added SSH_BATCH_PASSPHRASE for -P and SSH_BATCH_PASSWORD env for -w

  • Loading branch information...
1 parent c5f26ac commit 6ccf4de82a5994c6b6148af1af4e2373487a276b @liseen liseen committed
Showing with 75 additions and 50 deletions.
  1. +31 −19 bin/atnodes
  2. +30 −22 bin/tonodes
  3. +6 −4 t/atnodes.t
  4. +8 −5 t/tonodes.t
View
50 bin/atnodes
@@ -126,24 +126,30 @@ if ($list_hosts_only) {
my ($passphrase, $password);
if ($ask_for_passphrase) {
- print STDERR "Passphrase:";
- ReadMode(2);
- while (not defined ($passphrase = ReadLine(0))) {
+ $passphrase = $ENV{SSH_BATCH_PASSPHRASE};
+ if (!$passphrase) {
+ print STDERR "Passphrase:";
+ ReadMode(2);
+ while (not defined ($passphrase = ReadLine(0))) {
+ }
+ ReadMode(0);
+ print "\n";
+ chomp $passphrase;
}
- ReadMode(0);
- print "\n";
- chomp $passphrase;
if (!$passphrase) {
die "No passphrase specified.\n";
}
} elsif ($ask_for_pass) {
- print STDERR "Password:";
- ReadMode(2);
- while (not defined ($password = ReadLine(0))) {
+ $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";
}
@@ -277,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
@@ -289,8 +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).
- -P Prompt for passphrase (used for login).
+ -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) {
@@ -343,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
@@ -355,9 +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).
- -P Prompt for passphrase (used for login).
- -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
52 bin/tonodes
@@ -177,27 +177,32 @@ if ($verbose) {
if ($list_hosts_only) {
exit(0);
}
-
my ($passphrase, $password);
if ($ask_for_passphrase) {
- print STDERR "Passphrase:";
- ReadMode(2);
- while (not defined ($passphrase = ReadLine(0))) {
+ $passphrase = $ENV{SSH_BATCH_PASSPHRASE};
+ if (!$passphrase) {
+ print STDERR "Passphrase:";
+ ReadMode(2);
+ while (not defined ($passphrase = ReadLine(0))) {
+ }
+ ReadMode(0);
+ print "\n";
+ chomp $passphrase;
}
- ReadMode(0);
- print "\n";
- chomp $passphrase;
if (!$passphrase) {
die "No passphrase specified.\n";
}
} elsif ($ask_for_pass) {
- print STDERR "Password:";
- ReadMode(2);
- while (not defined ($password = ReadLine(0))) {
+ $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";
}
@@ -355,8 +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).
- -P Prompt for passphrase (used mostly for login).
+ -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;
@@ -396,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.
@@ -405,16 +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).
- -P Prompt for passphrase (used mostly for login).
-
-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
10 t/atnodes.t
@@ -41,7 +41,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
@@ -53,10 +54,11 @@ 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).
- -P Prompt for passphrase (used for login).
+ -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.
-
--- status: 1
View
13 t/tonodes.t
@@ -62,9 +62,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).
- -P Prompt for passphrase (used mostly for login).
-
+ -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).
--- status: 1
@@ -168,8 +169,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).
- -P Prompt for passphrase (used mostly for login).
+ -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).
--- err
--- status: 0

0 comments on commit 6ccf4de

Please sign in to comment.
Something went wrong with that request. Please try again.