mirror of
https://github.com/duncs/clusterssh.git
synced 2025-04-21 09:09:06 +00:00
Fix behaviour when no cluster command defined
Also tidyup output to 'cssh -L' when no external clusters defined
This commit is contained in:
parent
b374754129
commit
f88353d3dd
6 changed files with 35 additions and 9 deletions
3
Changes
3
Changes
|
@ -1,3 +1,6 @@
|
|||
4.03_02 2014-08-10 Duncan Ferguson <duncan_ferguson@user.sf.net>
|
||||
- Fix behaviour when external cluster command is not defined or doesn't exist
|
||||
|
||||
4.03_01 2014-07-09 Duncan Ferguson <duncan_ferguson@user.sf.net>
|
||||
- Amended host parsing to include alternative IPv6 address port definitions, e.g. 1::2::3::4/5567
|
||||
- List available external tags with -L option and also add into 'Add Host' in UI
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"provides" : {
|
||||
"App::ClusterSSH" : {
|
||||
"file" : "lib/App/ClusterSSH.pm",
|
||||
"version" : "4.03_01"
|
||||
"version" : "4.03_02"
|
||||
},
|
||||
"App::ClusterSSH::Base" : {
|
||||
"file" : "lib/App/ClusterSSH/Base.pm",
|
||||
|
@ -94,5 +94,5 @@
|
|||
"http://github.com/duncs/clusterssh"
|
||||
]
|
||||
},
|
||||
"version" : "4.03_01"
|
||||
"version" : "4.03_02"
|
||||
}
|
||||
|
|
4
META.yml
4
META.yml
|
@ -25,7 +25,7 @@ name: App-ClusterSSH
|
|||
provides:
|
||||
App::ClusterSSH:
|
||||
file: lib/App/ClusterSSH.pm
|
||||
version: 4.03_01
|
||||
version: 4.03_02
|
||||
App::ClusterSSH::Base:
|
||||
file: lib/App/ClusterSSH/Base.pm
|
||||
version: 0.02
|
||||
|
@ -62,4 +62,4 @@ resources:
|
|||
bugtracker: http://sourceforge.net/tracker/?group_id=89139
|
||||
homepage: http://clusterssh.sourceforge.net/
|
||||
license: http://dev.perl.org/licenses/
|
||||
version: 4.03_01
|
||||
version: 4.03_02
|
||||
|
|
|
@ -3,7 +3,7 @@ package App::ClusterSSH;
|
|||
use 5.008.004;
|
||||
use warnings;
|
||||
use strict;
|
||||
use version; our $VERSION = version->new('4.03_01');
|
||||
use version; our $VERSION = version->new('4.03_02');
|
||||
|
||||
use Carp;
|
||||
|
||||
|
@ -1945,8 +1945,11 @@ sub run {
|
|||
print( 'Available cluster tags:', $/ );
|
||||
print "\t", $_, $/ foreach ( sort( $self->cluster->list_tags ) );
|
||||
|
||||
print( 'Available external command tags:', $/ );
|
||||
print "\t", $_, $/ foreach ( sort( $self->cluster->list_external_clusters ) );
|
||||
my @external_clusters = $self->cluster->list_external_clusters;
|
||||
if(@external_clusters) {
|
||||
print( 'Available external command tags:', $/ );
|
||||
print "\t", $_, $/ foreach ( sort( @external_clusters ) );
|
||||
}
|
||||
|
||||
$self->debug(
|
||||
4,
|
||||
|
|
|
@ -69,6 +69,11 @@ sub _run_external_clusters {
|
|||
|
||||
my $external_command = $self->parent->config->{external_cluster_command};
|
||||
|
||||
if(!$external_command || ! -x $external_command) {
|
||||
$self->debug( 1, 'Cannot run external cluster command: ', $external_command || '');
|
||||
return;
|
||||
}
|
||||
|
||||
$self->debug( 3, 'Running tags through external command' );
|
||||
$self->debug( 4, 'External command: ', $external_command );
|
||||
$self->debug( 3, 'Args ', join( ',', @args ) );
|
||||
|
|
|
@ -109,8 +109,7 @@ $expected{tag20} = [ 'host10', ];
|
|||
$expected{tag30} = [ 'host10', ];
|
||||
$expected{tag40} = [ 'host20', 'host30', ];
|
||||
$expected{tag50} = [ 'host30', ];
|
||||
$cluster1->read_tag_file( $Bin . '/30cluster.tag1' );
|
||||
test_expected( 'tag 1', %expected );
|
||||
$cluster1->read_tag_file( $Bin . '/30cluster.tag1' ); test_expected( 'tag 1', %expected );
|
||||
|
||||
$cluster1->read_cluster_file( $Bin . '/30cluster.file3' );
|
||||
my @default_expected = (qw/ host7 host8 host9 /);
|
||||
|
@ -155,6 +154,22 @@ is_deeply( $count, 10, 'tag list count correct' );
|
|||
# now checks against running an external command
|
||||
|
||||
my @external_expected;
|
||||
|
||||
# text fetching external clusters when no command set or runnable
|
||||
#$mock_object->{external_cluster_command} = '/tmp/doesnt_exist';
|
||||
trap {
|
||||
@external_expected = $cluster1->_run_external_clusters();
|
||||
};
|
||||
is( $trap->leaveby, 'return', 'non-existant tag returns correctly' );
|
||||
is( $trap->stdout, '', 'no stdout for non-existant get_tag' );
|
||||
is( $trap->stderr, '', 'no stderr for non-existant get_tag' );
|
||||
is( $tags, undef, 'non-existant tag returns undef' );
|
||||
@external_expected = $cluster1->list_external_clusters();
|
||||
is_deeply( \@external_expected, [],
|
||||
'External command doesnt exist'
|
||||
);
|
||||
is( scalar $cluster1->list_external_clusters, 0, 'External command failed tag count');
|
||||
|
||||
$mock_object->{external_cluster_command} = "$Bin/external_cluster_command";
|
||||
|
||||
@external_expected = $cluster1->list_external_clusters();
|
||||
|
|
Loading…
Add table
Reference in a new issue