lib/Rex/Virtualization/VBox/reboot.pm

filter: Statementstmt 56.5% 13 / 23 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 48.5% 17 / 35 CC 4 SCAR 23.5
CC
4
Cov
45%
execute
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 10.5
« lib/Rex/Virtualization/VBox/destroy.pm ↑ Summary lib/Rex/Virtualization/VBox/shutdown.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Virtualization::VBox::reboot;
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, %opt ) = @_;
17  
18 0 ▶ unless ($arg1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($arg1) 0 0 0
19 0 die("You have to define the vm name!");
20 }
21  
22 0 my $dom = $arg1;
23 0 Rex::Logger::debug("rebooting domain: $dom");
24  
25 0 ▶ unless ($dom) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dom) 0 0 0
26 0 die("VM $dom not found.");
27 }
28  
29 0 i_run "VBoxManage controlvm \"$dom\" reset", fail_ok => 1;
30 0 ▶ if ( $? != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($? != 0) 0 0 0
31 0 die("Error rebooting vm $dom");
32 }
33  
34 }
35  
36 1 1;
« lib/Rex/Virtualization/VBox/destroy.pm ↑ Summary lib/Rex/Virtualization/VBox/shutdown.pm »