File Coverage

lib/Rex/Virtualization/Docker/images.pm
Criterion Covered Total %
statement 11 20 55.0
branch n/a
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 15 26 57.6


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Virtualization::Docker::images;
6              
7 1     1   14 use v5.12.5;
  1         3  
8 1     1   5 use warnings;
  1         3  
  1         40  
9              
10             our $VERSION = '1.14.2.2'; # TRIAL VERSION
11              
12 1     1   6 use Rex::Logger;
  1         2  
  1         5  
13 1     1   19 use Rex::Helper::Run;
  1         2  
  1         231  
14              
15             sub execute {
16 0     0 0   my ( $class, $arg1 ) = @_;
17 0           my @domains;
18              
19 0           Rex::Logger::debug("Getting docker images");
20              
21 0           my @images =
22             i_run "docker images --format \"{{.Repository}}:{{.Tag}}:{{.ID}}\"",
23             fail_ok => 1;
24              
25 0           my @ret = ();
26 0           for my $line (@images) {
27 0           my ( $image, $tag, $id ) = split( /:/, $line );
28 0           push(
29             @ret,
30             {
31             tag => $tag,
32             name => $image,
33             id => $id,
34             }
35             );
36             }
37              
38 0           return \@ret;
39             }
40              
41             1;