line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Podman::System; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
506102
|
use Mojo::Base 'Podman::Client'; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
190
|
use List::Util qw(sum); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
115
|
|
6
|
2
|
|
|
2
|
|
12
|
use Scalar::Util qw(blessed); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
925
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub disk_usage { |
9
|
1
|
|
|
1
|
1
|
3458
|
my $self = shift; |
10
|
|
|
|
|
|
|
|
11
|
1
|
50
|
|
|
|
14
|
$self = __PACKAGE__->new unless blessed($self); |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
13
|
my $data = $self->get('system/df')->json; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
953
|
my %disk_usage; |
16
|
1
|
|
|
|
|
13
|
for my $type (qw(Volumes Containers Images)) { |
17
|
3
|
|
|
|
|
8
|
my @data = @{$data->{$type}}; |
|
3
|
|
|
|
|
11
|
|
18
|
|
|
|
|
|
|
my %entry = ( |
19
|
|
|
|
|
|
|
Total => scalar @data, |
20
|
4
|
100
|
|
|
|
23
|
Active => sum(map { $_->{Containers} ? 1 : 0 } @data), |
21
|
3
|
|
|
|
|
8
|
Size => sum(map { $_->{Size} } @data), |
|
4
|
|
|
|
|
16
|
|
22
|
|
|
|
|
|
|
); |
23
|
3
|
|
|
|
|
43
|
$disk_usage{$type} = \%entry; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
25
|
return \%disk_usage; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub info { |
30
|
1
|
|
|
1
|
1
|
2750
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
1
|
50
|
|
|
|
9
|
$self = __PACKAGE__->new unless blessed($self); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
24
|
return $self->get('info')->json; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub version { |
38
|
1
|
|
|
1
|
1
|
25210
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
1
|
50
|
|
|
|
30
|
$self = __PACKAGE__->new unless blessed($self); |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
67
|
my $data = $self->get('info')->json; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
461
|
my $version = $data->{version}; |
45
|
1
|
|
|
|
|
3
|
delete $version->{GitCommit}; |
46
|
1
|
|
|
|
|
3
|
delete $version->{Built}; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4
|
return $version; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub prune { |
52
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
$self = __PACKAGE__->new unless blessed($self); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $self->post('system/prune')->json; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |