OpenDNSSEC/CLI.pm

filter: Statementstmt 1.3% 17 / 1233 Branchbran 0.0% 0 / 628 Conditioncond 0.0% 0 / 133 MC/DCmcdc 0.0% 0 / 73 Subroutinesub 5.7% 5 / 87 Podpod 100% 17 / 17 totaltotal 1.8% 39 / 2171 CC 406 SCAR 64.1
CC
406
Cov
1%
key
3906.0
hsm
600.0
backup
552.0
CRAP 608.0
↑ Summary OpenDNSSEC/Server.pm »
1 package Lim::Plugin::OpenDNSSEC::CLI;
2  
3 1 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Getopt::Long ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Lim::Plugin::OpenDNSSEC ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Lim::Component::CLI);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =encoding utf8
13  
14 =head1 NAME
15  
16 ...
17  
18 =head1 VERSION
19  
20 See L<Lim::Plugin::OpenDNSSEC> for version.
21  
22 =cut
23  
24 1 our $VERSION = $Lim::Plugin::OpenDNSSEC::VERSION;
25  
26 =head1 SYNOPSIS
27  
28 ...
29  
30 =head1 SUBROUTINES/METHODS
31  
32 =head2 version
33  
34 =cut
35  
36 0 ▶sub version {
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
37 0 my ($self) = @_;
38 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
39
40 0 weaken($self);
41 0 ▶ $opendnssec->ReadVersion(sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
42 0 my ($call, $response) = @_;
43
44 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
45 0 undef($opendnssec);
46 0 return;
47 }
48
49 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
50 0 $self->cli->println('OpenDNSSEC plugin version ', $response->{version});
51 0 ▶ if (exists $response->{program}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"program"}) 0 0 0
52 0 $self->cli->println('OpenDNSSEC programs:');
53 0 ▶ foreach my $program (ref($response->{program}) eq 'ARRAY' ? @{$response->{program}} : $response->{program}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'program'} eq 'ARRAY' ? : 0 0 0
54 0 $self->cli->println(' ', $program->{name}, ' version ', $program->{version});
55 }
56 }
57 0 $self->Successful;
58 }
59 else {
60 0 $self->Error($call->Error);
61 }
62 0 undef($opendnssec);
63 0 });
64 }
65  
66 =head2 configs
67  
68 =cut
69  
70 0 ▶sub configs {
Subroutine configs: not called CC=1 SCAR=6.9
Pod documented
71 0 my ($self) = @_;
72 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
73
74 0 weaken($self);
75 0 ▶ $opendnssec->ReadConfigs(sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
76 0 my ($call, $response) = @_;
77
78 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
79 0 undef($opendnssec);
80 0 return;
81 }
82
83 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
84 0 $self->cli->println('OpenDNSSEC config files found:');
85 0 ▶ if (exists $response->{file}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"file"}) 0 0 0
86 0 ▶ foreach my $file (ref($response->{file}) eq 'ARRAY' ? @{$response->{file}} : $response->{file}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'file'} eq 'ARRAY' ? : 0 0 0
87 $self->cli->println($file->{name},
88 ' (readable: ', ($file->{read} ? 'yes' : 'no'),
89 0 ▶ ' writable: ', ($file->{read} ? 'yes' : 'no'),
Branch: 2 branches
BranchTrueFalseTotal
$file->{'read'} ? : 0 0 0
$file->{'read'} ? : 0 0 0
90 ')'
91 );
92 }
93 }
94 0 $self->Successful;
95 }
96 else {
97 0 $self->Error($call->Error);
98 }
99 0 undef($opendnssec);
100 0 });
101 }
102  
103 =head2 config
104  
105 =cut
106  
107 0 ▶sub config {
Subroutine config: not called CC=7 SCAR=40.3
Pod documented
108 0 my ($self, $cmd) = @_;
109 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
110
111 0 ▶ unless ($getopt and scalar @$args) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args) 0 0 0
Condition0%0/2
$getopt and scalar @$args
!ll
00
MC/DC0%0/1
$getopt and scalar @$args
$getopt
Truth table0%0/2
A
A= $getopt
Aresult
00
11
112 0 $self->Error;
113 0 return;
114 }
115  
116 0 ▶ if ($args->[0] eq 'view') {
Branch: 2 branches
BranchTrueFalseTotal
if ($args->[0] eq 'view') { } 0 0 0
elsif ($args->[0] eq 'edit') { } 0 0 0
117 0 ▶ if (defined $args->[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->[1]) 0 0 0
118 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
119 0 weaken($self);
120 $opendnssec->ReadConfig({
121 file => {
122 name => $args->[1]
123 }
124 0 ▶ }, sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
125 0 my ($call, $response) = @_;
126
127 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
128 0 undef($opendnssec);
129 0 return;
130 }
131
132 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
133 0 ▶ if (exists $response->{file}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"file"}) 0 0 0
134 0 ▶ foreach my $file (ref($response->{file}) eq 'ARRAY' ? @{$response->{file}} : $response->{file}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'file'} eq 'ARRAY' ? : 0 0 0
135 0 ▶ if (ref($response->{file}) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $response->{'file'} eq 'ARRAY') { } 0 0 0
136 0 $file->{content} =~ s/^/$file->{name}: /gm;
137 0 $self->cli->println($file->{content});
138 }
139 else {
140 0 $self->cli->println($file->{content});
141 }
142 }
143 }
144 0 $self->Successful;
145 }
146 else {
147 0 $self->Error($call->Error);
148 }
149 0 undef($opendnssec);
150 0 });
151 0 return;
152 }
153 }
154 elsif ($args->[0] eq 'edit') {
155 0 ▶ if (defined $args->[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->[1]) 0 0 0
156 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
157 0 weaken($self);
158 $opendnssec->ReadConfig({
159 file => {
160 name => $args->[1]
161 }
162 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
163 0 my ($call, $response) = @_;
164
165 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
166 0 undef($opendnssec);
167 0 return;
168 }
169
170 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
171 0 my $w; $w = AnyEvent->timer(
172 after => 0,
173 0 ▶ cb => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
174 0 ▶ if (defined (my $content = $self->cli->Editor($response->{file}->{content}))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $content = $self->cli->Editor($response->{'file'}{'content'}))) { } 0 0 0
175 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
176 $opendnssec->UpdateConfig({
177 file => {
178 name => $args->[1],
179 content => $content
180 }
181 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
182 0 my ($call, $response) = @_;
183
184 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
185 0 undef($opendnssec);
186 0 return;
187 }
188
189 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
190 0 $self->cli->println('Config updated');
191 0 $self->Successful;
192 }
193 else {
194 0 $self->Error($call->Error);
195 }
196 0 undef($opendnssec);
197 0 });
198 }
199 else {
200 0 $self->cli->println('Config not update, no change');
201 0 $self->Successful;
202 }
203 0 undef($w);
204 0 });
205 }
206 else {
207 0 $self->Error($call->Error);
208 }
209 0 undef($opendnssec);
210 0 });
211 0 return;
212 }
213 }
214 0 $self->Error;
215 }
216  
217 =head2 start
218  
219 =cut
220  
221 0 ▶sub start {
Subroutine start: not called CC=5 SCAR=34.0
Pod documented
222 0 my ($self, $cmd) = @_;
223 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
224  
225 0 ▶ unless ($getopt) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt) 0 0 0
226 0 $self->Error;
227 0 return;
228 }
229  
230 0 ▶ if (!scalar @$args) {
Branch: 3 branches
BranchTrueFalseTotal
if (not scalar @$args) { } 0 0 0
elsif ($args->[0] eq 'enforcer') { } 0 0 0
elsif ($args->[0] eq 'signer') { } 0 0 0
231 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
232 0 weaken($self);
233 0 ▶ $opendnssec->UpdateControlStart(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
234 0 my ($call, $response) = @_;
235
236 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
237 0 undef($opendnssec);
238 0 return;
239 }
240
241 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
242 0 $self->cli->println('OpenDNSSEC started');
243 0 $self->Successful;
244 }
245 else {
246 0 $self->Error($call->Error);
247 }
248 0 undef($opendnssec);
249 0 });
250 0 return;
251 }
252 elsif ($args->[0] eq 'enforcer') {
253 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
254 0 weaken($self);
255 $opendnssec->UpdateControlStart({
256 program => {
257 name => 'enforcer'
258 }
259 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
260 0 my ($call, $response) = @_;
261
262 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
263 0 undef($opendnssec);
264 0 return;
265 }
266
267 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
268 0 $self->cli->println('OpenDNSSEC Enforcer started');
269 0 $self->Successful;
270 }
271 else {
272 0 $self->Error($call->Error);
273 }
274 0 undef($opendnssec);
275 0 });
276 0 return;
277 }
278 elsif ($args->[0] eq 'signer') {
279 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
280 0 weaken($self);
281 $opendnssec->UpdateControlStart({
282 program => {
283 name => 'signer'
284 }
285 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
286 0 my ($call, $response) = @_;
287
288 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
289 0 undef($opendnssec);
290 0 return;
291 }
292
293 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
294 0 $self->cli->println('OpenDNSSEC Signer started');
295 0 $self->Successful;
296 }
297 else {
298 0 $self->Error($call->Error);
299 }
300 0 undef($opendnssec);
301 0 });
302 0 return;
303 }
304 0 $self->Error;
305 }
306  
307 =head2 stop
308  
309 =cut
310  
311 0 ▶sub stop {
Subroutine stop: not called CC=5 SCAR=34.0
Pod documented
312 0 my ($self, $cmd) = @_;
313 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
314  
315 0 ▶ unless ($getopt) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt) 0 0 0
316 0 $self->Error;
317 0 return;
318 }
319  
320 0 ▶ if (!scalar @$args) {
Branch: 3 branches
BranchTrueFalseTotal
if (not scalar @$args) { } 0 0 0
elsif ($args->[0] eq 'enforcer') { } 0 0 0
elsif ($args->[0] eq 'signer') { } 0 0 0
321 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
322 0 weaken($self);
323 0 ▶ $opendnssec->UpdateControlStop(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
324 0 my ($call, $response) = @_;
325
326 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
327 0 undef($opendnssec);
328 0 return;
329 }
330
331 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
332 0 $self->cli->println('OpenDNSSEC stopped');
333 0 $self->Successful;
334 }
335 else {
336 0 $self->Error($call->Error);
337 }
338 0 undef($opendnssec);
339 0 });
340 0 return;
341 }
342 elsif ($args->[0] eq 'enforcer') {
343 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
344 0 weaken($self);
345 $opendnssec->UpdateControlStop({
346 program => {
347 name => 'enforcer'
348 }
349 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
350 0 my ($call, $response) = @_;
351
352 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
353 0 undef($opendnssec);
354 0 return;
355 }
356
357 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
358 0 $self->cli->println('OpenDNSSEC Enforcer stopped');
359 0 $self->Successful;
360 }
361 else {
362 0 $self->Error($call->Error);
363 }
364 0 undef($opendnssec);
365 0 });
366 0 return;
367 }
368 elsif ($args->[0] eq 'signer') {
369 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
370 0 weaken($self);
371 $opendnssec->UpdateControlStop({
372 program => {
373 name => 'signer'
374 }
375 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
376 0 my ($call, $response) = @_;
377
378 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
379 0 undef($opendnssec);
380 0 return;
381 }
382
383 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
384 0 $self->cli->println('OpenDNSSEC Signer stopped');
385 0 $self->Successful;
386 }
387 else {
388 0 $self->Error($call->Error);
389 }
390 0 undef($opendnssec);
391 0 });
392 0 return;
393 }
394 0 $self->Error;
395 }
396  
397 =head2 setup
398  
399 =cut
400  
401 0 ▶sub setup {
Subroutine setup: not called CC=1 SCAR=6.9
Pod documented
402 0 my ($self) = @_;
403 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
404
405 0 weaken($self);
406 0 ▶ $opendnssec->CreateEnforcerSetup(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
407 0 my ($call, $response) = @_;
408
409 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
410 0 undef($opendnssec);
411 0 return;
412 }
413
414 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
415 0 $self->cli->println('OpenDNSSEC setup successful');
416 0 $self->Successful;
417 }
418 else {
419 0 $self->Error($call->Error);
420 }
421 0 undef($opendnssec);
422 0 });
423 }
424  
425 =head2 update
426  
427 =cut
428  
429 0 ▶sub update {
Subroutine update: not called CC=4 SCAR=30.0
Pod documented
430 0 my ($self, $cmd) = @_;
431 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
432  
433 0 ▶ unless ($getopt) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt) 0 0 0
434 0 $self->Error;
435 0 return;
436 }
437  
438 0 ▶ if (!scalar @$args or $args->[0] eq 'all') {
Branch: 1 branch
BranchTrueFalseTotal
if (not scalar @$args or $args->[0] eq 'all') { } 0 0 0
Condition0%0/3
not scalar @$args or $args->[0] eq "all"
l!l&&r!l&&!r
000
MC/DC0%0/2
not scalar @$args or $args->[0] eq "all"
not scalar @$args $args->[0] eq "all"
Truth table0%0/3
not(A) or B
A= not scalar @$argsB= $args->[0] eq "all"
ABresult
1X1
011
000
439 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
440 0 weaken($self);
441 0 ▶ $opendnssec->UpdateEnforcerUpdate(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
442 0 my ($call, $response) = @_;
443
444 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
445 0 undef($opendnssec);
446 0 return;
447 }
448
449 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
450 0 $self->cli->println('OpenDNSSEC Enforcer configuration updated');
451 0 $self->Successful;
452 }
453 else {
454 0 $self->Error($call->Error);
455 }
456 0 undef($opendnssec);
457 0 });
458 0 return;
459 }
460 else {
461 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
462 0 weaken($self);
463 $opendnssec->UpdateEnforcerUpdate({
464 update => {
465 section => $args->[0]
466 }
467 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
468 0 my ($call, $response) = @_;
469
470 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
471 0 undef($opendnssec);
472 0 return;
473 }
474
475 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
476 0 $self->cli->println('OpenDNSSEC Enforcer configuration "', $args->[0], '" updated');
477 0 $self->Successful;
478 }
479 else {
480 0 $self->Error($call->Error);
481 }
482 0 undef($opendnssec);
483 0 });
484 0 return;
485 }
486 0 $self->Error;
487 }
488  
489 =head2 zone
490  
491 =cut
492  
493 0 ▶sub zone {
Subroutine zone: not called CC=10 SCAR=47.0
Pod documented
494 0 my ($self, $cmd) = @_;
495 0 my $xml = 1;
496 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd,
497 'xml!' => \$xml
498 );
499  
500 0 ▶ unless ($getopt and scalar @$args) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args) 0 0 0
Condition0%0/2
$getopt and scalar @$args
!ll
00
MC/DC0%0/1
$getopt and scalar @$args
$getopt
Truth table0%0/2
A
A= $getopt
Aresult
00
11
501 0 $self->Error;
502 0 return;
503 }
504  
505 0 ▶ if ($args->[0] eq 'add' and scalar @$args == 6) {
Branch: 3 branches
BranchTrueFalseTotal
if ($args->[0] eq 'add' and scalar @$args == 6) { } 0 0 0
elsif ($args->[0] eq 'list') { } 0 0 0
elsif ($args->[0] eq 'delete' and scalar @$args == 2) { } 0 0 0
Condition0%0/3
$args->[0] eq "add" and scalar @$args == 6
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "add" and scalar @$args == 6
$args->[0] eq "add" scalar @$args == 6
Truth table0%0/3
A and B
A= $args->[0] eq "add"B= scalar @$args == 6
ABresult
0X0
100
111
506 0 my (undef, $zone, $policy, $signerconf, $input, $output) = @$args;
507 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
508 0 weaken($self);
509 $opendnssec->CreateEnforcerZone({
510 zone => {
511 name => $zone,
512 policy => $policy,
513 signerconf => $signerconf,
514 input => $input,
515 output => $output,
516 no_xml => $xml ? 0 : 1
517 }
518 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
519 0 my ($call, $response) = @_;
520
521 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
522 0 undef($opendnssec);
523 0 return;
524 }
525
526 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
527 0 $self->cli->println('Zone ', $zone, ' added');
528 0 $self->Successful;
529 }
530 else {
531 0 $self->Error($call->Error);
532 }
533 0 undef($opendnssec);
534 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
$xml ? : 0 0 0
535 0 return;
536 }
537 elsif ($args->[0] eq 'list') {
538 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
539 0 weaken($self);
540 0 ▶ $opendnssec->ReadEnforcerZoneList(sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
541 0 my ($call, $response) = @_;
542
543 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
544 0 undef($opendnssec);
545 0 return;
546 }
547
548 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
549 0 ▶ if (exists $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"zone"}) 0 0 0
550 0 $self->cli->println('OpenDNSSEC Enforcer Zone List:');
551 0 ▶ foreach my $zone (ref($response->{zone}) eq 'ARRAY' ? @{$response->{zone}} : $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'zone'} eq 'ARRAY' ? : 0 0 0
552 0 $self->cli->println($zone->{name}, ' (policy ', $zone->{policy}, ')');
553 }
554 }
555 0 $self->Successful;
556 }
557 else {
558 0 $self->Error($call->Error);
559 }
560 0 undef($opendnssec);
561 0 });
562 0 return;
563 }
564 ▶ elsif ($args->[0] eq 'delete' and scalar @$args == 2) {
Condition0%0/3
$args->[0] eq "delete" and scalar @$args == 2
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "delete" and scalar @$args == 2
$args->[0] eq "delete" scalar @$args == 2
Truth table0%0/3
A and B
A= $args->[0] eq "delete"B= scalar @$args == 2
ABresult
0X0
100
111
565 0 my (undef, $zone) = @$args;
566 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
567 0 weaken($self);
568 $opendnssec->DeleteEnforcerZone({
569 zone => {
570 name => $zone,
571 no_xml => $xml ? 0 : 1
572 }
573 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
574 0 my ($call, $response) = @_;
575
576 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
577 0 undef($opendnssec);
578 0 return;
579 }
580
581 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
582 0 $self->cli->println('Zone ', $zone, ' deleted');
583 0 $self->Successful;
584 }
585 else {
586 0 $self->Error($call->Error);
587 }
588 0 undef($opendnssec);
589 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
$xml ? : 0 0 0
590 0 return;
591 }
592 0 $self->Error;
593 }
594  
595 =head2 repository
596  
597 =cut
598  
599 0 ▶sub repository {
Subroutine repository: not called CC=3 SCAR=24.8
Pod documented
600 0 my ($self, $cmd) = @_;
601 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
602  
603 0 ▶ unless ($getopt) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt) 0 0 0
604 0 $self->Error;
605 0 return;
606 }
607  
608 0 ▶ if ($args->[0] eq 'list') {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->[0] eq "list") 0 0 0
609 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
610 0 weaken($self);
611 0 ▶ $opendnssec->ReadEnforcerRepositoryList(sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
612 0 my ($call, $response) = @_;
613
614 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
615 0 undef($opendnssec);
616 0 return;
617 }
618
619 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
620 0 ▶ if (exists $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"repository"}) 0 0 0
621 0 $self->cli->println(join("\t", 'Name', 'Capacity', 'Require Backup'));
622 0 ▶ foreach my $repository (ref($response->{repository}) eq 'ARRAY' ? @{$response->{repository}} : $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'repository'} eq 'ARRAY' ? : 0 0 0
623 $self->cli->println(join("\t",
624 $repository->{name},
625 $repository->{capacity},
626 0 ▶ $repository->{require_backup} ? 'Yes' : 'No'
Branch: 1 branch
BranchTrueFalseTotal
$repository->{'require_backup'} ? : 0 0 0
627 ));
628 }
629 }
630 0 $self->Successful;
631 }
632 else {
633 0 $self->Error($call->Error);
634 }
635 0 undef($opendnssec);
636 0 });
637 0 return;
638 }
639 0 $self->Error;
640 }
641  
642 =head2 policy
643  
644 =cut
645  
646 0 ▶sub policy {
Subroutine policy: not called CC=7 SCAR=40.3
Pod documented
647 0 my ($self, $cmd) = @_;
648 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
649  
650 0 ▶ unless ($getopt) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt) 0 0 0
651 0 $self->Error;
652 0 return;
653 }
654  
655 0 ▶ if ($args->[0] eq 'list') {
Branch: 2 branches
BranchTrueFalseTotal
if ($args->[0] eq 'list') { } 0 0 0
elsif ($args->[0] eq 'export') { } 0 0 0
656 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
657 0 weaken($self);
658 0 ▶ $opendnssec->ReadEnforcerPolicyList(sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
659 0 my ($call, $response) = @_;
660
661 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
662 0 undef($opendnssec);
663 0 return;
664 }
665
666 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
667 0 ▶ if (exists $response->{policy}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"policy"}) 0 0 0
668 0 $self->cli->println(join("\t", 'Name', 'Description'));
669 0 ▶ foreach my $policy (ref($response->{policy}) eq 'ARRAY' ? @{$response->{policy}} : $response->{policy}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'policy'} eq 'ARRAY' ? : 0 0 0
670 $self->cli->println(join("\t",
671 $policy->{name},
672 $policy->{description}
673 0 ));
674 }
675 }
676 0 $self->Successful;
677 }
678 else {
679 0 $self->Error($call->Error);
680 }
681 0 undef($opendnssec);
682 0 });
683 0 return;
684 }
685 elsif ($args->[0] eq 'export') {
686 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
687 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
688 0 my @policies;
689 0 my $skip = 1;
690
691 0 foreach (@$args) {
692 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
693 0 $skip--;
694 0 next;
695 }
696
697 0 push(@policies, { name => $_ });
698 }
699
700 0 weaken($self);
701 $opendnssec->ReadEnforcerPolicyExport({
702 policy => \@policies
703 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
704 0 my ($call, $response) = @_;
705
706 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
707 0 undef($opendnssec);
708 0 return;
709 }
710
711 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
712 0 ▶ if (exists $response->{policy}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"policy"}) 0 0 0
713 0 ▶ foreach my $policy (ref($response->{policy}) eq 'ARRAY' ? @{$response->{policy}} : $response->{policy}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'policy'} eq 'ARRAY' ? : 0 0 0
714 0 $self->cli->println('Policy export for policy ', $policy->{name});
715 0 $self->cli->println($policy->{kasp});
716 }
717 }
718 0 $self->Successful;
719 }
720 else {
721 0 $self->Error($call->Error);
722 }
723 0 undef($opendnssec);
724 0 });
725 0 return;
726 }
727 else {
728 0 weaken($self);
729 0 ▶ $opendnssec->ReadEnforcerPolicyExport(sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
730 0 my ($call, $response) = @_;
731
732 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
733 0 undef($opendnssec);
734 0 return;
735 }
736
737 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
738 0 ▶ if (exists $response->{kasp}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"kasp"}) 0 0 0
739 0 $self->cli->println($response->{kasp});
740 }
741 0 $self->Successful;
742 }
743 else {
744 0 $self->Error($call->Error);
745 }
746 0 undef($opendnssec);
747 0 });
748 0 return;
749 }
750 }
751 0 $self->Error;
752 }
753  
754 =head2 key
755  
756 =cut
757  
758 0 ▶sub key {
Subroutine key: not called CC=62 SCAR=82.7
Pod documented
759 0 my ($self, $cmd) = @_;
760 0 my $verbose = 0;
761 0 my $keystate;
762 my $keytype;
763 0 my $ds = 0;
764 0 my $cka_id;
765 my $keytag;
766 0 my $retire = 1;
767 0 my $repository;
768 my $bits;
769 0 my $algorithm;
770 0 my $time;
771 0 my $retire_time;
772 0 my $zone;
773 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd,
774 'verbose' => \$verbose,
775 'keystate:s' => \$keystate,
776 'keytype:s' => \$keytype,
777 'ds' => \$ds,
778 'cka_id:s' => \$cka_id,
779 'keytag:s' => \$keytag,
780 'retire!' => \$retire,
781 'repository:s' => \$repository,
782 'bits:i' => \$bits,
783 'algorithm:s' => \$algorithm,
784 'time:s' => \$time,
785 'retire-time:s' => \$retire_time,
786 'zone:s' => \$zone
787 );
788  
789 0 ▶ unless ($getopt and scalar @$args >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args >= 1) 0 0 0
Condition0%0/3
$getopt and scalar @$args >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$getopt and scalar @$args >= 1
$getopt scalar @$args >= 1
Truth table0%0/3
A and B
A= $getoptB= scalar @$args >= 1
ABresult
0X0
100
111
790 0 $self->Error;
791 0 return;
792 }
793  
794 0 ▶ if ($args->[0] eq 'list') {
Branch: 8 branches
BranchTrueFalseTotal
if ($args->[0] eq 'list') { } 0 0 0
elsif ($args->[0] eq 'export') { } 0 0 0
elsif ($args->[0] eq 'import' and defined $cka_id and defined $repository and defined $bits and defined $algorithm and defined $keystate and defined $keytype and defined $time and defined $zone) { } 0 0 0
elsif ($args->[0] eq 'rollover' and scalar @$args >= 2 and $args->[1] eq 'zone' || $args->[1] eq 'policy') { } 0 0 0
elsif ($args->[0] eq 'purge' and scalar @$args >= 2 and $args->[1] eq 'zone' || $args->[1] eq 'policy') { } 0 0 0
elsif ($args->[0] eq 'generate' and scalar @$args == 3) { } 0 0 0
elsif ($args->[0] eq 'ksk' and scalar @$args == 3 and $args->[1] eq 'retire') { } 0 0 0
elsif ($args->[0] eq 'ds' and scalar @$args == 3 and $args->[1] eq 'seen') { } 0 0 0
795 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
796 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
797 0 my @zones;
798 0 my $skip = 1;
799
800 0 foreach (@$args) {
801 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
802 0 $skip--;
803 0 next;
804 }
805
806 0 push(@zones, { name => $_ });
807 }
808
809 0 weaken($self);
810 $opendnssec->ReadEnforcerKeyList({
811 verbose => $verbose ? 1 : 0,
812 zone => \@zones
813 0 ▶ }, sub {
Subroutine __ANON__: not called CC=10 SCAR=47.0
814 0 my ($call, $response) = @_;
815
816 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
817 0 undef($opendnssec);
818 0 return;
819 }
820
821 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
822 0 ▶ if (exists $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"zone"}) 0 0 0
823 0 ▶ $self->cli->println(join("\t", 'Zone', 'Keytype', 'State', 'Next Transaction', ($verbose ? ('CKA_ID', 'Repository', 'Keytag') : ())));
Branch: 1 branch
BranchTrueFalseTotal
$verbose ? : 0 0 0
824 0 ▶ foreach my $zone (ref($response->{zone}) eq 'ARRAY' ? @{$response->{zone}} : $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'zone'} eq 'ARRAY' ? : 0 0 0
825 0 ▶ foreach my $key (ref($zone->{key}) eq 'ARRAY' ? @{$zone->{key}} : $zone->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $zone->{'key'} eq 'ARRAY' ? : 0 0 0
826 $self->cli->println(join("\t",
827 $zone->{name},
828 $key->{type},
829 $key->{state},
830 $key->{next_transaction},
831 ($verbose ? (
832 $key->{cka_id},
833 $key->{repository},
834 $key->{keytag}
835 0 ▶ ) : ())
Branch: 1 branch
BranchTrueFalseTotal
$verbose ? : 0 0 0
836 ));
837 }
838 }
839 }
840 0 $self->Successful;
841 }
842 else {
843 0 $self->Error($call->Error);
844 }
845 0 undef($opendnssec);
846 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
$verbose ? : 0 0 0
847 0 return;
848 }
849 else {
850 0 weaken($self);
851 $opendnssec->ReadEnforcerKeyList({
852 verbose => $verbose ? 1 : 0
853 0 ▶ }, sub {
Subroutine __ANON__: not called CC=10 SCAR=47.0
854 0 my ($call, $response) = @_;
855
856 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
857 0 undef($opendnssec);
858 0 return;
859 }
860
861 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
862 0 ▶ if (exists $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"zone"}) 0 0 0
863 0 ▶ $self->cli->println(join("\t", 'Zone', 'Keytype', 'State', 'Next Transaction', ($verbose ? ('CKA_ID', 'Repository', 'Keytag') : ())));
Branch: 1 branch
BranchTrueFalseTotal
$verbose ? : 0 0 0
864 0 ▶ foreach my $zone (ref($response->{zone}) eq 'ARRAY' ? @{$response->{zone}} : $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'zone'} eq 'ARRAY' ? : 0 0 0
865 0 ▶ foreach my $key (ref($zone->{key}) eq 'ARRAY' ? @{$zone->{key}} : $zone->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $zone->{'key'} eq 'ARRAY' ? : 0 0 0
866 $self->cli->println(join("\t",
867 $zone->{name},
868 $key->{type},
869 $key->{state},
870 $key->{next_transaction},
871 ($verbose ? (
872 $key->{cka_id},
873 $key->{repository},
874 $key->{keytag}
875 0 ▶ ) : ())
Branch: 1 branch
BranchTrueFalseTotal
$verbose ? : 0 0 0
876 ));
877 }
878 }
879 }
880 0 $self->Successful;
881 }
882 else {
883 0 $self->Error($call->Error);
884 }
885 0 undef($opendnssec);
886 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
$verbose ? : 0 0 0
887 0 return;
888 }
889 }
890 elsif ($args->[0] eq 'export') {
891 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
892 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
893 0 my @zones;
894 0 my $skip = 1;
895
896 0 foreach (@$args) {
897 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
898 0 $skip--;
899 0 next;
900 }
901
902 0 push(@zones, { name => $_ });
903 }
904
905 0 weaken($self);
906 $opendnssec->ReadEnforcerKeyExport({
907 zone => \@zones,
908 (defined $keystate ? (keystate => $keystate) : ()),
909 (defined $keytype ? (keytype => $keytype) : ()),
910 (defined $ds and $ds ? (ds => 1) : ()),
911 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
912 0 my ($call, $response) = @_;
913
914 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
915 0 undef($opendnssec);
916 0 return;
917 }
918
919 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
920 0 ▶ if (exists $response->{rr}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"rr"}) 0 0 0
921 0 $self->cli->println(join("\t", 'Name', 'TTL', 'Class', 'Type', 'RDATA'));
922 0 ▶ foreach my $rr (ref($response->{rr}) eq 'ARRAY' ? @{$response->{rr}} : $response->{rr}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'rr'} eq 'ARRAY' ? : 0 0 0
923 $self->cli->println(join("\t",
924 $rr->{name},
925 $rr->{ttl},
926 $rr->{class},
927 $rr->{type},
928 $rr->{rdata}
929 0 ));
930 }
931 }
932 0 $self->Successful;
933 }
934 else {
935 0 $self->Error($call->Error);
936 }
937 0 undef($opendnssec);
938 0 ▶ });
Branch: 3 branches
BranchTrueFalseTotal
defined $keystate ? : 0 0 0
defined $keytype ? : 0 0 0
$ds ? : 0 0 0
Condition0%0/3
defined $ds && ($ds ? ('ds', 1) : ())
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ds && ($ds ? ('ds', 1) : ())
defined $ds ($ds ? ('ds', 1) : ())
Truth table0%0/3
A && B
A= defined $dsB= ($ds ? ('ds', 1) : ())
ABresult
0X0
100
111
939 0 return;
940 }
941 else {
942 0 weaken($self);
943 $opendnssec->ReadEnforcerKeyExport({
944 (defined $keystate ? (keystate => $keystate) : ()),
945 (defined $keytype ? (keytype => $keytype) : ()),
946 (defined $ds and $ds ? (ds => 1) : ()),
947 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
948 0 my ($call, $response) = @_;
949
950 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
951 0 undef($opendnssec);
952 0 return;
953 }
954
955 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
956 0 ▶ if (exists $response->{rr}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"rr"}) 0 0 0
957 0 $self->cli->println(join("\t", 'Name', 'TTL', 'Class', 'Type', 'RDATA'));
958 0 ▶ foreach my $rr (ref($response->{rr}) eq 'ARRAY' ? @{$response->{rr}} : $response->{rr}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'rr'} eq 'ARRAY' ? : 0 0 0
959 $self->cli->println(join("\t",
960 $rr->{name},
961 $rr->{ttl},
962 $rr->{class},
963 $rr->{type},
964 $rr->{rdata}
965 0 ));
966 }
967 }
968 0 $self->Successful;
969 }
970 else {
971 0 $self->Error($call->Error);
972 }
973 0 undef($opendnssec);
974 0 ▶ });
Branch: 3 branches
BranchTrueFalseTotal
defined $keystate ? : 0 0 0
defined $keytype ? : 0 0 0
$ds ? : 0 0 0
Condition0%0/3
defined $ds && ($ds ? ('ds', 1) : ())
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ds && ($ds ? ('ds', 1) : ())
defined $ds ($ds ? ('ds', 1) : ())
Truth table0%0/3
A && B
A= defined $dsB= ($ds ? ('ds', 1) : ())
ABresult
0X0
100
111
975 0 return;
976 }
977 }
978 ▶ elsif ($args->[0] eq 'import' and defined $cka_id and defined $repository and defined $bits and defined $algorithm and defined $keystate and defined $keytype and defined $time and defined $zone) {
Condition0%0/24
$args->[0] eq "import" and defined $cka_id and defined $repository and defined $bits and defined $algorithm and defined $keystate and defined $keytype and defined $time and defined $zone
!ll&&!rl&&r
000
$args->[0] eq "import" and defined $cka_id and defined $repository and defined $bits and defined $algorithm and defined $keystate and defined $keytype and defined $time
!ll&&!rl&&r
000
$args->[0] eq "import" and defined $cka_id and defined $repository and defined $bits and defined $algorithm and defined $keystate and defined $keytype
!ll&&!rl&&r
000
$args->[0] eq "import" and defined $cka_id and defined $repository and defined $bits and defined $algorithm and defined $keystate
!ll&&!rl&&r
000
$args->[0] eq "import" and defined $cka_id and defined $repository and defined $bits and defined $algorithm
!ll&&!rl&&r
000
$args->[0] eq "import" and defined $cka_id and defined $repository and defined $bits
!ll&&!rl&&r
000
$args->[0] eq "import" and defined $cka_id and defined $repository
!ll&&!rl&&r
000
$args->[0] eq "import" and defined $cka_id
!ll&&!rl&&r
000
MC/DC0%0/9
$args->[0] eq "import" and defined $cka_id and defined $repository and defined $bits and defined $algorithm and defined $keystate and defined $keytype and defined $time and defined $zone
$args->[0] eq "import" defined $cka_id defined $repository defined $bits defined $algorithm defined $keystate defined $keytype defined $time defined $zone
Truth table0%0/10
A and B and C and D and E and F and G and H and I
A= $args->[0] eq "import"B= defined $cka_idC= defined $repositoryD= defined $bitsE= defined $algorithmF= defined $keystateG= defined $keytypeH= defined $timeI= defined $zone
ABCDEFGHIresult
0XXXXXXXX0
10XXXXXXX0
110XXXXXX0
1110XXXXX0
11110XXXX0
111110XXX0
1111110XX0
11111110X0
1111111100
1111111111
979 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
980 0 weaken($self);
981 $opendnssec->CreateEnforcerKeyImport({
982 key => {
983 zone => $zone,
984 cka_id => $cka_id,
985 repository => $repository,
986 bits => $bits,
987 algorithm => $algorithm,
988 keystate => $keystate,
989 keytype => $keytype,
990 time => $time,
991 (defined $retire_time ? (retire => $retire_time) : ())
992 }
993 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
994 0 my ($call, $response) = @_;
995
996 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
997 0 undef($opendnssec);
998 0 return;
999 }
1000
1001 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1002 0 $self->cli->println('Key imported');
1003 0 $self->Successful;
1004 }
1005 else {
1006 0 $self->Error($call->Error);
1007 }
1008 0 undef($opendnssec);
1009 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
defined $retire_time ? : 0 0 0
1010 0 return;
1011 }
1012 ▶ elsif ($args->[0] eq 'rollover' and scalar @$args >= 2 and ($args->[1] eq 'zone' or $args->[1] eq 'policy')) {
Condition0%0/9
$args->[0] eq "rollover" and scalar @$args >= 2 and $args->[1] eq "zone" || $args->[1] eq "policy"
!ll&&!rl&&r
000
$args->[0] eq "rollover" and scalar @$args >= 2
!ll&&!rl&&r
000
$args->[1] eq "zone" or $args->[1] eq "policy"
l!l&&r!l&&!r
000
MC/DC0%0/4
$args->[0] eq "rollover" and scalar @$args >= 2 and $args->[1] eq "zone" || $args->[1] eq "policy"
$args->[0] eq "rollover" scalar @$args >= 2 $args->[1] eq "zone" $args->[1] eq "policy"
Truth table0%0/5
A and B and C or D
A= $args->[0] eq "rollover"B= scalar @$args >= 2C= $args->[1] eq "zone"D= $args->[1] eq "policy"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
1013 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1014 0 ▶ if (scalar @$args > 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 2) 0 0 0
1015 0 my @names;
1016 0 my $skip = 2;
1017
1018 0 foreach (@$args) {
1019 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1020 0 $skip--;
1021 0 next;
1022 }
1023
1024 0 ▶ push(@names, {
Branch: 1 branch
BranchTrueFalseTotal
defined $keytype ? : 0 0 0
1025 name => $_,
1026 (defined $keytype ? (keytype => $keytype) : ()),
1027 });
1028 }
1029  
1030 0 weaken($self);
1031 $opendnssec->UpdateEnforcerKeyRollover({
1032 $args->[1] eq 'zone' ? (zone => \@names) : (policy => \@names)
1033 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1034 0 my ($call, $response) = @_;
1035
1036 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1037 0 undef($opendnssec);
1038 0 return;
1039 }
1040
1041 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1042 0 $self->cli->println('Rollover issued');
1043 0 $self->Successful;
1044 }
1045 else {
1046 0 $self->Error($call->Error);
1047 }
1048 0 undef($opendnssec);
1049 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
$args->[1] eq 'zone' ? : 0 0 0
1050 0 return;
1051 }
1052 }
1053 ▶ elsif ($args->[0] eq 'purge' and scalar @$args >= 2 and ($args->[1] eq 'zone' or $args->[1] eq 'policy')) {
Condition0%0/9
$args->[0] eq "purge" and scalar @$args >= 2 and $args->[1] eq "zone" || $args->[1] eq "policy"
!ll&&!rl&&r
000
$args->[0] eq "purge" and scalar @$args >= 2
!ll&&!rl&&r
000
$args->[1] eq "zone" or $args->[1] eq "policy"
l!l&&r!l&&!r
000
MC/DC0%0/4
$args->[0] eq "purge" and scalar @$args >= 2 and $args->[1] eq "zone" || $args->[1] eq "policy"
$args->[0] eq "purge" scalar @$args >= 2 $args->[1] eq "zone" $args->[1] eq "policy"
Truth table0%0/5
A and B and C or D
A= $args->[0] eq "purge"B= scalar @$args >= 2C= $args->[1] eq "zone"D= $args->[1] eq "policy"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
1054 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1055 0 ▶ if (scalar @$args > 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 2) 0 0 0
1056 0 my @names;
1057 0 my $skip = 2;
1058
1059 0 foreach (@$args) {
1060 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1061 0 $skip--;
1062 0 next;
1063 }
1064
1065 0 ▶ push(@names, {
Branch: 1 branch
BranchTrueFalseTotal
defined $keytype ? : 0 0 0
1066 name => $_,
1067 (defined $keytype ? (keytype => $keytype) : ()),
1068 });
1069 }
1070  
1071 0 weaken($self);
1072 $opendnssec->DeleteEnforcerKeyPurge({
1073 $args->[1] eq 'zone' ? (zone => \@names) : (policy => \@names)
1074 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
1075 0 my ($call, $response) = @_;
1076
1077 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1078 0 undef($opendnssec);
1079 0 return;
1080 }
1081
1082 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1083 0 ▶ if (exists $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'key'}) { } 0 0 0
1084 0 $self->cli->println('Keys (CKA_ID) purged:');
1085 0 ▶ foreach my $key (ref($response->{key}) eq 'ARRAY' ? @{$response->{key}} : $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'key'} eq 'ARRAY' ? : 0 0 0
1086 0 $self->cli->println($key->{cka_id});
1087 }
1088 }
1089 else {
1090 0 $self->cli->println('No keys purged');
1091 }
1092 0 $self->Successful;
1093 }
1094 else {
1095 0 $self->Error($call->Error);
1096 }
1097 0 undef($opendnssec);
1098 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
$args->[1] eq 'zone' ? : 0 0 0
1099 0 return;
1100 }
1101 }
1102 ▶ elsif ($args->[0] eq 'generate' and scalar @$args == 3) {
Condition0%0/3
$args->[0] eq "generate" and scalar @$args == 3
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "generate" and scalar @$args == 3
$args->[0] eq "generate" scalar @$args == 3
Truth table0%0/3
A and B
A= $args->[0] eq "generate"B= scalar @$args == 3
ABresult
0X0
100
111
1103 0 my (undef, $policy, $interval) = @$args;
1104 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1105 0 weaken($self);
1106 $opendnssec->CreateEnforcerKeyGenerate({
1107 policy => {
1108 name => $policy,
1109 interval => $interval
1110 }
1111 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
1112 0 my ($call, $response) = @_;
1113
1114 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1115 0 undef($opendnssec);
1116 0 return;
1117 }
1118
1119 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1120 0 ▶ if (exists $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'key'}) { } 0 0 0
1121 0 $self->cli->println(join("\t", 'Keytype', 'Bits', 'Algorithm', 'CKA_ID', 'Repository'));
1122 0 ▶ foreach my $key (ref($response->{key}) eq 'ARRAY' ? @{$response->{key}} : $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'key'} eq 'ARRAY' ? : 0 0 0
1123 $self->cli->println(join("\t",
1124 $key->{keytype},
1125 $key->{bits},
1126 $key->{algorithm},
1127 $key->{cka_id},
1128 $key->{repository}
1129 0 ));
1130 }
1131 }
1132 else {
1133 0 $self->cli->println('No keys generated');
1134 }
1135 0 $self->Successful;
1136 }
1137 else {
1138 0 $self->Error($call->Error);
1139 }
1140 0 undef($opendnssec);
1141 0 });
1142 0 return;
1143 }
1144 ▶ elsif ($args->[0] eq 'ksk' and scalar @$args == 3 and $args->[1] eq 'retire') {
Condition0%0/6
$args->[0] eq "ksk" and scalar @$args == 3 and $args->[1] eq "retire"
!ll&&!rl&&r
000
$args->[0] eq "ksk" and scalar @$args == 3
!ll&&!rl&&r
000
MC/DC0%0/3
$args->[0] eq "ksk" and scalar @$args == 3 and $args->[1] eq "retire"
$args->[0] eq "ksk" scalar @$args == 3 $args->[1] eq "retire"
Truth table0%0/4
A and B and C
A= $args->[0] eq "ksk"B= scalar @$args == 3C= $args->[1] eq "retire"
ABCresult
0XX0
10X0
1100
1111
1145 0 my (undef, undef, $zone) = @$args;
1146 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1147 0 weaken($self);
1148 $opendnssec->UpdateEnforcerKeyKskRetire({
1149 zone => {
1150 name => $zone,
1151 (defined $cka_id ? (cka_id => $cka_id) : ()),
1152 (defined $keytag ? (keytag => $keytag) : ())
1153 }
1154 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1155 0 my ($call, $response) = @_;
1156
1157 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1158 0 undef($opendnssec);
1159 0 return;
1160 }
1161
1162 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1163 0 $self->cli->println('KSK retired');
1164 0 $self->Successful;
1165 }
1166 else {
1167 0 $self->Error($call->Error);
1168 }
1169 0 undef($opendnssec);
1170 0 ▶ });
Branch: 2 branches
BranchTrueFalseTotal
defined $cka_id ? : 0 0 0
defined $keytag ? : 0 0 0
1171 0 return;
1172 }
1173 ▶ elsif ($args->[0] eq 'ds' and scalar @$args == 3 and $args->[1] eq 'seen') {
Condition0%0/6
$args->[0] eq "ds" and scalar @$args == 3 and $args->[1] eq "seen"
!ll&&!rl&&r
000
$args->[0] eq "ds" and scalar @$args == 3
!ll&&!rl&&r
000
MC/DC0%0/3
$args->[0] eq "ds" and scalar @$args == 3 and $args->[1] eq "seen"
$args->[0] eq "ds" scalar @$args == 3 $args->[1] eq "seen"
Truth table0%0/4
A and B and C
A= $args->[0] eq "ds"B= scalar @$args == 3C= $args->[1] eq "seen"
ABCresult
0XX0
10X0
1100
1111
1174 0 my (undef, undef, $zone) = @$args;
1175 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1176 0 weaken($self);
1177 $opendnssec->UpdateEnforcerKeyDsSeen({
1178 zone => {
1179 name => $zone,
1180 (defined $cka_id ? (cka_id => $cka_id) : ()),
1181 (defined $keytag ? (keytag => $keytag) : ()),
1182 ($retire == 0 ? (no_retire => 1) : ())
1183 }
1184 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1185 0 my ($call, $response) = @_;
1186
1187 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1188 0 undef($opendnssec);
1189 0 return;
1190 }
1191
1192 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1193 0 $self->cli->println('DS marked as seen');
1194 0 $self->Successful;
1195 }
1196 else {
1197 0 $self->Error($call->Error);
1198 }
1199 0 undef($opendnssec);
1200 0 ▶ });
Branch: 3 branches
BranchTrueFalseTotal
defined $cka_id ? : 0 0 0
defined $keytag ? : 0 0 0
$retire == 0 ? : 0 0 0
1201 0 return;
1202 }
1203 0 $self->Error;
1204 }
1205  
1206 =head2 backup
1207  
1208 =cut
1209  
1210 0 ▶sub backup {
Subroutine backup: not called CC=23 SCAR=63.1
Pod documented
1211 0 my ($self, $cmd) = @_;
1212 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
1213
1214 0 ▶ unless ($getopt and scalar @$args >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args >= 1) 0 0 0
Condition0%0/3
$getopt and scalar @$args >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$getopt and scalar @$args >= 1
$getopt scalar @$args >= 1
Truth table0%0/3
A and B
A= $getoptB= scalar @$args >= 1
ABresult
0X0
100
111
1215 0 $self->Error;
1216 0 return;
1217 }
1218  
1219 0 ▶ if ($args->[0] eq 'prepare') {
Branch: 5 branches
BranchTrueFalseTotal
if ($args->[0] eq 'prepare') { } 0 0 0
elsif ($args->[0] eq 'commit') { } 0 0 0
elsif ($args->[0] eq 'rollback') { } 0 0 0
elsif ($args->[0] eq 'done') { } 0 0 0
elsif ($args->[0] eq 'list') { } 0 0 0
1220 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1221 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1222 0 my @repositories;
1223 0 my $skip = 1;
1224
1225 0 foreach (@$args) {
1226 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1227 0 $skip--;
1228 0 next;
1229 }
1230
1231 0 push(@repositories, { name => $_ });
1232 }
1233
1234 0 weaken($self);
1235 $opendnssec->UpdateEnforcerBackupPrepare({
1236 repository => \@repositories
1237 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1238 0 my ($call, $response) = @_;
1239
1240 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1241 0 undef($opendnssec);
1242 0 return;
1243 }
1244
1245 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1246 0 $self->cli->println('Backup prepared');
1247 0 $self->Successful;
1248 }
1249 else {
1250 0 $self->Error($call->Error);
1251 }
1252 0 undef($opendnssec);
1253 0 });
1254 0 return;
1255 }
1256 else {
1257 0 weaken($self);
1258 0 ▶ $opendnssec->UpdateEnforcerBackupPrepare(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1259 0 my ($call, $response) = @_;
1260
1261 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1262 0 undef($opendnssec);
1263 0 return;
1264 }
1265
1266 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1267 0 $self->cli->println('Backup prepared');
1268 0 $self->Successful;
1269 }
1270 else {
1271 0 $self->Error($call->Error);
1272 }
1273 0 undef($opendnssec);
1274 0 });
1275 0 return;
1276 }
1277 }
1278 elsif ($args->[0] eq 'commit') {
1279 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1280 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1281 0 my @repositories;
1282 0 my $skip = 1;
1283
1284 0 foreach (@$args) {
1285 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1286 0 $skip--;
1287 0 next;
1288 }
1289
1290 0 push(@repositories, { name => $_ });
1291 }
1292
1293 0 weaken($self);
1294 $opendnssec->UpdateEnforcerBackupCommit({
1295 repository => \@repositories
1296 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1297 0 my ($call, $response) = @_;
1298
1299 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1300 0 undef($opendnssec);
1301 0 return;
1302 }
1303
1304 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1305 0 $self->cli->println('Backup committed');
1306 0 $self->Successful;
1307 }
1308 else {
1309 0 $self->Error($call->Error);
1310 }
1311 0 undef($opendnssec);
1312 0 });
1313 0 return;
1314 }
1315 else {
1316 0 weaken($self);
1317 0 ▶ $opendnssec->UpdateEnforcerBackupCommit(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1318 0 my ($call, $response) = @_;
1319
1320 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1321 0 undef($opendnssec);
1322 0 return;
1323 }
1324
1325 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1326 0 $self->cli->println('Backup committed');
1327 0 $self->Successful;
1328 }
1329 else {
1330 0 $self->Error($call->Error);
1331 }
1332 0 undef($opendnssec);
1333 0 });
1334 0 return;
1335 }
1336 }
1337 elsif ($args->[0] eq 'rollback') {
1338 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1339 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1340 0 my @repositories;
1341 0 my $skip = 1;
1342
1343 0 foreach (@$args) {
1344 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1345 0 $skip--;
1346 0 next;
1347 }
1348
1349 0 push(@repositories, { name => $_ });
1350 }
1351
1352 0 weaken($self);
1353 $opendnssec->UpdateEnforcerBackupRollback({
1354 repository => \@repositories
1355 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1356 0 my ($call, $response) = @_;
1357
1358 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1359 0 undef($opendnssec);
1360 0 return;
1361 }
1362
1363 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1364 0 $self->cli->println('Backup rollbacked');
1365 0 $self->Successful;
1366 }
1367 else {
1368 0 $self->Error($call->Error);
1369 }
1370 0 undef($opendnssec);
1371 0 });
1372 0 return;
1373 }
1374 else {
1375 0 weaken($self);
1376 0 ▶ $opendnssec->UpdateEnforcerBackupRollback(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1377 0 my ($call, $response) = @_;
1378
1379 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1380 0 undef($opendnssec);
1381 0 return;
1382 }
1383
1384 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1385 0 $self->cli->println('Backup rollbacked');
1386 0 $self->Successful;
1387 }
1388 else {
1389 0 $self->Error($call->Error);
1390 }
1391 0 undef($opendnssec);
1392 0 });
1393 0 return;
1394 }
1395 }
1396 elsif ($args->[0] eq 'done') {
1397 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1398 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1399 0 my @repositories;
1400 0 my $skip = 1;
1401
1402 0 foreach (@$args) {
1403 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1404 0 $skip--;
1405 0 next;
1406 }
1407
1408 0 push(@repositories, { name => $_ });
1409 }
1410
1411 0 weaken($self);
1412 $opendnssec->UpdateEnforcerBackupDone({
1413 repository => \@repositories
1414 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1415 0 my ($call, $response) = @_;
1416
1417 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1418 0 undef($opendnssec);
1419 0 return;
1420 }
1421
1422 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1423 0 $self->cli->println('Backup done');
1424 0 $self->Successful;
1425 }
1426 else {
1427 0 $self->Error($call->Error);
1428 }
1429 0 undef($opendnssec);
1430 0 });
1431 0 return;
1432 }
1433 else {
1434 0 weaken($self);
1435 0 ▶ $opendnssec->UpdateEnforcerBackupDone(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1436 0 my ($call, $response) = @_;
1437
1438 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1439 0 undef($opendnssec);
1440 0 return;
1441 }
1442
1443 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1444 0 $self->cli->println('Backup done');
1445 0 $self->Successful;
1446 }
1447 else {
1448 0 $self->Error($call->Error);
1449 }
1450 0 undef($opendnssec);
1451 0 });
1452 0 return;
1453 }
1454 }
1455 elsif ($args->[0] eq 'list') {
1456 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1457 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1458 0 my @repositories;
1459 0 my $skip = 1;
1460
1461 0 foreach (@$args) {
1462 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1463 0 $skip--;
1464 0 next;
1465 }
1466
1467 0 push(@repositories, { name => $_ });
1468 }
1469
1470 0 weaken($self);
1471 $opendnssec->ReadEnforcerBackupList({
1472 repository => \@repositories
1473 0 ▶ }, sub {
Subroutine __ANON__: not called CC=13 SCAR=52.0
1474 0 my ($call, $response) = @_;
1475
1476 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1477 0 undef($opendnssec);
1478 0 return;
1479 }
1480
1481 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1482 0 ▶ if (exists $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'repository'}) { } 0 0 0
1483 0 $self->cli->println(join("\t", 'Repository', 'Last Backup', 'Unbacked Up Keys', 'Prepared Keys'));
1484 0 ▶ foreach my $repository (ref($response->{repository}) eq 'ARRAY' ? @{$response->{repository}} : $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'repository'} eq 'ARRAY' ? : 0 0 0
1485 0 my $backup = 'NONE';
1486
1487 0 ▶ if (exists $repository->{backup}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $repository->{"backup"}) 0 0 0
1488 0 ▶ if (ref($repository->{backup}) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $repository->{'backup'} eq 'ARRAY') { } 0 0 0
1489 0 foreach (sort {$b->{date} cmp $a->{date}} @{$repository->{backup}}) {
1490 0 $backup = $_;
1491 0 last;
1492 }
1493 }
1494 else {
1495 0 $backup = $repository->{backup};
1496 }
1497 }
1498
1499 $self->cli->println(join("\t",
1500 $repository->{name},
1501 $backup,
1502 exists $repository->{unbacked_up_keys} and $repository->{unbacked_up_keys} ? 'Yes' : 'No',
1503 0 ▶ exists $repository->{prepared_keys} and $repository->{prepared_keys} ? 'Yes' : 'No'
Branch: 2 branches
BranchTrueFalseTotal
$repository->{'unbacked_up_keys'} ? : 0 0 0
$repository->{'prepared_keys'} ? : 0 0 0
Condition0%0/6
('???', $repository->{'name'}, $backup, exists $repository->{'unbacked_up_keys'}) && ($repository->{'unbacked_up_keys'} ? '???' : '???', exists $repository->{'prepared_keys'}) && ($repository->{'prepared_keys'} ? 'Yes' : 'No')
!ll&&!rl&&r
000
'???', $repository->{"name"}, $backup, exists $repository->{"unbacked_up_keys"} and $repository->{"unbacked_up_keys"} ? '???' : '???', exists $repository->{"prepared_keys"}
!ll&&!rl&&r
000
MC/DC0%0/3
('???', $repository->{'name'}, $backup, exists $repository->{'unbacked_up_keys'}) && ($repository->{'unbacked_up_keys'} ? '???' : '???', exists $repository->{'prepared_keys'}) && ($repository->{'prepared_keys'} ? 'Yes' : 'No')
'???', $repository->{"name"}, $backup, exists $repository->{"unbacked_up_keys"} $repository->{"unbacked_up_keys"} ? '???' : '???', exists $repository->{"prepared_keys"} ($repository->{'prepared_keys'} ? 'Yes' : 'No')
Truth table0%0/4
A and B && C
A= '???', $repository->{"name"}, $backup, exists $repository->{"unbacked_up_keys"}B= $repository->{"unbacked_up_keys"} ? '???' : '???', exists $repository->{"prepared_keys"}C= ($repository->{'prepared_keys'} ? 'Yes' : 'No')
ABCresult
0XX0
10X0
1100
1111
1504 ));
1505 }
1506 }
1507 else {
1508 0 $self->cli->println('There are no backups');
1509 }
1510 0 $self->Successful;
1511 }
1512 else {
1513 0 $self->Error($call->Error);
1514 }
1515 0 undef($opendnssec);
1516 0 });
1517 0 return;
1518 }
1519 else {
1520 0 weaken($self);
1521 0 ▶ $opendnssec->ReadEnforcerBackupList(sub {
Subroutine __ANON__: not called CC=13 SCAR=52.0
1522 0 my ($call, $response) = @_;
1523
1524 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1525 0 undef($opendnssec);
1526 0 return;
1527 }
1528
1529 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1530 0 ▶ if (exists $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'repository'}) { } 0 0 0
1531 0 $self->cli->println(join("\t", 'Repository', 'Last Backup', 'Unbacked Up Keys', 'Prepared Keys'));
1532 0 ▶ foreach my $repository (ref($response->{repository}) eq 'ARRAY' ? @{$response->{repository}} : $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'repository'} eq 'ARRAY' ? : 0 0 0
1533 0 my $backup = 'NONE';
1534
1535 0 ▶ if (exists $repository->{backup}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $repository->{"backup"}) 0 0 0
1536 0 ▶ if (ref($repository->{backup}) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $repository->{'backup'} eq 'ARRAY') { } 0 0 0
1537 0 foreach (sort {$b->{date} cmp $a->{date}} @{$repository->{backup}}) {
1538 0 $backup = $_->{date};
1539 0 last;
1540 }
1541 }
1542 else {
1543 0 $backup = $repository->{backup}->{date};
1544 }
1545 }
1546
1547 $self->cli->println(join("\t",
1548 $repository->{name},
1549 $backup,
1550 ((exists $repository->{unbacked_up_keys} and $repository->{unbacked_up_keys}) ? 'Yes' : 'No'),
1551 0 ▶ ((exists $repository->{prepared_keys} and $repository->{prepared_keys}) ? 'Yes' : 'No')
Branch: 2 branches
BranchTrueFalseTotal
exists $repository->{'unbacked_up_keys'} && $repository->{'unbacked_up_keys'} ? : 0 0 0
exists $repository->{'prepared_keys'} && $repository->{'prepared_keys'} ? : 0 0 0
Condition0%0/6
exists $repository->{"unbacked_up_keys"} and $repository->{"unbacked_up_keys"}
!ll&&!rl&&r
000
exists $repository->{"prepared_keys"} and $repository->{"prepared_keys"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $repository->{"unbacked_up_keys"} and $repository->{"unbacked_up_keys"}
exists $repository->{"unbacked_up_keys"} $repository->{"unbacked_up_keys"}
MC/DC0%0/2
exists $repository->{"prepared_keys"} and $repository->{"prepared_keys"}
exists $repository->{"prepared_keys"} $repository->{"prepared_keys"}
Truth table0%0/3
A and B
A= exists $repository->{"unbacked_up_keys"}B= $repository->{"unbacked_up_keys"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $repository->{"prepared_keys"}B= $repository->{"prepared_keys"}
ABresult
0X0
100
111
1552 ));
1553 }
1554 }
1555 else {
1556 0 $self->cli->println('There are no backups');
1557 }
1558 0 $self->Successful;
1559 }
1560 else {
1561 0 $self->Error($call->Error);
1562 }
1563 0 undef($opendnssec);
1564 0 });
1565 0 return;
1566 }
1567 }
1568 0 $self->Error;
1569 }
1570  
1571 =head2 rollover
1572  
1573 =cut
1574  
1575 0 ▶sub rollover {
Subroutine rollover: not called CC=7 SCAR=40.3
Pod documented
1576 0 my ($self, $cmd) = @_;
1577 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
1578
1579 0 ▶ unless ($getopt and scalar @$args >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args >= 1) 0 0 0
Condition0%0/3
$getopt and scalar @$args >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$getopt and scalar @$args >= 1
$getopt scalar @$args >= 1
Truth table0%0/3
A and B
A= $getoptB= scalar @$args >= 1
ABresult
0X0
100
111
1580 0 $self->Error;
1581 0 return;
1582 }
1583  
1584 0 ▶ if ($args->[0] eq 'list') {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->[0] eq "list") 0 0 0
1585 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1586 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1587 0 my @zones;
1588 0 my $skip = 1;
1589
1590 0 foreach (@$args) {
1591 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1592 0 $skip--;
1593 0 next;
1594 }
1595
1596 0 push(@zones, { name => $_ });
1597 }
1598
1599 0 weaken($self);
1600 $opendnssec->ReadEnforcerRolloverList({
1601 zone => \@zones
1602 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
1603 0 my ($call, $response) = @_;
1604
1605 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1606 0 undef($opendnssec);
1607 0 return;
1608 }
1609
1610 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1611 0 ▶ if (exists $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'zone'}) { } 0 0 0
1612 0 $self->cli->println(join("\t", 'Zone', 'Keytype', 'Rollover Expected'));
1613 0 ▶ foreach my $zone (ref($response->{zone}) eq 'ARRAY' ? @{$response->{zone}} : $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'zone'} eq 'ARRAY' ? : 0 0 0
1614 $self->cli->println(join("\t",
1615 $zone->{name},
1616 $zone->{keytype},
1617 $zone->{rollover_expected}
1618 0 ));
1619 }
1620 }
1621 else {
1622 0 $self->cli->println('There are no rollovers expected');
1623 }
1624 0 $self->Successful;
1625 }
1626 else {
1627 0 $self->Error($call->Error);
1628 }
1629 0 undef($opendnssec);
1630 0 });
1631 0 return;
1632 }
1633 else {
1634 0 weaken($self);
1635 0 ▶ $opendnssec->ReadEnforcerRolloverList(sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
1636 0 my ($call, $response) = @_;
1637
1638 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1639 0 undef($opendnssec);
1640 0 return;
1641 }
1642
1643 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1644 0 ▶ if (exists $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'zone'}) { } 0 0 0
1645 0 $self->cli->println(join("\t", 'Zone', 'Keytype', 'Rollover Expected'));
1646 0 ▶ foreach my $zone (ref($response->{zone}) eq 'ARRAY' ? @{$response->{zone}} : $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'zone'} eq 'ARRAY' ? : 0 0 0
1647 $self->cli->println(join("\t",
1648 $zone->{name},
1649 $zone->{keytype},
1650 $zone->{rollover_expected}
1651 0 ));
1652 }
1653 }
1654 else {
1655 0 $self->cli->println('There are no rollovers expected');
1656 }
1657 0 $self->Successful;
1658 }
1659 else {
1660 0 $self->Error($call->Error);
1661 }
1662 0 undef($opendnssec);
1663 0 });
1664 0 return;
1665 }
1666 }
1667 0 $self->Error;
1668 }
1669  
1670 =head2 database
1671  
1672 =cut
1673  
1674 0 ▶sub database {
Subroutine database: not called CC=4 SCAR=30.0
Pod documented
1675 0 my ($self, $cmd) = @_;
1676 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
1677
1678 0 ▶ unless ($getopt and scalar @$args == 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args == 1) 0 0 0
Condition0%0/3
$getopt and scalar @$args == 1
!ll&&!rl&&r
000
MC/DC0%0/2
$getopt and scalar @$args == 1
$getopt scalar @$args == 1
Truth table0%0/3
A and B
A= $getoptB= scalar @$args == 1
ABresult
0X0
100
111
1679 0 $self->Error;
1680 0 return;
1681 }
1682  
1683 0 ▶ if ($args->[0] eq 'backup') {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->[0] eq "backup") 0 0 0
1684 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1685 0 weaken($self);
1686 0 ▶ $opendnssec->CreateEnforcerDatabaseBackup(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1687 0 my ($call, $response) = @_;
1688
1689 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1690 0 undef($opendnssec);
1691 0 return;
1692 }
1693
1694 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1695 0 $self->cli->println('Database backed up');
1696 0 $self->Successful;
1697 }
1698 else {
1699 0 $self->Error($call->Error);
1700 }
1701 0 undef($opendnssec);
1702 0 });
1703 0 return;
1704 }
1705 0 $self->Error;
1706 }
1707  
1708 =head2 zonelist
1709  
1710 =cut
1711  
1712 0 ▶sub zonelist {
Subroutine zonelist: not called CC=4 SCAR=30.0
Pod documented
1713 0 my ($self, $cmd) = @_;
1714 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
1715
1716 0 ▶ unless ($getopt and scalar @$args == 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args == 1) 0 0 0
Condition0%0/3
$getopt and scalar @$args == 1
!ll&&!rl&&r
000
MC/DC0%0/2
$getopt and scalar @$args == 1
$getopt scalar @$args == 1
Truth table0%0/3
A and B
A= $getoptB= scalar @$args == 1
ABresult
0X0
100
111
1717 0 $self->Error;
1718 0 return;
1719 }
1720  
1721 0 ▶ if ($args->[0] eq 'export') {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->[0] eq "export") 0 0 0
1722 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1723 0 weaken($self);
1724 0 ▶ $opendnssec->ReadEnforcerZonelistExport(sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
1725 0 my ($call, $response) = @_;
1726
1727 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1728 0 undef($opendnssec);
1729 0 return;
1730 }
1731
1732 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1733 0 ▶ if (exists $response->{zonelist}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'zonelist'}) { } 0 0 0
1734 0 $self->cli->println('Zonelist:');
1735 0 $self->cli->println($response->{zonelist});
1736 }
1737 else {
1738 0 $self->cli->println('No zonelist received');
1739 }
1740 0 $self->Successful;
1741 }
1742 else {
1743 0 $self->Error($call->Error);
1744 }
1745 0 undef($opendnssec);
1746 0 });
1747 0 return;
1748 }
1749 0 $self->Error;
1750 }
1751  
1752 =head2 signer
1753  
1754 =cut
1755  
1756 0 ▶sub signer {
Subroutine signer: not called CC=23 SCAR=63.1
Pod documented
1757 0 my ($self, $cmd) = @_;
1758 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
1759
1760 0 ▶ unless ($getopt and scalar @$args >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args >= 1) 0 0 0
Condition0%0/3
$getopt and scalar @$args >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$getopt and scalar @$args >= 1
$getopt scalar @$args >= 1
Truth table0%0/3
A and B
A= $getoptB= scalar @$args >= 1
ABresult
0X0
100
111
1761 0 $self->Error;
1762 0 return;
1763 }
1764  
1765 0 ▶ if ($args->[0] eq 'zones') {
Branch: 9 branches
BranchTrueFalseTotal
if ($args->[0] eq 'zones') { } 0 0 0
elsif ($args->[0] eq 'sign') { } 0 0 0
elsif ($args->[0] eq 'clear' and scalar @$args > 1) { } 0 0 0
elsif ($args->[0] eq 'queue') { } 0 0 0
elsif ($args->[0] eq 'flush') { } 0 0 0
elsif ($args->[0] eq 'update') { } 0 0 0
elsif ($args->[0] eq 'running') { } 0 0 0
elsif ($args->[0] eq 'reload') { } 0 0 0
elsif ($args->[0] eq 'verbosity' and scalar @$args == 2 and $args->[1] =~ /^\d+$/ou) { } 0 0 0
1766 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1767 0 weaken($self);
1768 0 ▶ $opendnssec->ReadSignerZones(sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
1769 0 my ($call, $response) = @_;
1770
1771 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1772 0 undef($opendnssec);
1773 0 return;
1774 }
1775
1776 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1777 0 ▶ if (exists $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'zone'}) { } 0 0 0
1778 0 $self->cli->println('Signer Zones:');
1779 0 ▶ foreach my $zone (ref($response->{zone}) eq 'ARRAY' ? @{$response->{zone}} : $response->{zone}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'zone'} eq 'ARRAY' ? : 0 0 0
1780 0 $self->cli->println($zone->{name});
1781 }
1782 }
1783 else {
1784 0 $self->cli->println('No zones in Signer');
1785 }
1786 0 $self->Successful;
1787 }
1788 else {
1789 0 $self->Error($call->Error);
1790 }
1791 0 undef($opendnssec);
1792 0 });
1793 0 return;
1794 }
1795 elsif ($args->[0] eq 'sign') {
1796 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1797 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1798 0 my @zones;
1799 0 my $skip = 1;
1800
1801 0 foreach (@$args) {
1802 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1803 0 $skip--;
1804 0 next;
1805 }
1806
1807 0 push(@zones, { name => $_ });
1808 }
1809
1810 0 weaken($self);
1811 $opendnssec->UpdateSignerSign({
1812 zone => \@zones
1813 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1814 0 my ($call, $response) = @_;
1815
1816 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1817 0 undef($opendnssec);
1818 0 return;
1819 }
1820
1821 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1822 0 $self->cli->println('Sign issued');
1823 0 $self->Successful;
1824 }
1825 else {
1826 0 $self->Error($call->Error);
1827 }
1828 0 undef($opendnssec);
1829 0 });
1830 0 return;
1831 }
1832 else {
1833 0 weaken($self);
1834 0 ▶ $opendnssec->UpdateSignerSign(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1835 0 my ($call, $response) = @_;
1836
1837 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1838 0 undef($opendnssec);
1839 0 return;
1840 }
1841
1842 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1843 0 $self->cli->println('Sign issued');
1844 0 $self->Successful;
1845 }
1846 else {
1847 0 $self->Error($call->Error);
1848 }
1849 0 undef($opendnssec);
1850 0 });
1851 0 return;
1852 }
1853 }
1854 ▶ elsif ($args->[0] eq 'clear' and scalar @$args > 1) {
Condition0%0/3
$args->[0] eq "clear" and scalar @$args > 1
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "clear" and scalar @$args > 1
$args->[0] eq "clear" scalar @$args > 1
Truth table0%0/3
A and B
A= $args->[0] eq "clear"B= scalar @$args > 1
ABresult
0X0
100
111
1855 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1856 0 my @zones;
1857 0 my $skip = 1;
1858
1859 0 foreach (@$args) {
1860 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1861 0 $skip--;
1862 0 next;
1863 }
1864
1865 0 push(@zones, { name => $_ });
1866 }
1867
1868 0 weaken($self);
1869 $opendnssec->UpdateSignerClear({
1870 zone => \@zones
1871 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1872 0 my ($call, $response) = @_;
1873
1874 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1875 0 undef($opendnssec);
1876 0 return;
1877 }
1878
1879 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1880 0 $self->cli->println('Clear issued');
1881 0 $self->Successful;
1882 }
1883 else {
1884 0 $self->Error($call->Error);
1885 }
1886 0 undef($opendnssec);
1887 0 });
1888 0 return;
1889 }
1890 elsif ($args->[0] eq 'queue') {
1891 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1892 0 weaken($self);
1893 0 ▶ $opendnssec->ReadSignerQueue(sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
1894 0 my ($call, $response) = @_;
1895
1896 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1897 0 undef($opendnssec);
1898 0 return;
1899 }
1900
1901 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1902 0 ▶ if (exists $response->{task}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"task"}) 0 0 0
1903 0 ▶ if (exists $response->{now}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"now"}) 0 0 0
1904 0 $self->cli->println('Now: ', $response->{now});
1905 }
1906 0 $self->cli->println(join("\t", 'On', 'Task', 'Zone'));
1907 0 ▶ foreach my $task (ref($response->{task}) eq 'ARRAY' ? @{$response->{task}} : $response->{task}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'task'} eq 'ARRAY' ? : 0 0 0
1908 $self->cli->println(join("\t",
1909 $task->{date},
1910 $task->{type},
1911 $task->{zone}
1912 0 ));
1913 }
1914 }
1915 0 $self->Successful;
1916 }
1917 else {
1918 0 $self->Error($call->Error);
1919 }
1920 0 undef($opendnssec);
1921 0 });
1922 0 return;
1923 }
1924 elsif ($args->[0] eq 'flush') {
1925 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1926 0 weaken($self);
1927 0 ▶ $opendnssec->UpdateSignerFlush(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1928 0 my ($call, $response) = @_;
1929
1930 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1931 0 undef($opendnssec);
1932 0 return;
1933 }
1934
1935 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1936 0 $self->cli->println('Flush issued');
1937 0 $self->Successful;
1938 }
1939 else {
1940 0 $self->Error($call->Error);
1941 }
1942 0 undef($opendnssec);
1943 0 });
1944 0 return;
1945 }
1946 elsif ($args->[0] eq 'update') {
1947 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
1948 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
1949 0 my @zones;
1950 0 my $skip = 1;
1951
1952 0 foreach (@$args) {
1953 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
1954 0 $skip--;
1955 0 next;
1956 }
1957
1958 0 push(@zones, { name => $_ });
1959 }
1960
1961 0 weaken($self);
1962 $opendnssec->UpdateSignerUpdate({
1963 zone => \@zones
1964 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1965 0 my ($call, $response) = @_;
1966
1967 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1968 0 undef($opendnssec);
1969 0 return;
1970 }
1971
1972 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1973 0 $self->cli->println('Update issued');
1974 0 $self->Successful;
1975 }
1976 else {
1977 0 $self->Error($call->Error);
1978 }
1979 0 undef($opendnssec);
1980 0 });
1981 0 return;
1982 }
1983 else {
1984 0 weaken($self);
1985 0 ▶ $opendnssec->UpdateSignerUpdate(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1986 0 my ($call, $response) = @_;
1987
1988 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
1989 0 undef($opendnssec);
1990 0 return;
1991 }
1992
1993 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
1994 0 $self->cli->println('Update issued');
1995 0 $self->Successful;
1996 }
1997 else {
1998 0 $self->Error($call->Error);
1999 }
2000 0 undef($opendnssec);
2001 0 });
2002 0 return;
2003 }
2004 }
2005 elsif ($args->[0] eq 'running') {
2006 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2007 0 weaken($self);
2008 0 ▶ $opendnssec->ReadSignerRunning(sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
2009 0 my ($call, $response) = @_;
2010
2011 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2012 0 undef($opendnssec);
2013 0 return;
2014 }
2015
2016 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2017 0 ▶ if ($response->{running}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{'running'}) { } 0 0 0
2018 0 $self->cli->println('Signer is running');
2019 }
2020 else {
2021 0 $self->cli->println('Signer is not running');
2022 }
2023 0 $self->Successful;
2024 }
2025 else {
2026 0 $self->Error($call->Error);
2027 }
2028 0 undef($opendnssec);
2029 0 });
2030 0 return;
2031 }
2032 elsif ($args->[0] eq 'reload') {
2033 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2034 0 weaken($self);
2035 0 ▶ $opendnssec->UpdateSignerReload(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2036 0 my ($call, $response) = @_;
2037
2038 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2039 0 undef($opendnssec);
2040 0 return;
2041 }
2042
2043 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2044 0 $self->cli->println('Reload issued');
2045 0 $self->Successful;
2046 }
2047 else {
2048 0 $self->Error($call->Error);
2049 }
2050 0 undef($opendnssec);
2051 0 });
2052 0 return;
2053 }
2054 ▶ elsif ($args->[0] eq 'verbosity' and scalar @$args == 2 and $args->[1] =~ /^\d+$/o) {
Condition0%0/6
$args->[0] eq "verbosity" and scalar @$args == 2 and $args->[1] =~ /^\d+$/ou
!ll&&!rl&&r
000
$args->[0] eq "verbosity" and scalar @$args == 2
!ll&&!rl&&r
000
MC/DC0%0/3
$args->[0] eq "verbosity" and scalar @$args == 2 and $args->[1] =~ /^\d+$/ou
$args->[0] eq "verbosity" scalar @$args == 2 $args->[1] =~ /^\d+$/ou
Truth table0%0/4
A and B and C
A= $args->[0] eq "verbosity"B= scalar @$args == 2C= $args->[1] =~ /^\d+$/ou
ABCresult
0XX0
10X0
1100
1111
2055 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2056 0 weaken($self);
2057 $opendnssec->UpdateSignerVerbosity({
2058 verbosity => $args->[1]
2059 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2060 0 my ($call, $response) = @_;
2061
2062 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2063 0 undef($opendnssec);
2064 0 return;
2065 }
2066
2067 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2068 0 $self->cli->println('Verbosity issued');
2069 0 $self->Successful;
2070 }
2071 else {
2072 0 $self->Error($call->Error);
2073 }
2074 0 undef($opendnssec);
2075 0 });
2076 0 return;
2077 }
2078 0 $self->Error;
2079 }
2080  
2081 =head2 hsm
2082  
2083 =cut
2084  
2085 0 ▶sub hsm {
Subroutine hsm: not called CC=24 SCAR=64.0
Pod documented
2086 0 my ($self, $cmd) = @_;
2087 0 my ($getopt, $args) = Getopt::Long::GetOptionsFromString($cmd);
2088
2089 0 ▶ unless ($getopt and scalar @$args >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($getopt and scalar @$args >= 1) 0 0 0
Condition0%0/3
$getopt and scalar @$args >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$getopt and scalar @$args >= 1
$getopt scalar @$args >= 1
Truth table0%0/3
A and B
A= $getoptB= scalar @$args >= 1
ABresult
0X0
100
111
2090 0 $self->Error;
2091 0 return;
2092 }
2093  
2094 0 ▶ if ($args->[0] eq 'list') {
Branch: 7 branches
BranchTrueFalseTotal
if ($args->[0] eq 'list') { } 0 0 0
elsif ($args->[0] eq 'generate' and scalar @$args == 3) { } 0 0 0
elsif ($args->[0] eq 'remove' and scalar @$args > 1) { } 0 0 0
elsif ($args->[0] eq 'purge' and scalar @$args > 1) { } 0 0 0
elsif ($args->[0] eq 'dnskey' and scalar @$args == 3) { } 0 0 0
elsif ($args->[0] eq 'test' and scalar @$args > 1) { } 0 0 0
elsif ($args->[0] eq 'info') { } 0 0 0
2095 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2096 0 ▶ if (scalar @$args > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$args > 1) { } 0 0 0
2097 0 my @repositories;
2098 0 my $skip = 1;
2099
2100 0 foreach (@$args) {
2101 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
2102 0 $skip--;
2103 0 next;
2104 }
2105
2106 0 push(@repositories, { name => $_ });
2107 }
2108
2109 0 weaken($self);
2110 $opendnssec->ReadHsmList({
2111 repository => \@repositories
2112 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
2113 0 my ($call, $response) = @_;
2114
2115 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2116 0 undef($opendnssec);
2117 0 return;
2118 }
2119
2120 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2121 0 ▶ if (exists $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"key"}) 0 0 0
2122 0 $self->cli->println(join("\t", 'Repository', 'ID', 'Keytype', 'Keysize'));
2123 0 ▶ foreach my $key (ref($response->{key}) eq 'ARRAY' ? @{$response->{key}} : $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'key'} eq 'ARRAY' ? : 0 0 0
2124 $self->cli->println(join("\t",
2125 $key->{repository},
2126 $key->{id},
2127 $key->{keytype},
2128 $key->{keysize}
2129 0 ));
2130 }
2131 }
2132 0 $self->Successful;
2133 }
2134 else {
2135 0 $self->Error($call->Error);
2136 }
2137 0 undef($opendnssec);
2138 0 });
2139 0 return;
2140 }
2141 else {
2142 0 weaken($self);
2143 0 ▶ $opendnssec->ReadHsmList(sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
2144 0 my ($call, $response) = @_;
2145
2146 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2147 0 undef($opendnssec);
2148 0 return;
2149 }
2150
2151 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2152 0 ▶ if (exists $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"key"}) 0 0 0
2153 0 $self->cli->println(join("\t", 'Repository', 'ID', 'Keytype', 'Keysize'));
2154 0 ▶ foreach my $key (ref($response->{key}) eq 'ARRAY' ? @{$response->{key}} : $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'key'} eq 'ARRAY' ? : 0 0 0
2155 $self->cli->println(join("\t",
2156 $key->{repository},
2157 $key->{id},
2158 $key->{keytype},
2159 $key->{keysize}
2160 0 ));
2161 }
2162 }
2163 0 $self->Successful;
2164 }
2165 else {
2166 0 $self->Error($call->Error);
2167 }
2168 0 undef($opendnssec);
2169 0 });
2170 0 return;
2171 }
2172 }
2173 ▶ elsif ($args->[0] eq 'generate' and scalar @$args == 3) {
Condition0%0/3
$args->[0] eq "generate" and scalar @$args == 3
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "generate" and scalar @$args == 3
$args->[0] eq "generate" scalar @$args == 3
Truth table0%0/3
A and B
A= $args->[0] eq "generate"B= scalar @$args == 3
ABresult
0X0
100
111
2174 0 my (undef, $repository, $keysize) = @$args;
2175 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2176 0 weaken($self);
2177 $opendnssec->CreateHsmGenerate({
2178 key => {
2179 repository => $repository,
2180 keysize => $keysize
2181 }
2182 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
2183 0 my ($call, $response) = @_;
2184
2185 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2186 0 undef($opendnssec);
2187 0 return;
2188 }
2189
2190 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2191 0 ▶ if (exists $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"key"}) 0 0 0
2192 0 $self->cli->println(join("\t", 'Repository', 'ID', 'Keytype', 'Keysize'));
2193 0 ▶ foreach my $key (ref($response->{key}) eq 'ARRAY' ? @{$response->{key}} : $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'key'} eq 'ARRAY' ? : 0 0 0
2194 $self->cli->println(join("\t",
2195 $key->{repository},
2196 $key->{id},
2197 $key->{keytype},
2198 $key->{keysize}
2199 0 ));
2200 }
2201 }
2202 0 $self->Successful;
2203 }
2204 else {
2205 0 $self->Error($call->Error);
2206 }
2207 0 undef($opendnssec);
2208 0 });
2209 0 return;
2210 }
2211 ▶ elsif ($args->[0] eq 'remove' and scalar @$args > 1) {
Condition0%0/3
$args->[0] eq "remove" and scalar @$args > 1
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "remove" and scalar @$args > 1
$args->[0] eq "remove" scalar @$args > 1
Truth table0%0/3
A and B
A= $args->[0] eq "remove"B= scalar @$args > 1
ABresult
0X0
100
111
2212 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2213 0 my @keys;
2214 0 my $skip = 1;
2215
2216 0 foreach (@$args) {
2217 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
2218 0 $skip--;
2219 0 next;
2220 }
2221
2222 0 push(@keys, { id => $_ });
2223 }
2224
2225 0 weaken($self);
2226 $opendnssec->DeleteHsmRemove({
2227 key => \@keys
2228 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2229 0 my ($call, $response) = @_;
2230
2231 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2232 0 undef($opendnssec);
2233 0 return;
2234 }
2235
2236 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2237 0 $self->cli->println('Key(s) removed');
2238 0 $self->Successful;
2239 }
2240 else {
2241 0 $self->Error($call->Error);
2242 }
2243 0 undef($opendnssec);
2244 0 });
2245 0 return;
2246 }
2247 ▶ elsif ($args->[0] eq 'purge' and scalar @$args > 1) {
Condition0%0/3
$args->[0] eq "purge" and scalar @$args > 1
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "purge" and scalar @$args > 1
$args->[0] eq "purge" scalar @$args > 1
Truth table0%0/3
A and B
A= $args->[0] eq "purge"B= scalar @$args > 1
ABresult
0X0
100
111
2248 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2249 0 my @repositories;
2250 0 my $skip = 1;
2251
2252 # TODO ask user
2253
2254 0 foreach (@$args) {
2255 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
2256 0 $skip--;
2257 0 next;
2258 }
2259
2260 0 push(@repositories, { name => $_ });
2261 }
2262
2263 0 weaken($self);
2264 $opendnssec->DeleteHsmPurge({
2265 repository => \@repositories
2266 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2267 0 my ($call, $response) = @_;
2268
2269 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2270 0 undef($opendnssec);
2271 0 return;
2272 }
2273
2274 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2275 0 $self->cli->println('Repositories purged');
2276 0 $self->Successful;
2277 }
2278 else {
2279 0 $self->Error($call->Error);
2280 }
2281 0 undef($opendnssec);
2282 0 });
2283 0 return;
2284 }
2285 ▶ elsif ($args->[0] eq 'dnskey' and scalar @$args == 3) {
Condition0%0/3
$args->[0] eq "dnskey" and scalar @$args == 3
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "dnskey" and scalar @$args == 3
$args->[0] eq "dnskey" scalar @$args == 3
Truth table0%0/3
A and B
A= $args->[0] eq "dnskey"B= scalar @$args == 3
ABresult
0X0
100
111
2286 0 my (undef, $id, $name) = @$args;
2287 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2288 0 weaken($self);
2289 $opendnssec->CreateHsmDnskey({
2290 key => {
2291 id => $id,
2292 name => $name
2293 }
2294 0 ▶ }, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
2295 0 my ($call, $response) = @_;
2296
2297 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2298 0 undef($opendnssec);
2299 0 return;
2300 }
2301
2302 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2303 0 ▶ if (exists $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"key"}) 0 0 0
2304 0 $self->cli->println('DNSKEY Resource Record(s):');
2305 0 ▶ foreach my $key (ref($response->{key}) eq 'ARRAY' ? @{$response->{key}} : $response->{key}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'key'} eq 'ARRAY' ? : 0 0 0
2306 0 $self->cli->println($key->{rr});
2307 }
2308 }
2309 0 $self->Successful;
2310 }
2311 else {
2312 0 $self->Error($call->Error);
2313 }
2314 0 undef($opendnssec);
2315 0 });
2316 0 return;
2317 }
2318 ▶ elsif ($args->[0] eq 'test' and scalar @$args > 1) {
Condition0%0/3
$args->[0] eq "test" and scalar @$args > 1
!ll&&!rl&&r
000
MC/DC0%0/2
$args->[0] eq "test" and scalar @$args > 1
$args->[0] eq "test" scalar @$args > 1
Truth table0%0/3
A and B
A= $args->[0] eq "test"B= scalar @$args > 1
ABresult
0X0
100
111
2319 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2320 0 my @repositories;
2321 0 my $skip = 1;
2322
2323 0 foreach (@$args) {
2324 0 ▶ if ($skip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip) 0 0 0
2325 0 $skip--;
2326 0 next;
2327 }
2328
2329 0 push(@repositories, { name => $_ });
2330 }
2331
2332 0 weaken($self);
2333 $opendnssec->ReadHsmTest({
2334 repository => \@repositories
2335 0 ▶ }, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2336 0 my ($call, $response) = @_;
2337
2338 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2339 0 undef($opendnssec);
2340 0 return;
2341 }
2342
2343 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2344 0 $self->cli->println('Repositories successfully tested');
2345 0 $self->Successful;
2346 }
2347 else {
2348 0 $self->Error($call->Error);
2349 }
2350 0 undef($opendnssec);
2351 0 });
2352 0 return;
2353 }
2354 elsif ($args->[0] eq 'info') {
2355 0 my $opendnssec = Lim::Plugin::OpenDNSSEC->Client;
2356 0 weaken($self);
2357 0 ▶ $opendnssec->ReadHsmInfo(sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
2358 0 my ($call, $response) = @_;
2359
2360 0 ▶ unless (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self) 0 0 0
2361 0 undef($opendnssec);
2362 0 return;
2363 }
2364
2365 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
2366 0 ▶ if (exists $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{"repository"}) 0 0 0
2367 0 $self->cli->println(join("\t", 'Repository', 'Module', 'Slot', 'Token Label', 'Manufacturer', 'Model', 'Serial'));
2368 0 ▶ foreach my $repository (ref($response->{repository}) eq 'ARRAY' ? @{$response->{repository}} : $response->{repository}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $response->{'repository'} eq 'ARRAY' ? : 0 0 0
2369 $self->cli->println(join("\t",
2370 $repository->{name},
2371 $repository->{module},
2372 $repository->{slot},
2373 $repository->{token_label},
2374 $repository->{manufacturer},
2375 $repository->{model},
2376 $repository->{serial}
2377 0 ));
2378 }
2379 }
2380 0 $self->Successful;
2381 }
2382 else {
2383 0 $self->Error($call->Error);
2384 }
2385 0 undef($opendnssec);
2386 0 });
2387 0 return;
2388 }
2389 0 $self->Error;
2390 }
2391  
2392 =head1 AUTHOR
2393  
2394 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
2395  
2396 =head1 BUGS
2397  
2398 Please report any bugs or feature requests to L<https://github.com/jelu/lim-plugin-opendnssec/issues>.
2399  
2400 =head1 SUPPORT
2401  
2402 You can find documentation for this module with the perldoc command.
2403  
2404 perldoc Lim::Plugin::OpenDNSSEC
2405  
2406 You can also look for information at:
2407  
2408 =over 4
2409  
2410 =item * Lim issue tracker (report bugs here)
2411  
2412 L<https://github.com/jelu/lim-plugin-opendnssec/issues>
2413  
2414 =back
2415  
2416 =head1 ACKNOWLEDGEMENTS
2417  
2418 =head1 LICENSE AND COPYRIGHT
2419  
2420 Copyright 2012-2013 Jerry Lundström.
2421  
2422 This program is free software; you can redistribute it and/or modify it
2423 under the terms of either: the GNU General Public License as published
2424 by the Free Software Foundation; or the Artistic License.
2425  
2426 See http://dev.perl.org/licenses/ for more information.
2427  
2428  
2429 =cut
2430  
2431 1 1; # End of Lim::Plugin::OpenDNSSEC::CLI
↑ Summary OpenDNSSEC/Server.pm »