line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
113342
|
use strict; |
|
7
|
|
|
|
|
38
|
|
|
7
|
|
|
|
|
175
|
|
2
|
7
|
|
|
7
|
|
28
|
use warnings; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
1661
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless; |
5
|
|
|
|
|
|
|
$Footprintless::VERSION = '1.28'; |
6
|
|
|
|
|
|
|
# ABSTRACT: A utility for managing systems with minimal installs |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless |
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
30
|
use Carp; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
316
|
|
10
|
7
|
|
|
7
|
|
2545
|
use Config::Entities; |
|
7
|
|
|
|
|
72445
|
|
|
7
|
|
|
|
|
197
|
|
11
|
7
|
|
|
7
|
|
2265
|
use Footprintless::Util qw(factory); |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
295
|
|
12
|
7
|
|
|
7
|
|
36
|
use Log::Any; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
18
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $AUTOLOAD; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
20
|
|
|
20
|
1
|
23209
|
return bless( {}, shift )->_init(@_); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub agent { |
23
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @options ) = @_; |
24
|
0
|
|
|
|
|
0
|
$self->{factory}->agent(@options); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub AUTOLOAD { |
28
|
21
|
|
|
21
|
|
6129
|
my ( $self, @args ) = @_; |
29
|
21
|
|
|
|
|
37
|
my $method = $AUTOLOAD; |
30
|
21
|
|
|
|
|
124
|
$method =~ s/.*:://; |
31
|
21
|
50
|
|
|
|
161
|
$self->{factory}->$method(@args) if ( $self->{factory} ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub command_options_factory { |
35
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @args ) = @_; |
36
|
0
|
|
|
|
|
0
|
$self->{factory}->command_options_factory(@args); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub command_runner { |
40
|
2
|
|
|
2
|
1
|
1131
|
my ( $self, @args ) = @_; |
41
|
2
|
|
|
|
|
8
|
$self->{factory}->command_runner(@args); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub deployment { |
45
|
2
|
|
|
2
|
1
|
7
|
my ( $self, @args ) = @_; |
46
|
2
|
|
|
|
|
11
|
$self->{factory}->deployment(@args); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub entities { |
50
|
52
|
|
|
52
|
1
|
11359
|
my ( $self, @args ) = @_; |
51
|
52
|
|
|
|
|
196
|
$self->{factory}->entities(@args); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _init { |
55
|
20
|
|
|
20
|
|
49
|
my ( $self, %options ) = @_; |
56
|
|
|
|
|
|
|
|
57
|
20
|
|
|
|
|
78
|
$logger->debugf( 'creating new Footprintless: %s', \%options ); |
58
|
|
|
|
|
|
|
|
59
|
20
|
100
|
|
|
|
254
|
if ( $options{factory} ) { |
60
|
1
|
|
|
|
|
2
|
$self->{factory} = $options{factory}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
else { |
63
|
19
|
|
|
|
|
29
|
my $entities; |
64
|
19
|
100
|
|
|
|
42
|
if ( $options{entities} ) { |
65
|
5
|
100
|
|
|
|
17
|
if ( ref( $options{entities} ) eq 'HASH' ) { |
|
|
50
|
|
|
|
|
|
66
|
4
|
|
|
|
|
18
|
$entities = Config::Entities->new( { entity => $options{entities} } ); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
elsif ( $options{entities}->isa('Config::Entities') ) { |
69
|
1
|
|
|
|
|
2
|
$entities = $options{entities}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
0
|
|
|
|
|
0
|
croak('illegal entities, must be hashref, or Config::Entities'); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else { |
76
|
14
|
|
|
|
|
20
|
my $fpl_home; |
77
|
14
|
50
|
|
|
|
44
|
if ( $options{fpl_home} ) { |
|
|
50
|
|
|
|
|
|
78
|
0
|
|
|
|
|
0
|
$fpl_home = $options{fpl_home}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
elsif ( $ENV{FPL_HOME} ) { |
81
|
0
|
|
|
|
|
0
|
$fpl_home = $ENV{FPL_HOME}; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
else { |
84
|
14
|
|
|
|
|
94
|
$fpl_home = File::Spec->catdir( $ENV{HOME}, '.footprintless' ); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
14
|
|
|
|
|
32
|
my @config_dirs = (); |
88
|
14
|
100
|
|
|
|
44
|
if ( $options{config_dirs} ) { |
|
|
50
|
|
|
|
|
|
89
|
|
|
|
|
|
|
@config_dirs = |
90
|
|
|
|
|
|
|
ref( $options{config_dirs} ) eq 'ARRAY' |
91
|
0
|
|
|
|
|
0
|
? @{ $options{config_dirs} } |
92
|
1
|
50
|
|
|
|
4
|
: ( $options{config_dirs} ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
elsif ( $ENV{FPL_CONFIG_DIRS} ) { |
95
|
13
|
|
|
|
|
41
|
@config_dirs = _split_dirs( $ENV{FPL_CONFIG_DIRS} ); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
else { |
98
|
0
|
|
|
|
|
0
|
my $default = File::Spec->catdir( $fpl_home, 'config' ); |
99
|
0
|
0
|
|
|
|
0
|
if ( -d $default ) { |
100
|
0
|
|
|
|
|
0
|
@config_dirs = ($default); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
14
|
|
|
|
|
27
|
my @config_options = (); |
105
|
14
|
50
|
|
|
|
44
|
if ( $options{config_properties} ) { |
|
|
100
|
|
|
|
|
|
106
|
0
|
|
|
|
|
0
|
push( @config_options, properties_file => $options{config_properties} ); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
elsif ( $ENV{FPL_CONFIG_PROPS} ) { |
109
|
9
|
|
|
|
|
19
|
my @properties = _split_dirs( $ENV{FPL_CONFIG_PROPS} ); |
110
|
9
|
|
|
|
|
28
|
push( @config_options, properties_file => \@properties ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
5
|
|
|
|
|
24
|
my $default = File::Spec->catdir( $fpl_home, 'properties.pl' ); |
114
|
5
|
50
|
|
|
|
74
|
if ( -f $default ) { |
115
|
0
|
|
|
|
|
0
|
push( @config_options, properties_file => $default ); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
14
|
|
|
|
|
77
|
$logger->tracef( |
120
|
|
|
|
|
|
|
"constructing entities with\n\tconfig_dirs: %s\n\tconfig_options: %s)", |
121
|
|
|
|
|
|
|
\@config_dirs, {@config_options} ); |
122
|
14
|
|
|
|
|
229
|
$entities = Config::Entities->new( @config_dirs, {@config_options} ); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
19
|
|
|
|
|
20965
|
$self->{factory} = factory($entities); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
20
|
|
|
|
|
73
|
return $self; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub localhost { |
132
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @args ) = @_; |
133
|
0
|
|
|
|
|
0
|
$self->{factory}->localhost(@args); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub log { |
137
|
4
|
|
|
4
|
1
|
8
|
my ( $self, @args ) = @_; |
138
|
4
|
|
|
|
|
20
|
$self->{factory}->log(@args); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub plugins { |
142
|
8
|
|
|
8
|
1
|
489
|
my ($self) = @_; |
143
|
8
|
|
|
|
|
35
|
$self->{factory}->plugins(); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub overlay { |
147
|
2
|
|
|
2
|
1
|
6
|
my ( $self, @args ) = @_; |
148
|
2
|
|
|
|
|
8
|
$self->{factory}->overlay(@args); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub resource_manager { |
152
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @args ) = @_; |
153
|
0
|
|
|
|
|
0
|
$self->{factory}->resource_manager(@args); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub service { |
157
|
4
|
|
|
4
|
1
|
7
|
my ( $self, @args ) = @_; |
158
|
4
|
|
|
|
|
24
|
$self->{factory}->service(@args); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub tunnel { |
162
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @args ) = @_; |
163
|
0
|
|
|
|
|
0
|
$self->{factory}->tunnel(@args); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub _split_dirs { |
167
|
22
|
|
|
22
|
|
45
|
my ($dirs_string) = @_; |
168
|
|
|
|
|
|
|
|
169
|
22
|
|
|
|
|
30
|
my @dirs = (); |
170
|
22
|
50
|
|
|
|
62
|
my $separator = ( $^O eq 'MSWin32' ) ? ';' : ':'; |
171
|
22
|
|
|
|
|
106
|
foreach my $dir ( split( /$separator/, $dirs_string ) ) { |
172
|
31
|
|
|
|
|
70
|
$dir =~ s/^\s+//; |
173
|
31
|
|
|
|
|
50
|
$dir =~ s/\s+$//; |
174
|
31
|
|
|
|
|
56
|
push( @dirs, $dir ); |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
22
|
|
|
|
|
51
|
return @dirs; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
__END__ |