line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Docker::CLI::Wrapper::Base; |
2
|
|
|
|
|
|
|
$Docker::CLI::Wrapper::Base::VERSION = '0.0.5'; |
3
|
1
|
|
|
1
|
|
629
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
25
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
6
|
1
|
|
|
1
|
|
6
|
use autodie; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5436
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
1301
|
use Path::Tiny qw/ path /; |
|
1
|
|
|
|
|
13871
|
|
|
1
|
|
|
|
|
420
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'docker_cmd_line_prefix' => |
12
|
|
|
|
|
|
|
( is => 'ro', lazy => 1, builder => 'calc_docker_cmd_line_prefix' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub do_system |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
1
|
|
my ( $self, $args ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $cmd = $args->{cmd}; |
19
|
0
|
|
|
|
|
|
print "Running [@$cmd]\n"; |
20
|
0
|
0
|
|
|
|
|
if ( system(@$cmd) ) |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
|
|
|
die "Running [@$cmd] failed!"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub calc_docker_cmd_line_prefix |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
|
|
|
my $fh = path("/etc/fedora-release"); |
|
0
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if ( -e $fh ) |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
0
|
|
|
|
|
if ( my ($fedora_ver) = |
38
|
|
|
|
|
|
|
$fh->slurp_utf8() =~ /^Fedora release ([0-9]+)/ ) |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
0
|
|
|
|
|
if ( $fedora_ver >= 31 ) |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
# return ['podman']; |
43
|
0
|
|
|
|
|
|
return [ 'systemd-run', '--scope', '--user', 'podman' ]; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
return ['docker']; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub docker |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
0
|
1
|
|
my ( $self, $args ) = @_; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $cmd = $args->{cmd}; |
56
|
|
|
|
|
|
|
return $self->do_system( |
57
|
0
|
|
|
|
|
|
{ %$args, cmd => [ @{ $self->docker_cmd_line_prefix }, @$cmd, ], } ); |
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |