line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
14
|
|
|
14
|
|
64368
|
use strict; |
|
14
|
|
|
|
|
32
|
|
|
14
|
|
|
|
|
419
|
|
2
|
14
|
|
|
14
|
|
65
|
use warnings; |
|
14
|
|
|
|
|
41
|
|
|
14
|
|
|
|
|
619
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::Factory; |
5
|
|
|
|
|
|
|
$Footprintless::Factory::VERSION = '1.29'; |
6
|
|
|
|
|
|
|
# ABSTRACT: The default factory for footprintless modules |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::Factory |
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
|
118
|
use Carp; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
955
|
|
10
|
14
|
|
|
14
|
|
443
|
use Footprintless::Util; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
574
|
|
11
|
14
|
|
|
14
|
|
79
|
use Log::Any; |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
95
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $AUTOLOAD; |
14
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
50
|
|
|
50
|
1
|
241
|
return bless( {}, shift )->_init(@_); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub agent { |
21
|
11
|
|
|
11
|
1
|
28
|
my ( $self, @options ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
11
|
|
|
|
|
45
|
return Footprintless::Util::agent(@options); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub AUTOLOAD { |
27
|
4
|
|
|
4
|
|
9
|
my ( $self, @args ) = @_; |
28
|
4
|
|
|
|
|
5
|
my $method_name = $AUTOLOAD; |
29
|
4
|
|
|
|
|
12
|
$method_name =~ s/.*:://; |
30
|
4
|
|
|
|
|
9
|
foreach my $plugin ( $self->plugins() ) { |
31
|
4
|
|
|
|
|
10
|
my $method = $plugin->factory_methods()->{$method_name}; |
32
|
4
|
50
|
|
|
|
42
|
if ($method) { |
33
|
4
|
|
|
|
|
9
|
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
|
715
|
my ( $self, @spec ) = @_; |
41
|
33
|
|
|
|
|
134
|
return $self->command_options_factory()->command_options(@spec); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub command_options_factory { |
45
|
33
|
|
|
33
|
1
|
66
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
33
|
100
|
|
|
|
105
|
unless ( $self->{command_options_factory} ) { |
48
|
22
|
|
|
|
|
1862
|
require Footprintless::CommandOptionsFactory; |
49
|
|
|
|
|
|
|
$self->{command_options_factory} = |
50
|
22
|
|
|
|
|
88
|
Footprintless::CommandOptionsFactory->new( localhost => $self->localhost() ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
33
|
|
|
|
|
248
|
return $self->{command_options_factory}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub command_runner { |
57
|
39
|
|
|
39
|
1
|
74
|
my ($self) = @_; |
58
|
|
|
|
|
|
|
|
59
|
39
|
100
|
|
|
|
118
|
unless ( $self->{command_runner} ) { |
60
|
11
|
|
|
|
|
74
|
require Footprintless::Util; |
61
|
11
|
|
|
|
|
323
|
$self->{command_runner} = Footprintless::Util::default_command_runner(); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
39
|
|
|
|
|
200
|
return $self->{command_runner}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub deployment { |
68
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $coordinate, %options ) = @_; |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
470
|
require Footprintless::Deployment; |
71
|
2
|
|
|
|
|
18
|
return Footprintless::Deployment->new( $self, $coordinate, %options ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
15
|
|
|
sub DESTROY { } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub entities { |
77
|
302
|
|
|
302
|
1
|
1806
|
return $_[0]->{entities}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _init { |
81
|
50
|
|
|
50
|
|
166
|
my ( $self, $entities, %options ) = @_; |
82
|
|
|
|
|
|
|
|
83
|
50
|
|
|
|
|
171
|
$self->{entities} = $entities; |
84
|
50
|
|
|
|
|
120
|
$self->{agent} = $options{agent}; |
85
|
50
|
|
|
|
|
129
|
$self->{command_options_factory} = $options{command_options_factory}; |
86
|
50
|
|
|
|
|
118
|
$self->{command_runner} = $options{command_runner}; |
87
|
50
|
|
|
|
|
121
|
$self->{localhost} = $options{localhost}; |
88
|
50
|
|
|
|
|
204
|
$self->{resource_manager} = $options{resource_manager}; |
89
|
|
|
|
|
|
|
|
90
|
50
|
|
|
|
|
157
|
$self->{plugins} = []; |
91
|
50
|
100
|
|
|
|
153
|
if ( $self->{entities}{'footprintless'} ) { |
92
|
12
|
|
|
|
|
31
|
my $plugin_modules = $self->{entities}{'footprintless'}{plugins}; |
93
|
12
|
100
|
|
|
|
36
|
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
|
|
|
|
|
137
|
return $self; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub localhost { |
109
|
38
|
|
|
38
|
1
|
101
|
my ($self) = @_; |
110
|
|
|
|
|
|
|
|
111
|
38
|
100
|
|
|
|
141
|
unless ( $self->{localhost} ) { |
112
|
28
|
|
|
|
|
650
|
require Footprintless::Localhost; |
113
|
28
|
|
|
|
|
219
|
$self->{localhost} = Footprintless::Localhost->new()->load_all(); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
38
|
|
|
|
|
394
|
return $self->{localhost}; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub log { |
120
|
4
|
|
|
4
|
1
|
8
|
my ( $self, $coordinate, %options ) = @_; |
121
|
|
|
|
|
|
|
|
122
|
4
|
|
|
|
|
430
|
require Footprintless::Log; |
123
|
4
|
|
|
|
|
21
|
return Footprintless::Log->new( $self, $coordinate, %options ); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub overlay { |
127
|
2
|
|
|
2
|
1
|
150
|
my ( $self, $coordinate, %options ) = @_; |
128
|
|
|
|
|
|
|
|
129
|
2
|
|
|
|
|
488
|
require Footprintless::Overlay; |
130
|
2
|
|
|
|
|
23
|
return Footprintless::Overlay->new( $self, $coordinate, %options ); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub plugins { |
134
|
12
|
|
|
12
|
1
|
97
|
return @{ $_[0]->{plugins} }; |
|
12
|
|
|
|
|
45
|
|
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub register_plugin { |
138
|
2
|
|
|
2
|
1
|
4
|
my ( $self, $plugin ) = @_; |
139
|
|
|
|
|
|
|
|
140
|
2
|
|
|
|
|
3
|
push( @{ $self->{plugins} }, $plugin ); |
|
2
|
|
|
|
|
8
|
|
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub resource_manager { |
144
|
19
|
|
|
19
|
1
|
68
|
my ( $self, $coordinate, %options ) = @_; |
145
|
|
|
|
|
|
|
|
146
|
19
|
100
|
|
|
|
89
|
unless ( $self->{resource_manager} ) { |
147
|
|
|
|
|
|
|
$self->{resource_manager} = |
148
|
9
|
|
|
|
|
46
|
Footprintless::Util::dynamic_module_new( 'Footprintless::ResourceManager', |
149
|
|
|
|
|
|
|
$self, $coordinate ); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
19
|
|
|
|
|
138
|
return $self->{resource_manager}; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub service { |
156
|
4
|
|
|
4
|
1
|
7
|
my ( $self, $coordinate, %options ) = @_; |
157
|
|
|
|
|
|
|
|
158
|
4
|
|
|
|
|
432
|
require Footprintless::Service; |
159
|
4
|
|
|
|
|
24
|
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__ |