Fix 'ctel', 'crsh' and 'ccon'

The code wasn't taking into account being called under another name correctly, so wasn't calling the correct comms method.
This commit is contained in:
Duncan Ferguson 2012-11-26 21:41:05 +00:00
parent 6eb3cdc2e4
commit 521b1fd37c
3 changed files with 14 additions and 5 deletions

View file

@ -1,6 +1,7 @@
????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.01_02
* Fix logic when using 'autoclose' on the command line or config file
* Fix $HOME/.clusterssh/clusters being read in
* Fix 'ctel', 'crsh' and 'ccon'so they work as expected
2011-12-09 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.01_01
* Include missing files from release tarballs

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use version;
our $VERSION = version->new('0.01');
our $VERSION = version->new('0.02');
use Carp;
use Try::Tiny;
@ -84,12 +84,17 @@ sub new {
my $self = $class->SUPER::new(%default_config);
( my $comms = $Script ) =~ s/^c//;
$self->{comms} = $comms;
$comms = 'telnet' if ( $comms eq 'tel' );
$comms = 'console' if ( $comms eq 'con' );
# list of allowed comms methods
if ( 'ssh rsh telnet console' !~ m/\B$comms\B/ ) {
if ( 'ssh rsh telnet console' !~ m/\b$comms\b/ ) {
$self->{comms} = 'ssh';
}
else {
$self->{comms} = $comms;
}
if ( $self->{comms}
&& ( !$self->{ $self->{comms} } || !-e $self->{ $self->{comms} } ) )

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use version;
our $VERSION = version->new('0.01');
our $VERSION = version->new('0.02');
use Carp;
use Try::Tiny;
@ -119,7 +119,10 @@ sub script {
\$command .= "\$svr";
}
}
\$command .= " \\\"$command\\\" ; $postcommand";
if("$command") {
\$command .= " \\\"$command\\\"";
}
\$command .= " ; $postcommand";
warn("Running:\$command\\n"); # for debug purposes
exec(\$command);
HERE