| 1 | package Eixo::Docker::Api; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 12 | ▶ | use Eixo::Base::Clase qw(Eixo::Rest::Api); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 12 | ▶ | use Eixo::Docker::EventRegister; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 12 | ▶ | my $CERT_PATH = $ENV{DOCKER_CERT_PATH} || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'DOCKER_CERT_PATH'} || ''
MC/DC0%0/1
$ENV{'DOCKER_CERT_PATH'} || ''
$ENV{'DOCKER_CERT_PATH'}
Truth table50%1/2
A
A= $ENV{'DOCKER_CERT_PATH'}
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | has( | ||||||||||||||||||||||||||||||||||||||||||
| 12 | host => $ENV{DOCKER_HOST}, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | tls_verify => $ENV{DOCKER_TLS_VERIFY}, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 12 | ca_file => $CERT_PATH.'/ca.pem', | |||||||||||||||||||||||||||||||||||||||||
| 15 | cert_file => $CERT_PATH.'/cert.pem', | ||||||||||||||||||||||||||||||||||||||||||
| 16 | key_file => $CERT_PATH.'/key.pem', | ||||||||||||||||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub initialize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initialize: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | if(@args % 2){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | # if pass an odd number of args in new | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # firt one must be the docker host | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $self->host(shift(@args)); | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # rest of initialization has to be manual | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my %args = @args; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | while(my ($key, $val) = each(%args)){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $self->$key($val); | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my ($proto, $host) = split ('://', $self->host); | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | ($host = $proto and $proto = undef) unless($host); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$host || ($host = $proto) && $proto = undef
$host = $proto and $proto = undef
MC/DC0%0/3
$host || ($host = $proto) && $proto = undef
$host
$host = $proto
$proto = undef
Truth table0%0/4
A || B and C
A= $hostB= $host = $protoC= $proto = undef
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if(!$proto || $proto eq 'tcp'){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $proto or $proto eq "tcp"
MC/DC0%0/2
not $proto or $proto eq "tcp"
not $proto
$proto eq "tcp"
Truth table0%0/3
not(A) or B
A= not $protoB= $proto eq "tcp"
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | $proto = ($self->tls_verify)? 'https' : 'http'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | $self->SUPER::initialize( | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | "$proto://$host", | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | ssl_opts => { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | ($proto eq 'https')? | ||||||||||||||||||||||||||||||||||||||||||
| 56 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 57 | SSL_use_cert => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | verify_hostname => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | SSL_ca_file => $self->ca_file, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | SSL_cert_file => $self->cert_file, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | SSL_key_file => $self->key_file | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | ):() | ||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub containers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
containers: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | $_[0]->produce( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | ($_[0]->__legacy)? | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 'Eixo::Docker::ContainerLegacy': | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 'Eixo::Docker::Container' | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub images { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
images: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $_[0]->produce('Eixo::Docker::Image'); | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub version{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $_[0]->produce('Eixo::Docker::Version'); | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub events{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
events: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $_[0]->produce('Eixo::Docker::Events'); | |||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | sub eventPool{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eventPool: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | return $self->{ev} if($self->{ev}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $self->{ev} = Eixo::Docker::EventRegister->new( | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | $self, | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub __legacy { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__legacy: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $_[0]->version->get->ApiVersion <= 1.19 | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||