line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Docker::CLI::Wrapper::Base; |
2
|
|
|
|
|
|
|
$Docker::CLI::Wrapper::Base::VERSION = '0.0.7'; |
3
|
1
|
|
|
1
|
|
600
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
19
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
6
|
1
|
|
|
1
|
|
5
|
use autodie; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5690
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
1498
|
use Path::Tiny qw/ path /; |
|
1
|
|
|
|
|
17903
|
|
|
1
|
|
|
|
|
513
|
|
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 calc_docker_cmd |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
0
|
1
|
|
my ( $self, $args ) = @_; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $cmd = $args->{cmd}; |
56
|
0
|
|
|
|
|
|
return { docker_cmd => [ @{ $self->docker_cmd_line_prefix }, @$cmd, ], }; |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub docker |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
0
|
1
|
|
my ( $self, $args ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $cmd = $args->{cmd}; |
64
|
|
|
|
|
|
|
return $self->do_system( |
65
|
0
|
|
|
|
|
|
{ %$args, cmd => $self->calc_docker_cmd( $args, )->{'docker_cmd'}, } ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |