line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Virtualization::VBox::status; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
14
|
use v5.12.5; |
|
1
|
|
|
|
|
3
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.2'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
10
|
use Rex::Virtualization::VBox::list; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub execute { |
15
|
0
|
|
|
0
|
0
|
|
my ( $class, $arg1, %opt ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $vms = Rex::Virtualization::VBox::list->execute("all"); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my ($vm) = grep { $_->{name} eq $arg1 } @{$vms}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
if ( $vm->{status} eq "poweroff" ) { |
22
|
0
|
|
|
|
|
|
return "stopped"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else { |
25
|
0
|
|
|
|
|
|
return "running"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |