line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::AIX::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
102024900
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
125
|
|
4
|
2
|
|
|
2
|
|
23
|
use warnings; |
|
2
|
|
|
|
|
27
|
|
|
2
|
|
|
|
|
158
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1088
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1020
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
return |
12
|
|
|
|
|
|
|
!$params{no_category}->{software} && |
13
|
0
|
|
0
|
|
|
0
|
canRun('lslpp'); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub doInventory { |
17
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
20
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
my $softwares = _getSoftwaresList( |
23
|
|
|
|
|
|
|
command => 'lslpp -c -l', |
24
|
|
|
|
|
|
|
logger => $logger |
25
|
|
|
|
|
|
|
); |
26
|
0
|
0
|
|
|
|
0
|
return unless $softwares; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
foreach my $software (@$softwares) { |
29
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
30
|
|
|
|
|
|
|
section => 'SOFTWARES', |
31
|
|
|
|
|
|
|
entry => $software |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _getSoftwaresList { |
38
|
7
|
|
|
7
|
|
3033
|
my $handle = getFileHandle(@_); |
39
|
7
|
50
|
|
|
|
22
|
next unless $handle; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# skip headers |
42
|
7
|
|
|
|
|
147
|
my $line = <$handle>; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
10
|
my @softwares; |
45
|
7
|
|
|
|
|
34
|
while (my $line = <$handle>) { |
46
|
4600
|
|
|
|
|
13686
|
my @entry = split(/:/, $line); |
47
|
4600
|
100
|
|
|
|
15275
|
next if $entry[1] =~ /^device/; |
48
|
|
|
|
|
|
|
|
49
|
2497
|
|
|
|
|
6755
|
$entry[6] =~ s/\s+$//; |
50
|
|
|
|
|
|
|
|
51
|
2497
|
|
|
|
|
14599
|
push @softwares, { |
52
|
|
|
|
|
|
|
COMMENTS => $entry[6], |
53
|
|
|
|
|
|
|
FOLDER => $entry[0], |
54
|
|
|
|
|
|
|
NAME => $entry[1], |
55
|
|
|
|
|
|
|
VERSION => $entry[2], |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
} |
58
|
7
|
|
|
|
|
272
|
close $handle; |
59
|
|
|
|
|
|
|
|
60
|
7
|
|
|
|
|
44
|
return \@softwares; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |