mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 01:43:25 +00:00
Improve test coverage
This commit is contained in:
parent
0853d8fee6
commit
3e2392e9b6
9 changed files with 280 additions and 119 deletions
|
@ -22,6 +22,25 @@ sub new {
|
|||
sub script {
|
||||
my ( $self, $config ) = @_;
|
||||
|
||||
if(! defined $config || ref $config ne "HASH") {
|
||||
croak(
|
||||
App::ClusterSSH::Exception::Helper->throw(
|
||||
error => 'No configuration provided or in wrong format',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
foreach my $arg ( "comms", $config->{comms}, $config->{comms} . '_args', 'command', 'auto_close'
|
||||
) {
|
||||
if( !defined $config->{ $arg } ) {
|
||||
croak(
|
||||
App::ClusterSSH::Exception::Helper->throw(
|
||||
error => "Config '$arg' not provided",
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
my $comms = $config->{ $config->{comms} };
|
||||
my $comms_args = $config->{ $config->{comms} . '_args' };
|
||||
my $config_command = $config->{command};
|
||||
|
@ -33,57 +52,6 @@ sub script {
|
|||
: "echo Press RETURN to continue; read IGNORE"
|
||||
; # : "sleep $autoclose";
|
||||
|
||||
# # P = pipe file
|
||||
# # s = server
|
||||
# # u = username
|
||||
# # p = port
|
||||
# # m = ccon master
|
||||
# # c = comms command
|
||||
# # a = command args
|
||||
# # C = command to run
|
||||
# my $lelehelper_script = q{
|
||||
# use strict;
|
||||
# use warnings;
|
||||
# use Getopt::Std;
|
||||
# my %opts;
|
||||
# getopts('PsupmcaC', \%opts);
|
||||
# my $command="$opts{c} $opts{a}";
|
||||
# open(PIPE, ">", $opts{P}) or die("Failed to open pipe: $!\n");
|
||||
# print PIPE "$$:$ENV{WINDOWID}"
|
||||
# or die("Failed to write to pipe: $!\\n");
|
||||
# close(PIPE) or die("Failed to close pipe: $!\\n");
|
||||
# if($opts{s} =~ m/==$/)
|
||||
# {
|
||||
# $opts{s} =~ s/==$//;
|
||||
# warn("\nWARNING: failed to resolve IP address for $opts{s}.\n\n");
|
||||
# sleep 5;
|
||||
# }
|
||||
# if($opts{m}) {
|
||||
# unless("$comms" ne "console") {
|
||||
# $opts{m} = $opts{m} ? "-M $opts{m} " : "";
|
||||
# $opts{c} .= $opts{m};
|
||||
# }
|
||||
# }
|
||||
# if($opts{u}) {
|
||||
# unless("$comms" eq "telnet") {
|
||||
# $opts{u} = $opts{u} ? "-l $opts{u} " : "";
|
||||
# $opts{c} .= $opts{u};
|
||||
# }
|
||||
# }
|
||||
# if("$comms" eq "telnet") {
|
||||
# $command .= "$opts{s} $opts{p}";
|
||||
# } else {
|
||||
# if ($opts{p}) {
|
||||
# $opts{c} .= "-p $opts{p} $opts{s}";
|
||||
# } else {
|
||||
# $opts{c} .= "$opts{s}";
|
||||
# }
|
||||
# }
|
||||
# #$command .= " $command || sleep 5";
|
||||
# warn("Running:$command\n"); # for debug purposes
|
||||
# exec($command);
|
||||
# };
|
||||
|
||||
my $script = <<" HERE";
|
||||
my \$pipe=shift;
|
||||
my \$svr=shift;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue