line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Virtualization::VBox::reboot; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
27
|
use v5.12.5; |
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
42
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.3'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
13
|
use Rex::Logger; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
13
|
1
|
|
|
1
|
|
42
|
use Rex::Helper::Run; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
218
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub execute { |
16
|
0
|
|
|
0
|
0
|
|
my ( $class, $arg1, %opt ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
unless ($arg1) { |
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
|
0
|
|
|
|
|
unless ($dom) { |
26
|
0
|
|
|
|
|
|
die("VM $dom not found."); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
i_run "VBoxManage controlvm \"$dom\" reset", fail_ok => 1; |
30
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
31
|
0
|
|
|
|
|
|
die("Error rebooting vm $dom"); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |