Ordo/Command/Cluster/Kill.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 49 CC 3 SCAR 16.1
CC
3
Cov
0%
execute
12.0
name
2.0
summary
2.0
CRAP 5.0
1 package App::Ordo::Command::Cluster::Kill;
2 use Moo;
3 use feature qw(say);
4 extends 'App::Ordo::Command::Base';
5  
6 use Term::ANSIColor qw(colored);
7  
8 sub name { "cluster kill" }
9 sub summary { "Kill all running jobs in a cluster" }
10 sub usage { "<path>" }
11  
12 sub option_spec {
13 return {};
14 }
15  
16 sub execute {
17 my ($self, $opt, $name) = @_;
18  
19 unless ($name) {
20 say colored(["bold red"], "Usage: cluster kill <path>");
21 return;
22 }
23  
24 my $payload = { name => $name };
25  
26 my $res = $self->api->call('kill_cluster', $payload);
27  
28 if ($res->{success}) {
29 say colored(["bold yellow"], "All running jobs in cluster '$name' killed");
30 } else {
31 say colored(["bold red"], "Failed to kill cluster: " . ($res->{message} || 'unknown error'));
32 }
33 }
34  
35 1;