File Coverage

lib/Rex/Virtualization/Docker/daemon.pm
Criterion Covered Total %
statement 11 18 61.1
branch 0 6 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 15 30 50.0


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Virtualization::Docker::daemon;
6              
7 1     1   15 use v5.12.5;
  1         3  
8 1     1   17 use warnings;
  1         2  
  1         45  
9              
10             our $VERSION = '1.14.2.3'; # TRIAL VERSION
11              
12 1     1   5 use Rex::Logger;
  1         2  
  1         18  
13 1     1   43 use Rex::Helper::Run;
  1         10  
  1         216  
14              
15             sub execute {
16 0     0 0   my ( $class, %opt ) = @_;
17              
18 0 0         my $bind = defined $opt{bind} ? $opt{bind} : '0.0.0.0';
19 0 0         my $host = defined $opt{host} ? $opt{host} : 'unix:///var/run/docker.sock';
20              
21 0           Rex::Logger::debug("starting docker daemon");
22              
23 0           i_run "docker -d -H $host -ip $bind", fail_ok => 1;
24 0 0         if ( $? != 0 ) {
25 0           die("Error starting docker daemon");
26             }
27              
28             }
29              
30             1;