From 521b1fd37c4393d9640e02e5529ada7d24729316 Mon Sep 17 00:00:00 2001 From: Duncan Ferguson Date: Mon, 26 Nov 2012 21:41:05 +0000 Subject: [PATCH] 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. --- Changes | 1 + lib/App/ClusterSSH/Config.pm | 11 ++++++++--- lib/App/ClusterSSH/Helper.pm | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 1335111..581fa2f 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ ????-??-?? Duncan Ferguson - 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 - v4.01_01 * Include missing files from release tarballs diff --git a/lib/App/ClusterSSH/Config.pm b/lib/App/ClusterSSH/Config.pm index dbe7c42..6a57c7c 100644 --- a/lib/App/ClusterSSH/Config.pm +++ b/lib/App/ClusterSSH/Config.pm @@ -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} } ) ) diff --git a/lib/App/ClusterSSH/Helper.pm b/lib/App/ClusterSSH/Helper.pm index 39e272a..6921cbf 100644 --- a/lib/App/ClusterSSH/Helper.pm +++ b/lib/App/ClusterSSH/Helper.pm @@ -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