line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::AIX::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
86039892
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
72
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
367
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
615
|
|
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
|
|
2490
|
my $handle = getFileHandle(@_); |
39
|
7
|
50
|
|
|
|
17
|
next unless $handle; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# skip headers |
42
|
7
|
|
|
|
|
87
|
my $line = <$handle>; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
7
|
my @softwares; |
45
|
7
|
|
|
|
|
26
|
while (my $line = <$handle>) { |
46
|
4600
|
|
|
|
|
7473
|
my @entry = split(/:/, $line); |
47
|
4600
|
100
|
|
|
|
8464
|
next if $entry[1] =~ /^device/; |
48
|
|
|
|
|
|
|
|
49
|
2497
|
|
|
|
|
3873
|
$entry[6] =~ s/\s+$//; |
50
|
|
|
|
|
|
|
|
51
|
2497
|
|
|
|
|
7648
|
push @softwares, { |
52
|
|
|
|
|
|
|
COMMENTS => $entry[6], |
53
|
|
|
|
|
|
|
FOLDER => $entry[0], |
54
|
|
|
|
|
|
|
NAME => $entry[1], |
55
|
|
|
|
|
|
|
VERSION => $entry[2], |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
} |
58
|
7
|
|
|
|
|
121
|
close $handle; |
59
|
|
|
|
|
|
|
|
60
|
7
|
|
|
|
|
31
|
return \@softwares; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |