CBSD/vm_os_types.pm

filter: Statementstmt 60.5% 23 / 38 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 1 totaltotal 57.6% 30 / 52 CC 4 SCAR 20.7
CC
4
Cov
55%
execute
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.9
« CBSD/brestart.pm ↑ Summary CBSD/bnic_list.pm »
1 #
2 # (c) Zane C. Bowers-Hadley <vvelox@vvelox.net>
3 #
4  
5 package Rex::Virtualization::CBSD::vm_os_types;
6  
7 1 ▶use strict;
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 = '0.0.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 Term::ANSIColor qw(colorstrip);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Rex::Commands::User;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Rex::Commands::Fs;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 0 ▶sub execute {
Subroutine execute: not called CC=4 SCAR=30.0
Pod undocumented
19 0 my ($class) = @_;
20  
21 0 Rex::Logger::debug("Getting a list of VM OS types for CBSD ");
22  
23 # get where CBSD is installed to
24 0 my %cbsd;
25 0 ▶ eval { %cbsd = get_user('cbsd'); } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { %cbsd = get_user("cbsd") } } or do { my $error = $@ || "Unknown failure"; die q[get_user('cbsd') died with... ] . $error } 0 0 0
26 0 ▶ my $error = $@ || 'Unknown failure';
Condition0%0/2
$@ || 'Unknown failure'
l!l
00
MC/DC0%0/1
$@ || 'Unknown failure'
$@
Truth table0%0/2
A
A= $@
Aresult
11
00
27 0 die( "get_user('cbsd') died with... " . $error );
28 };
29  
30 0 my $cbsd_etc_defaults_dir = $cbsd{home} . '/etc/defaults/';
31  
32 # get a list of the VM/OS configs
33 0 my @vm_configs = grep { /^vm\-/ } list_files($cbsd_etc_defaults_dir);
34  
35 # find what OS we have profiles for
36 0 my %os_types;
37 0 foreach my $config (@vm_configs) {
38 0 my ( $vm, $os, $profile ) = split( /\-/, $config, 3 );
39 0 $os_types{$os} = 1;
40 }
41  
42 0 return keys(%os_types);
43 }
44  
45 1 1;
« CBSD/brestart.pm ↑ Summary CBSD/bnic_list.pm »