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