lib/Rex/Virtualization/Lxc/info.pm

filter: Statementstmt 46.4% 13 / 28 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 44.7% 17 / 38 CC 4 SCAR 23.5
CC
4
Cov
41%
execute
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 10.5
« lib/Rex/Inventory/SMBios/Section.pm ↑ Summary lib/Rex/Virtualization/Docker/delete.pm »
1 #
2 # (c) Oleg Hardt <litwol@litwol.com>
3 #
4  
5 package Rex::Virtualization::Lxc::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  
15 0 ▶sub execute {
Subroutine execute: not called CC=4 SCAR=30.0
Pod undocumented
16 0 my ( $class, $arg1 ) = @_;
17 0 my @dominfo;
18  
19 0 ▶ if ( !$arg1 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($arg1) 0 0 0
20 0 die('Must define container ID');
21 }
22  
23 0 Rex::Logger::debug("Getting lxc-info");
24  
25 0 my @container_info = i_run "lxc-info -n $arg1", fail_ok => 1;
26 0 ▶ if ( $? != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($? != 0) 0 0 0
27 0 die("Error running lxc-info");
28 }
29  
30 0 my %ret;
31 0 for my $line (@container_info) {
32 0 my ( $column, $value ) = split( ':', $line );
33  
34 # Trim white spaces.
35 0 $column =~ s/^\s+|\s+$//g;
36 0 $value =~ s/^\s+|\s+$//g;
37  
38 0 $ret{$column} = $value;
39 }
40  
41 0 return \%ret;
42 }
43  
44 1 1;
« lib/Rex/Inventory/SMBios/Section.pm ↑ Summary lib/Rex/Virtualization/Docker/delete.pm »