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

@ -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} ) {