line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
14
|
|
|
14
|
|
61218
|
use strict; |
|
14
|
|
|
|
|
34
|
|
|
14
|
|
|
|
|
378
|
|
2
|
14
|
|
|
14
|
|
65
|
use warnings; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
716
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::Factory; |
5
|
|
|
|
|
|
|
$Footprintless::Factory::VERSION = '1.28'; |
6
|
|
|
|
|
|
|
# ABSTRACT: The default factory for footprintless modules |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::Factory |
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
|
89
|
use Carp; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
808
|
|
10
|
14
|
|
|
14
|
|
425
|
use Footprintless::Util; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
444
|
|
11
|
14
|
|
|
14
|
|
74
|
use Log::Any; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
96
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $AUTOLOAD; |
14
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
50
|
|
|
50
|
1
|
177
|
return bless( {}, shift )->_init(@_); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub agent { |
21
|
11
|
|
|
11
|
1
|
20
|
my ( $self, @options ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
11
|
|
|
|
|
39
|
return Footprintless::Util::agent(@options); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub AUTOLOAD { |
27
|
4
|
|
|
4
|
|
6
|
my ( $self, @args ) = @_; |
28
|
4
|
|
|
|
|
6
|
my $method_name = $AUTOLOAD; |
29
|
4
|
|
|
|
|
11
|
$method_name =~ s/.*:://; |
30
|
4
|
|
|
|
|
8
|
foreach my $plugin ( $self->plugins() ) { |
31
|
4
|
|
|
|
|
9
|
my $method = $plugin->factory_methods()->{$method_name}; |
32
|
4
|
50
|
|
|
|
39
|
if ($method) { |
33
|
4
|
|
|
|
|
8
|
return &$method( $self, @args ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
0
|
croak("unsupported factory method: [$method_name]"); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub command_options { |
40
|
33
|
|
|
33
|
1
|
881
|
my ( $self, @spec ) = @_; |
41
|
33
|
|
|
|
|
122
|
return $self->command_options_factory()->command_options(@spec); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub command_options_factory { |
45
|
33
|
|
|
33
|
1
|
69
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
33
|
100
|
|
|
|
86
|
unless ( $self->{command_options_factory} ) { |
48
|
22
|
|
|
|
|
1938
|
require Footprintless::CommandOptionsFactory; |
49
|
|
|
|
|
|
|
$self->{command_options_factory} = |
50
|
22
|
|
|
|
|
86
|
Footprintless::CommandOptionsFactory->new( localhost => $self->localhost() ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
33
|
|
|
|
|
153
|
return $self->{command_options_factory}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub command_runner { |
57
|
39
|
|
|
39
|
1
|
73
|
my ($self) = @_; |
58
|
|
|
|
|
|
|
|
59
|
39
|
100
|
|
|
|
100
|
unless ( $self->{command_runner} ) { |
60
|
11
|
|
|
|
|
89
|
require Footprintless::Util; |
61
|
11
|
|
|
|
|
298
|
$self->{command_runner} = Footprintless::Util::default_command_runner(); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
39
|
|
|
|
|
133
|
return $self->{command_runner}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub deployment { |
68
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $coordinate, %options ) = @_; |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
447
|
require Footprintless::Deployment; |
71
|
2
|
|
|
|
|
22
|
return Footprintless::Deployment->new( $self, $coordinate, %options ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
15
|
|
|
sub DESTROY { } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub entities { |
77
|
302
|
|
|
302
|
1
|
1446
|
return $_[0]->{entities}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _init { |
81
|
50
|
|
|
50
|
|
156
|
my ( $self, $entities, %options ) = @_; |
82
|
|
|
|
|
|
|
|
83
|
50
|
|
|
|
|
174
|
$self->{entities} = $entities; |
84
|
50
|
|
|
|
|
121
|
$self->{agent} = $options{agent}; |
85
|
50
|
|
|
|
|
116
|
$self->{command_options_factory} = $options{command_options_factory}; |
86
|
50
|
|
|
|
|
118
|
$self->{command_runner} = $options{command_runner}; |
87
|
50
|
|
|
|
|
133
|
$self->{localhost} = $options{localhost}; |
88
|
50
|
|
|
|
|
100
|
$self->{resource_manager} = $options{resource_manager}; |
89
|
|
|
|
|
|
|
|
90
|
50
|
|
|
|
|
120
|
$self->{plugins} = []; |
91
|
50
|
100
|
|
|
|
174
|
if ( $self->{entities}{'footprintless'} ) { |
92
|
12
|
|
|
|
|
32
|
my $plugin_modules = $self->{entities}{'footprintless'}{plugins}; |
93
|
12
|
100
|
|
|
|
33
|
if ($plugin_modules) { |
94
|
2
|
|
|
|
|
4
|
foreach my $plugin_module (@$plugin_modules) { |
95
|
2
|
|
|
|
|
5
|
$logger->debugf( 'registering plugin %s', $plugin_module ); |
96
|
|
|
|
|
|
|
$self->register_plugin( |
97
|
|
|
|
|
|
|
Footprintless::Util::dynamic_module_new( |
98
|
2
|
|
|
|
|
21
|
$plugin_module, $self->{entities}{'footprintless'}{$plugin_module} |
99
|
|
|
|
|
|
|
) |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
50
|
|
|
|
|
136
|
return $self; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub localhost { |
109
|
38
|
|
|
38
|
1
|
82
|
my ($self) = @_; |
110
|
|
|
|
|
|
|
|
111
|
38
|
100
|
|
|
|
115
|
unless ( $self->{localhost} ) { |
112
|
28
|
|
|
|
|
445
|
require Footprintless::Localhost; |
113
|
28
|
|
|
|
|
189
|
$self->{localhost} = Footprintless::Localhost->new()->load_all(); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
38
|
|
|
|
|
280
|
return $self->{localhost}; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub log { |
120
|
4
|
|
|
4
|
1
|
9
|
my ( $self, $coordinate, %options ) = @_; |
121
|
|
|
|
|
|
|
|
122
|
4
|
|
|
|
|
419
|
require Footprintless::Log; |
123
|
4
|
|
|
|
|
22
|
return Footprintless::Log->new( $self, $coordinate, %options ); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub overlay { |
127
|
2
|
|
|
2
|
1
|
4
|
my ( $self, $coordinate, %options ) = @_; |
128
|
|
|
|
|
|
|
|
129
|
2
|
|
|
|
|
379
|
require Footprintless::Overlay; |
130
|
2
|
|
|
|
|
18
|
return Footprintless::Overlay->new( $self, $coordinate, %options ); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub plugins { |
134
|
12
|
|
|
12
|
1
|
676
|
return @{ $_[0]->{plugins} }; |
|
12
|
|
|
|
|
44
|
|
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub register_plugin { |
138
|
2
|
|
|
2
|
1
|
4
|
my ( $self, $plugin ) = @_; |
139
|
|
|
|
|
|
|
|
140
|
2
|
|
|
|
|
3
|
push( @{ $self->{plugins} }, $plugin ); |
|
2
|
|
|
|
|
7
|
|
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub resource_manager { |
144
|
19
|
|
|
19
|
1
|
53
|
my ( $self, $coordinate, %options ) = @_; |
145
|
|
|
|
|
|
|
|
146
|
19
|
100
|
|
|
|
85
|
unless ( $self->{resource_manager} ) { |
147
|
|
|
|
|
|
|
$self->{resource_manager} = |
148
|
9
|
|
|
|
|
38
|
Footprintless::Util::dynamic_module_new( 'Footprintless::ResourceManager', |
149
|
|
|
|
|
|
|
$self, $coordinate ); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
19
|
|
|
|
|
102
|
return $self->{resource_manager}; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub service { |
156
|
4
|
|
|
4
|
1
|
8
|
my ( $self, $coordinate, %options ) = @_; |
157
|
|
|
|
|
|
|
|
158
|
4
|
|
|
|
|
410
|
require Footprintless::Service; |
159
|
4
|
|
|
|
|
20
|
return Footprintless::Service->new( $self, $coordinate, %options ); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub tunnel { |
163
|
0
|
|
|
0
|
1
|
|
my ( $self, $coordinate, %options ) = @_; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
require Footprintless::Tunnel; |
166
|
0
|
|
|
|
|
|
return Footprintless::Tunnel->new( $self, $coordinate, %options ); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
1; |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
__END__ |