Add in 'ccon' command

Thanks for Brandon Perkins for the patch
This commit is contained in:
Duncan Ferguson 2011-06-30 11:12:59 +01:00
parent e58a20de24
commit f04b4040ae
10 changed files with 65 additions and 10 deletions

View file

@ -1,5 +1,7 @@
????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.00_09 ????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.00_09
* Cater for missing 'pod2text' command (Thanks to Sami Kerola) * Cater for missing 'pod2text' command (Thanks to Sami Kerola)
* Fix 'uninitialised variable' error
* Added 'ccon' command (Thanks to Brandon Perkins)
2011-04-01 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.00_08 2011-04-01 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.00_08
* Amend all L<xx> links to prevent build breakage on cygwin (Sf bug 3115635) * Amend all L<xx> links to prevent build breakage on cygwin (Sf bug 3115635)

View file

@ -1,4 +1,5 @@
AUTHORS AUTHORS
bin/ccon
bin/crsh bin/crsh
bin/cscp bin/cscp
bin/cssh bin/cssh

View file

@ -17,7 +17,7 @@ name: App-ClusterSSH
provides: provides:
App::ClusterSSH: App::ClusterSSH:
file: lib/App/ClusterSSH.pm file: lib/App/ClusterSSH.pm
version: 4.00_07 version: 4.00_09
App::ClusterSSH::Base: App::ClusterSSH::Base:
file: lib/App/ClusterSSH/Base.pm file: lib/App/ClusterSSH/Base.pm
version: 0.02 version: 0.02
@ -40,4 +40,4 @@ resources:
repository: repository:
- http://clusterssh.git.sourceforge.net/ - http://clusterssh.git.sourceforge.net/
- http://github.com/duncs/clusterssh - http://github.com/duncs/clusterssh
version: 4.00_07 version: 4.00_09

View file

@ -15,6 +15,7 @@ WriteMakefile
}, },
'INSTALLDIRS' => 'site', 'INSTALLDIRS' => 'site',
'EXE_FILES' => [ 'EXE_FILES' => [
'bin/ccon',
'bin/crsh', 'bin/crsh',
'bin/cscp', 'bin/cscp',
'bin/cssh', 'bin/cssh',

1
THANKS
View file

@ -39,3 +39,4 @@ Markus Manzke
Simon Fraser Simon Fraser
Stefan Steiner Stefan Steiner
Ryan Brown Ryan Brown
Brandon Perkins

2
TODO
View file

@ -26,7 +26,7 @@ Idea from Markus Manzke
Change way commands generated Change way commands generated
============================= =============================
Each scrpt file (cssh, crsh, ctelnet, cscp, crsync) should define how Each script file (cssh, crsh, ctel, ccon, cscp, crsync) should define how
the command is created/used and also none-common options the command is created/used and also none-common options
# Something like the following (needs refinement): # Something like the following (needs refinement):

1
bin/ccon Symbolic link
View file

@ -0,0 +1 @@
cssh

View file

@ -15,13 +15,14 @@ __END__
=head1 NAME =head1 NAME
cssh, crsh, ctel - Cluster administration tool cssh, crsh, ctel, ccon - Cluster administration tool
=head1 SYNOPSIS =head1 SYNOPSIS
S<< cssh [options] [[user@]<server>[:port]|<tag>] [...] >> S<< cssh [options] [[user@]<server>[:port]|<tag>] [...] >>
S<< crsh [options] [[user@]<server>[:port]|<tag>] [...] >> S<< crsh [options] [[user@]<server>[:port]|<tag>] [...] >>
S<< ctel [options] [<server>[:port]|<tag>] [...] >> S<< ctel [options] [<server>[:port]|<tag>] [...] >>
S<< ccon [options] [[user@]<server>[:port]|<tag>] [...] >>
=head1 DESCRIPTION =head1 DESCRIPTION
@ -37,7 +38,7 @@ nodes are kept in sync.
Connections are opened via ssh so a correctly installed and configured Connections are opened via ssh so a correctly installed and configured
ssh installation is required. If, however, the program is called by "crsh" ssh installation is required. If, however, the program is called by "crsh"
then the rsh protocol is used (and the communications channel is insecure), then the rsh protocol is used (and the communications channel is insecure),
or by "ctel" then telnet is used. or by "ctel" then telnet is used, or by "ccon" then console is used.
Extra caution should be taken when editing system files such as Extra caution should be taken when editing system files such as
/etc/inet/hosts as lines may not necessarily be in the same order. Assuming /etc/inet/hosts as lines may not necessarily be in the same order. Assuming
@ -86,6 +87,12 @@ communications protocol instead of ssh.
=item * =item *
If the code is called as ccon instead of cssh (i.e. a symlink called
ccon points to the cssh file or the file is renamed) console is used as the
communications protocol instead of ssh.
=item *
When using cssh on a large number of systems to connect back to a single When using cssh on a large number of systems to connect back to a single
system (e.g. you issue a command to the cluster to scp a file from a given system (e.g. you issue a command to the cluster to scp a file from a given
location) and when these connections require authentication (i.e. you are location) and when these connections require authentication (i.e. you are
@ -123,7 +130,7 @@ Default options are shown as appropriate.
Run the command in each session, i.e. C<-a 'vi /etc/hosts'> to drop straight Run the command in each session, i.e. C<-a 'vi /etc/hosts'> to drop straight
into a vi session. NOTE: not all communications methods support this (ssh into a vi session. NOTE: not all communications methods support this (ssh
and rsh should, telnet will not). and rsh should, telnet and console will not).
=item --autoquit,-q|--no-autoquit,-Q =item --autoquit,-q|--no-autoquit,-Q
@ -172,6 +179,11 @@ List available cluster tags.
Show full help test (the man page), and exit Show full help test (the man page), and exit
=item --master,-M <master>
The console client program polls master as the primary server, rather than the
default set at compile time (typically ``console'').
=item --options,-o "-x -o ConnectTimeout=10" - for ssh connections =item --options,-o "-x -o ConnectTimeout=10" - for ssh connections
=item --options,-o "" - for rsh connections =item --options,-o "" - for rsh connections
@ -309,6 +321,10 @@ S<$ ctel -p 2022 server1 server2>
S<$ crsh server1 server2> S<$ crsh server1 server2>
=item Use console with master as the primary server instead of ssh
S<$ ccon -M master server1 server2>
=back =back
=head1 FILES =head1 FILES

View file

@ -79,6 +79,7 @@ my @options_spec = (
'tile|g', 'tile|g',
'no-tile|G', 'no-tile|G',
'username|l=s', 'username|l=s',
'master|M=s',
'options|o=s', 'options|o=s',
'port|p=i', 'port|p=i',
'autoquit|q', 'autoquit|q',
@ -227,6 +228,8 @@ sub load_config_defaults() {
$config{comms} = "telnet" if ( $config{comms} eq "tel" ); $config{comms} = "telnet" if ( $config{comms} eq "tel" );
$config{comms} = "console" if ( $config{comms} eq "con" );
$config{ $config{comms} } = $config{comms}; $config{ $config{comms} } = $config{comms};
$config{ssh_args} = " -x -o ConnectTimeout=10" $config{ssh_args} = " -x -o ConnectTimeout=10"
@ -235,6 +238,8 @@ sub load_config_defaults() {
$config{telnet_args} = ""; $config{telnet_args} = "";
$config{console_args} = "";
$config{extra_cluster_file} = ""; $config{extra_cluster_file} = "";
$config{unmap_on_redraw} = "no"; # Debian #329440 $config{unmap_on_redraw} = "no"; # Debian #329440
@ -349,8 +354,8 @@ sub check_config() {
# make sure comms in an accepted value # make sure comms in an accepted value
die die
"FATAL: Only ssh, rsh and telnet protocols are currently supported (comms=$config{comms})\n" "FATAL: Only ssh, rsh, telnet, and console/conserver protocols are currently supported (comms=$config{comms})\n"
if ( $config{comms} !~ /^(:?[rs]sh|telnet)$/ ); if ( $config{comms} !~ /^(:?[rs]sh|telnet|console)$/ );
# Set any extra config options given on command line # Set any extra config options given on command line
$config{title} = $options{title} if ( $options{title} ); $config{title} = $options{title} if ( $options{title} );
@ -374,6 +379,9 @@ sub check_config() {
$config{window_tiling} = "no" if $options{'no-tile'}; $config{window_tiling} = "no" if $options{'no-tile'};
$config{user} = $options{username} if ( $options{username} ); $config{user} = $options{username} if ( $options{username} );
$config{mstr} = $options{master} if ( $options{master} );
$config{terminal_args} = $options{'term-args'} $config{terminal_args} = $options{'term-args'}
if ( $options{'term-args'} ); if ( $options{'term-args'} );
@ -926,6 +934,7 @@ sub setup_helper_script() {
my \$svr=shift; my \$svr=shift;
my \$user=shift; my \$user=shift;
my \$port=shift; my \$port=shift;
my \$mstr=shift;
my \$command="$config{$config{comms}} $config{$config{comms}."_args"} "; my \$command="$config{$config{comms}} $config{$config{comms}."_args"} ";
open(PIPE, ">", \$pipe) or die("Failed to open pipe: \$!\\n"); open(PIPE, ">", \$pipe) or die("Failed to open pipe: \$!\\n");
print PIPE "\$\$:\$ENV{WINDOWID}" print PIPE "\$\$:\$ENV{WINDOWID}"
@ -938,6 +947,12 @@ sub setup_helper_script() {
); );
sleep 5; sleep 5;
} }
if(\$mstr) {
unless("$config{comms}" ne "console") {
\$mstr = \$mstr ? "-M \$mstr " : "";
\$command .= \$mstr;
}
}
if(\$user) { if(\$user) {
unless("$config{comms}" eq "telnet") { unless("$config{comms}" eq "telnet") {
\$user = \$user ? "-l \$user " : ""; \$user = \$user ? "-l \$user " : "";
@ -1040,6 +1055,7 @@ sub open_client_windows(@) {
my $username = $server_object->get_username(); my $username = $server_object->get_username();
my $port = $server_object->get_port(); my $port = $server_object->get_port();
my $server = $server_object->get_hostname(); my $server = $server_object->get_hostname();
my $master = $server_object->get_master();
#my ( $username, $server, $port ) = split_hostname($_); #my ( $username, $server, $port ) = split_hostname($_);
my $given_server_name = $server_object->get_givenname(); my $given_server_name = $server_object->get_givenname();
@ -1083,6 +1099,8 @@ sub open_client_windows(@) {
$servers{$server}{username} = $username if ($username); $servers{$server}{username} = $username if ($username);
$servers{$server}{username} = $username || ''; $servers{$server}{username} = $username || '';
$servers{$server}{port} = $port || ''; $servers{$server}{port} = $port || '';
$servers{$server}{master} = $config{mstr};
$servers{$server}{master} = $master if ($master);
logmsg( 2, "Working on server $server for $_" ); logmsg( 2, "Working on server $server for $_" );
@ -1106,7 +1124,7 @@ sub open_client_windows(@) {
# affecting the main program # affecting the main program
$servers{$server}{realname} .= "==" if ( !$realname ); $servers{$server}{realname} .= "==" if ( !$realname );
my $exec my $exec
= "$config{terminal} $color $config{terminal_args} $config{terminal_allow_send_events} $config{terminal_title_opt} '$config{title}: $servers{$server}{connect_string}' -font $config{terminal_font} -e \"$^X\" \"-e\" '$helper_script' '$servers{$server}{pipenm}' '$servers{$server}{givenname}' '$servers{$server}{username}' '$servers{$server}{port}'"; = "$config{terminal} $color $config{terminal_args} $config{terminal_allow_send_events} $config{terminal_title_opt} '$config{title}: $servers{$server}{connect_string}' -font $config{terminal_font} -e \"$^X\" \"-e\" '$helper_script' '$servers{$server}{pipenm}' '$servers{$server}{givenname}' '$servers{$server}{username}' '$servers{$server}{port}' '$servers{$server}{master}'";
logmsg( 2, "Terminal exec line:\n$exec\n" ); logmsg( 2, "Terminal exec line:\n$exec\n" );
exec($exec) == 0 or warn("Failed: $!"); exec($exec) == 0 or warn("Failed: $!");
} }
@ -2263,7 +2281,7 @@ App::ClusterSSH - A container for functions of the ClusterSSH programs
=head1 SYNOPSIS =head1 SYNOPSIS
There is nothing in this module for public consumption. See documentation There is nothing in this module for public consumption. See documentation
for F<cssh>, F<crsh>, F<ctelnet>, or F<cscp> instead. for F<cssh>, F<crsh>, F<ctel>, F<ccon>, or F<cscp> instead.
=head1 DESCRIPTION =head1 DESCRIPTION

View file

@ -83,6 +83,17 @@ sub set_port {
return $self; return $self;
} }
sub get_master {
my ($self) = @_;
return $self->{master} || q{};
}
sub set_master {
my ( $self, $new_master ) = @_;
$self->{master} = $new_master;
return $self;
}
sub get_realname { sub get_realname {
my ($self) = @_; my ($self) = @_;
@ -277,12 +288,16 @@ Create a new host object. 'hostname' is a required arg, 'username' and
=item $host->get_port =item $host->get_port
=item $host->get_master
Return specific details about the host Return specific details about the host
=item $host->set_username =item $host->set_username
=item $host->set_port =item $host->set_port
=item $host->set_master
Set specific details about the host after its been created. Set specific details about the host after its been created.
=item get_realname =item get_realname