line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::Softwares::RPM; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
154490018
|
use strict; |
|
2
|
|
|
|
|
25
|
|
|
2
|
|
|
|
|
171
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
104
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
688
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1155
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
0
|
return canRun('rpm'); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub doInventory { |
13
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
16
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
my $command = |
19
|
|
|
|
|
|
|
'rpm -qa --queryformat \'' . |
20
|
|
|
|
|
|
|
'%{NAME}\t' . |
21
|
|
|
|
|
|
|
'%{ARCH}\t' . |
22
|
|
|
|
|
|
|
'%{VERSION}-%{RELEASE}\t' . |
23
|
|
|
|
|
|
|
'%{INSTALLTIME:date}\t' . |
24
|
|
|
|
|
|
|
'%{SIZE}\t' . |
25
|
|
|
|
|
|
|
'%{VENDOR}\t' . |
26
|
|
|
|
|
|
|
'%{SUMMARY}\n' . |
27
|
|
|
|
|
|
|
'\''; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
my $packages = _getPackagesList( |
30
|
|
|
|
|
|
|
logger => $logger, command => $command |
31
|
|
|
|
|
|
|
); |
32
|
0
|
0
|
|
|
|
0
|
return unless $packages; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
foreach my $package (@$packages) { |
35
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
36
|
|
|
|
|
|
|
section => 'SOFTWARES', |
37
|
|
|
|
|
|
|
entry => $package |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _getPackagesList { |
43
|
1
|
|
|
1
|
|
12
|
my $handle = getFileHandle(@_); |
44
|
1
|
50
|
|
|
|
4
|
return unless $handle; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
1
|
my @packages; |
47
|
1
|
|
|
|
|
13
|
while (my $line = <$handle>) { |
48
|
10
|
|
|
|
|
14
|
chomp $line; |
49
|
10
|
|
|
|
|
35
|
my @infos = split("\t", $line); |
50
|
10
|
|
|
|
|
111
|
my $package = { |
51
|
|
|
|
|
|
|
NAME => $infos[0], |
52
|
|
|
|
|
|
|
ARCH => $infos[1], |
53
|
|
|
|
|
|
|
VERSION => $infos[2], |
54
|
|
|
|
|
|
|
INSTALLDATE => $infos[3], |
55
|
|
|
|
|
|
|
FILESIZE => $infos[4], |
56
|
|
|
|
|
|
|
COMMENTS => $infos[6], |
57
|
|
|
|
|
|
|
FROM => 'rpm' |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
10
|
50
|
|
|
|
34
|
$package->{PUBLISHER} = $infos[5] if $infos[5] ne '(none)'; |
61
|
|
|
|
|
|
|
|
62
|
10
|
|
|
|
|
43
|
push @packages, $package; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
9
|
close $handle; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
5
|
return \@packages; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |