clusterssh/t/external_cluster_command
Duncan Ferguson d7e116e470 Functionality to call external command
Code and tests to call the external command
2013-04-15 21:34:05 +01:00

45 lines
815 B
Perl
Executable file

#!/usr/bin/perl
#
# test script for proving external command for fetching tags works
#
use strict;
use warnings;
use Getopt::Std;
my $opt = {};
getopts('qx', $opt);
# if we get '-q' option, force an error
if($opt->{q}) {
my $fail;
$fail->cause_death();
}
# if we get '-x' option, die with non-0 return code
if($opt->{x}) {
warn 'Forced non-0 exit',$/;
exit 5;
}
my %tag_lookup = (
tag100 => [ qw/ host100 / ],
tag200 => [ qw/ host200 host210 host205 / ],
tag300 => [ qw/ host300 host350 host325 /],
tag400 => [ qw/ tag100 tag200 tag300 host400 host401 / ],
);
my @lookup=@ARGV;
for (@lookup) {
if($tag_lookup{$_}) {
push(@lookup, @{ $tag_lookup{$_} });
$_= '';
}
}
@lookup = grep { $_ !~ m/^$/ } sort @lookup;
if(@lookup) {
print "@lookup",$/;
}