LDAP/Command/Add/Host.pm

filter: Statementstmt 73.0% 19 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 57.1% 24 / 42 CC 4 SCAR 22.5
CC
4
Cov
58%
run
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 9.4
« LDAP/Command/Add/Ou.pm ↑ Summary LDAP/Secret.pm »
1 package App::LDAP::Command::Add::Host;
2  
3 1 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 with qw( App::LDAP::Role::Command
8 App::LDAP::Role::Bindable );
9  
10 1 has base => (
11 is => "rw",
12 isa => "Str",
13 );
14  
15 1 ▶use Term::Prompt;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use App::LDAP::LDIF::Host;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 0 ▶sub run {
Subroutine run: not called CC=4 SCAR=30.0
Pod undocumented
20 0 my ($self) = shift;
21  
22 0 ▶ my $hostname = $self->extra_argv->[2] or die "no hostname specified";
Branch: 1 branch
BranchTrueFalseTotal
my $hostname = $self->extra_argv->[2] or die "no hostname specified" 0 0 0
23  
24 die "host $hostname already exists" if App::LDAP::LDIF::Host->search(
25 base => config()->{nss_base_hosts}->[0],
26 0 ▶ scope => config()->{nss_base_hosts}->[1],
Branch: 1 branch
BranchTrueFalseTotal
if "App::LDAP::LDIF::Host"->search("base", config()->{"nss_base_hosts"}[0], "scope", config()->{"nss_base_hosts"}[1], "filter", "cn=$hostname") 0 0 0
27 filter => "cn=$hostname",
28 );
29  
30 0 my $ip = prompt('x', 'ip address:', '', '');
31  
32 my $host = App::LDAP::LDIF::Host->new(
33 0 ▶ base => $self->base // config()->{nss_base_hosts}->[0],
Condition0%0/3
$self->base // config()->{"nss_base_hosts"}[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->base // config()->{"nss_base_hosts"}[0]
$self->base config()->{"nss_base_hosts"}[0]
Truth table0%0/3
A // B
A= $self->baseB= config()->{"nss_base_hosts"}[0]
ABresult
1X1
011
000
34 cn => [$hostname],
35 ipHostNumber => $ip,
36 );
37  
38 0 $host->save;
39  
40 0 $host;
41 }
42  
43 1 __PACKAGE__->meta->make_immutable;
44 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 1 1;
« LDAP/Command/Add/Ou.pm ↑ Summary LDAP/Secret.pm »