lib/Rex/Virtualization/VBox.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 82.7% 24 / 29 CC 2 SCAR 3.0
CC
2
Cov
90%
new
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« lib/Rex/Virtualization/LibVirt.pm ↑ Summary lib/Rex/Pkg/Test.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 =head1 NAME
6  
7 Rex::Virtualization::VBox - VirtualBox Virtualization Module
8  
9 =head1 DESCRIPTION
10  
11 With this module you can manage VirtualBox.
12  
13 =head1 SYNOPSIS
14  
15 use Rex::Commands::Virtualization;
16  
17 set virtualization => "VBox";
18  
19 use Data::Dumper;
20  
21 print Dumper vm list => "all";
22 print Dumper vm list => "running";
23  
24 vm destroy => "vm01";
25  
26 vm delete => "vm01";
27  
28 vm start => "vm01";
29  
30 vm shutdown => "vm01";
31  
32 vm reboot => "vm01";
33  
34 vm option => "vm01",
35 memory => 512;
36  
37 print Dumper vm info => "vm01";
38  
39 # creating a vm
40 vm create => "vm01",
41 storage => [
42 {
43 file => "/mnt/data/vbox/vm01.img",
44 size => "10G",
45 },
46 {
47 file => "/mnt/iso/debian6.iso",
48 }
49 ],
50 memory => 512,
51 type => "Linux26",
52 cpus => 1,
53 boot => "dvd";
54  
55 vm forward_port => "vm01", add => { http => [8080, 80] };
56  
57 vm forward_port => "vm01", remove => "http";
58  
59 print Dumper vm guestinfo => "vm01";
60  
61 vm share_folder => "vm01", add => { sharename => "/path/to/share" };
62  
63 vm share_folder => "vm01", remove => "sharename";
64  
65 For VirtualBox memory declaration is always in megabyte.
66  
67 =cut
68  
69 package Rex::Virtualization::VBox;
70  
71 2 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
73  
74 2 our $VERSION = '1.16.1'; # VERSION
75  
76 2 ▶use Rex::Virtualization::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
77 2 ▶use base qw(Rex::Virtualization::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
78  
79 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod undocumented
80 1 my $that = shift;
81 1 ▶ my $proto = ref($that) || $that;
Condition33%1/3
ref $that || $that
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table33%1/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
82 1 my $self = {@_};
83  
84 1 bless( $self, $proto );
85  
86 1 return $self;
87 }
88  
89 2 1;
« lib/Rex/Virtualization/LibVirt.pm ↑ Summary lib/Rex/Pkg/Test.pm »