line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package System::Introspector::Probe::Puppet; |
2
|
1
|
|
|
1
|
|
36063
|
use Moo; |
|
1
|
|
|
|
|
18441
|
|
|
1
|
|
|
|
|
5
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
|
|
386
|
use System::Introspector::Util qw( |
5
|
|
|
|
|
|
|
output_from_file |
6
|
|
|
|
|
|
|
transform_exceptions |
7
|
1
|
|
|
1
|
|
2792
|
); |
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has classes_file => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
default => sub { '/var/lib/puppet/state/classes.txt' }, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has resources_file => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
default => sub { '/var/lib/puppet/state/resources.txt' }, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub gather { |
20
|
1
|
|
|
1
|
0
|
1315
|
my ($self) = @_; |
21
|
|
|
|
|
|
|
return { |
22
|
1
|
|
|
|
|
6
|
classes => $self->_gather_classes, |
23
|
|
|
|
|
|
|
resources => $self->_gather_resources, |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _gather_resources { |
28
|
1
|
|
|
1
|
|
20
|
my ($self) = @_; |
29
|
|
|
|
|
|
|
return transform_exceptions { |
30
|
1
|
|
|
1
|
|
6
|
my @lines = output_from_file $self->resources_file; |
31
|
1
|
|
|
|
|
3
|
chomp @lines; |
32
|
7
|
100
|
|
|
|
117
|
return [ map { |
33
|
1
|
|
|
|
|
3
|
m{^(\w+)\[(.*)\]$} |
34
|
|
|
|
|
|
|
? [$1, $2] |
35
|
|
|
|
|
|
|
: [__error__ => $_]; |
36
|
|
|
|
|
|
|
} @lines ]; |
37
|
1
|
|
|
|
|
8
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _gather_classes { |
41
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
return transform_exceptions { |
43
|
1
|
|
|
1
|
|
9
|
my @lines = output_from_file $self->classes_file; |
44
|
1
|
|
|
|
|
5
|
chomp @lines; |
45
|
1
|
|
|
|
|
4
|
return \@lines; |
46
|
1
|
|
|
|
|
10
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |