line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
163961
|
use strict; |
|
7
|
|
|
|
|
44
|
|
|
7
|
|
|
|
|
205
|
|
2
|
7
|
|
|
7
|
|
34
|
use warnings; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
1567
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless; |
5
|
|
|
|
|
|
|
$Footprintless::VERSION = '1.29'; |
6
|
|
|
|
|
|
|
# ABSTRACT: A utility for managing systems with minimal installs |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless |
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
33
|
use Carp; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
425
|
|
10
|
7
|
|
|
7
|
|
3367
|
use Config::Entities; |
|
7
|
|
|
|
|
95889
|
|
|
7
|
|
|
|
|
308
|
|
11
|
7
|
|
|
7
|
|
2601
|
use Footprintless::Util qw(factory); |
|
7
|
|
|
|
|
96
|
|
|
7
|
|
|
|
|
483
|
|
12
|
7
|
|
|
7
|
|
42
|
use Log::Any; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
23
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $AUTOLOAD; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
20
|
|
|
20
|
1
|
25435
|
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
|
|
9063
|
my ( $self, @args ) = @_; |
29
|
21
|
|
|
|
|
49
|
my $method = $AUTOLOAD; |
30
|
21
|
|
|
|
|
133
|
$method =~ s/.*:://; |
31
|
21
|
50
|
|
|
|
171
|
$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
|
890
|
my ( $self, @args ) = @_; |
41
|
2
|
|
|
|
|
8
|
$self->{factory}->command_runner(@args); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub deployment { |
45
|
2
|
|
|
2
|
1
|
6
|
my ( $self, @args ) = @_; |
46
|
2
|
|
|
|
|
9
|
$self->{factory}->deployment(@args); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub entities { |
50
|
52
|
|
|
52
|
1
|
14076
|
my ( $self, @args ) = @_; |
51
|
52
|
|
|
|
|
219
|
$self->{factory}->entities(@args); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _init { |
55
|
20
|
|
|
20
|
|
60
|
my ( $self, %options ) = @_; |
56
|
|
|
|
|
|
|
|
57
|
20
|
|
|
|
|
110
|
$logger->debugf( 'creating new Footprintless: %s', \%options ); |
58
|
|
|
|
|
|
|
|
59
|
20
|
100
|
|
|
|
290
|
if ( $options{factory} ) { |
60
|
1
|
|
|
|
|
3
|
$self->{factory} = $options{factory}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
else { |
63
|
19
|
|
|
|
|
31
|
my $entities; |
64
|
19
|
100
|
|
|
|
43
|
if ( $options{entities} ) { |
65
|
5
|
100
|
|
|
|
23
|
if ( ref( $options{entities} ) eq 'HASH' ) { |
|
|
50
|
|
|
|
|
|
66
|
4
|
|
|
|
|
32
|
$entities = Config::Entities->new( { entity => $options{entities} } ); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
elsif ( $options{entities}->isa('Config::Entities') ) { |
69
|
1
|
|
|
|
|
3
|
$entities = $options{entities}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
0
|
|
|
|
|
0
|
croak('illegal entities, must be hashref, or Config::Entities'); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else { |
76
|
14
|
|
|
|
|
22
|
my $fpl_home; |
77
|
14
|
50
|
|
|
|
47
|
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
|
|
|
|
|
103
|
$fpl_home = File::Spec->catdir( $ENV{HOME}, '.footprintless' ); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
14
|
|
|
|
|
33
|
my @config_dirs = (); |
88
|
14
|
100
|
|
|
|
47
|
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
|
|
|
|
|
48
|
@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
|
|
|
|
|
108
|
my @config_options = (); |
105
|
14
|
50
|
|
|
|
53
|
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
|
|
|
|
|
20
|
my @properties = _split_dirs( $ENV{FPL_CONFIG_PROPS} ); |
110
|
9
|
|
|
|
|
32
|
push( @config_options, properties_file => \@properties ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
5
|
|
|
|
|
26
|
my $default = File::Spec->catdir( $fpl_home, 'properties.pl' ); |
114
|
5
|
50
|
|
|
|
87
|
if ( -f $default ) { |
115
|
0
|
|
|
|
|
0
|
push( @config_options, properties_file => $default ); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
14
|
|
|
|
|
79
|
$logger->tracef( |
120
|
|
|
|
|
|
|
"constructing entities with\n\tconfig_dirs: %s\n\tconfig_options: %s)", |
121
|
|
|
|
|
|
|
\@config_dirs, {@config_options} ); |
122
|
14
|
|
|
|
|
248
|
$entities = Config::Entities->new( @config_dirs, {@config_options} ); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
19
|
|
|
|
|
20853
|
$self->{factory} = factory($entities); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
20
|
|
|
|
|
79
|
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
|
9
|
my ( $self, @args ) = @_; |
138
|
4
|
|
|
|
|
20
|
$self->{factory}->log(@args); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub plugins { |
142
|
8
|
|
|
8
|
1
|
519
|
my ($self) = @_; |
143
|
8
|
|
|
|
|
40
|
$self->{factory}->plugins(); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub overlay { |
147
|
2
|
|
|
2
|
1
|
6
|
my ( $self, @args ) = @_; |
148
|
2
|
|
|
|
|
9
|
$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
|
10
|
my ( $self, @args ) = @_; |
158
|
4
|
|
|
|
|
21
|
$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
|
|
42
|
my ($dirs_string) = @_; |
168
|
|
|
|
|
|
|
|
169
|
22
|
|
|
|
|
34
|
my @dirs = (); |
170
|
22
|
50
|
|
|
|
66
|
my $separator = ( $^O eq 'MSWin32' ) ? ';' : ':'; |
171
|
22
|
|
|
|
|
120
|
foreach my $dir ( split( /$separator/, $dirs_string ) ) { |
172
|
31
|
|
|
|
|
69
|
$dir =~ s/^\s+//; |
173
|
31
|
|
|
|
|
62
|
$dir =~ s/\s+$//; |
174
|
31
|
|
|
|
|
55
|
push( @dirs, $dir ); |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
22
|
|
|
|
|
57
|
return @dirs; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
__END__ |