line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::HPUX::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
70118158
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
71
|
|
4
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
425
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
363
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
return |
12
|
0
|
|
0
|
|
|
|
!$params{no_category}->{software} && |
13
|
|
|
|
|
|
|
canRun('swlist'); |
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 $list = _getSoftwaresList( |
23
|
|
|
|
|
|
|
command => 'swlist', |
24
|
|
|
|
|
|
|
logger => $logger |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
return unless $list; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
foreach my $software (@$list) { |
30
|
0
|
|
|
|
|
|
$inventory->addEntry( |
31
|
|
|
|
|
|
|
section => 'SOFTWARES', |
32
|
|
|
|
|
|
|
entry => $software |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _getSoftwaresList { |
38
|
0
|
|
|
0
|
|
|
my $handle = getFileHandle(@_); |
39
|
0
|
0
|
|
|
|
|
return unless $handle; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my @softwares; |
42
|
0
|
|
|
|
|
|
while (my $line = <$handle>) { |
43
|
0
|
|
|
|
|
|
chomp $line; |
44
|
0
|
0
|
|
|
|
|
next unless $line =~ /^ |
45
|
|
|
|
|
|
|
\s\s # two spaces |
46
|
|
|
|
|
|
|
(\S+) # name |
47
|
|
|
|
|
|
|
\s+ |
48
|
|
|
|
|
|
|
(\S+) # version |
49
|
|
|
|
|
|
|
\s+ |
50
|
|
|
|
|
|
|
(\S.*\S) # comment |
51
|
|
|
|
|
|
|
/x; |
52
|
0
|
0
|
|
|
|
|
next if $1 =~ /^PH/; |
53
|
0
|
|
|
|
|
|
push @softwares, { |
54
|
|
|
|
|
|
|
NAME => $1, |
55
|
|
|
|
|
|
|
VERSION => $2, |
56
|
|
|
|
|
|
|
COMMENTS => $3, |
57
|
|
|
|
|
|
|
PUBLISHER => 'HP' |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
close $handle; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return \@softwares; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |