line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Virtualization::Docker::info; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
14
|
use v5.12.5; |
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.3'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Rex::Logger; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
13
|
1
|
|
|
1
|
|
32
|
use Rex::Helper::Run; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
14
|
1
|
|
|
1
|
|
11
|
use JSON::MaybeXS; |
|
1
|
|
|
|
|
2149
|
|
|
1
|
|
|
|
|
210
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub execute { |
17
|
0
|
|
|
0
|
0
|
|
my ( $class, $arg1 ) = @_; |
18
|
0
|
|
|
|
|
|
my @dominfo; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if ( !$arg1 ) { |
21
|
0
|
|
|
|
|
|
die('Must define container ID'); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
Rex::Logger::debug("Getting docker info by inspect"); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $ret = i_run "docker inspect $arg1", fail_ok => 1; |
27
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
28
|
0
|
|
|
|
|
|
return { running => 'off' }; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $coder = JSON::MaybeXS->new->allow_nonref; |
32
|
0
|
|
|
|
|
|
my $ref = $coder->decode($ret); |
33
|
0
|
|
|
|
|
|
$ref = $ref->[0]; |
34
|
0
|
|
|
|
|
|
$ref->{running} = "on"; |
35
|
0
|
|
|
|
|
|
return $ref; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |