lib/Rex/Virtualization/Docker/info.pm

filter: Statementstmt 55.1% 16 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 52.5% 21 / 40 CC 3 SCAR 16.3
CC
3
Cov
48%
execute
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
« blib/lib/Rex/Interface/Fs/OpenSSH.pm ↑ Summary lib/Rex/Commands/SimpleCheck.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Virtualization::Docker::info;
6  
7 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.16.1'; # VERSION
11  
12 1 ▶use Rex::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Rex::Helper::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use JSON::MaybeXS;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 0 ▶sub execute {
Subroutine execute: not called CC=3 SCAR=24.8
Pod undocumented
17 0 my ( $class, $arg1 ) = @_;
18 0 my @dominfo;
19  
20 0 ▶ if ( !$arg1 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($arg1) 0 0 0
21 0 die('Must define container ID');
22 }
23  
24 0 Rex::Logger::debug("Getting docker info by inspect");
25  
26 0 my $ret = i_run "docker inspect $arg1", fail_ok => 1;
27 0 ▶ if ( $? != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($? != 0) 0 0 0
28 0 return { running => 'off' };
29 }
30  
31 0 my $coder = JSON::MaybeXS->new->allow_nonref;
32 0 my $ref = $coder->decode($ret);
33 0 $ref = $ref->[0];
34 0 $ref->{running} = "on";
35 0 return $ref;
36 }
37  
38 1 1;
« blib/lib/Rex/Interface/Fs/OpenSSH.pm ↑ Summary lib/Rex/Commands/SimpleCheck.pm »