Allow the path to the comms binary to be set

This allows for users to specify using an alternative binary for rsh/ssh/telnet, no matter what $PATH is set to, otherwise will just use the first binary found on $PATH
This commit is contained in:
Duncan Ferguson 2013-02-13 21:41:30 +00:00
parent 9695b3a4f0
commit 7755a60161
5 changed files with 49 additions and 10 deletions

View file

@ -2,6 +2,7 @@
* Correct documentation for references to $HOME/.clusterssh/config
* Re-add user back into the configurartion file
* Add in missing newline for some error messages
* Allow the path to rsh/ssh/telnet to be defined in the configuration file
2012-12-09 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.01_02
* Fix logic when using 'autoclose' on the command line or config file

View file

@ -472,10 +472,21 @@ program start
Default key sequence to paste text into the console window using the mouse.
See below notes on shortcuts.
=item rsh = rsh
=item ssh = ssh
=item telnet = telnet
Set the path to the specific binary to use for the communication method, else
uses the first match found in $PATH
=item rsh_args = <blank>
=item ssh_args = "-x -o ConnectTimeout=10"
=item telnet_args = <blank>
Sets any arguments to be used with the communication method (defaults to ssh
arguments).

View file

@ -16,7 +16,7 @@ use App::ClusterSSH::Cluster;
my $clusters;
my %old_clusters;
my @app_specific = (qw/ command title comms method ssh rsh telnet ccon /);
my @app_specific = (qw/ command title comms method /);
my %default_config = (
terminal => "xterm",
terminal_args => "",
@ -54,8 +54,11 @@ my %default_config = (
terminal_decoration_height => 10,
terminal_decoration_width => 8,
rsh => 'rsh',
rsh_args => "",
telnet => 'telnet',
telnet_args => "",
ssh => 'ssh',
ssh_args => "",
extra_cluster_file => "",
@ -98,12 +101,6 @@ sub new {
$self->{comms} = $comms;
}
if ( $self->{comms}
&& ( !$self->{ $self->{comms} } || !-e $self->{ $self->{comms} } ) )
{
$self->{ $self->{comms} } = $self->find_binary( $self->{comms} );
}
$self->{terminal} = $self->find_binary( $self->{terminal} );
$self->{title} = uc($Script);
@ -133,6 +130,7 @@ sub validate_args {
}
}
if (@unknown_config) {
croak(
App::ClusterSSH::Exception::Config->throw(
@ -145,6 +143,29 @@ sub validate_args {
);
}
if ( ! $self->{comms} ) {
croak(
App::ClusterSSH::Exception::Config->throw(
error => $self->loc( 'Invalid variable: comms'.$/),
),
);
}
if ( !$self->{ $self->{comms} } ) {
croak(
App::ClusterSSH::Exception::Config->throw(
error => $self->loc( 'Invalid variable: [_1]'.$/, $self->{comms}),
),
);
}
# # Don't search for the path to the binary - assume it is on the path
# # or defined correctly in the config.
# if( !-e $self->{ $self->{comms} } )
# {
# $self->{ $self->{comms} } = $self->find_binary( $self->{comms} );
# }
return $self;
}
@ -189,7 +210,7 @@ sub parse_config_file {
}
close(CFG);
# grab any c'lusters from the config before validating it
# grab any clusters from the config before validating it
if ( $read_config{clusters} ) {
$self->debug( 3, "Picked up clusters defined in $config_file" );
foreach my $cluster ( sort split / /, $read_config{clusters} ) {

View file

@ -22,8 +22,8 @@ sub new {
sub script {
my ($self, $config ) = @_;
my $comms = $config->{comms};
my $comms_args = $config->{$comms.'_args'};
my $comms = $config->{ $config->{comms} };
my $comms_args = $config->{ $config->{comms} . '_args'};
my $command = $config->{command};
my $autoclose = $config->{auto_close};

View file

@ -60,8 +60,11 @@ Readonly::Hash my %default_config => {
ssh => '/usr/bin/ssh',
rsh => 'rsh',
rsh_args => "",
telnet => 'telnet',
telnet_args => "",
ssh => 'ssh',
ssh_args => "",
extra_cluster_file => "",
@ -483,6 +486,7 @@ max_host_menu_items=30
menu_host_autotearoff=0
menu_send_autotearoff=0
mouse_paste=Button-2
rsh=rsh
rsh_args=
screen_reserve_bottom=60
screen_reserve_left=0
@ -490,7 +494,9 @@ screen_reserve_right=0
screen_reserve_top=0
send_menu_xml_file=} . $ENV{HOME} . qq{/.csshrc_send_menu
show_history=0
ssh=ssh
ssh_args=
telnet=telnet
telnet_args=
terminal=/usr/bin/xterm
terminal_allow_send_events=-xrm '*.VT100.allowSendEvents:true'