line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Distro::LSB; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
109970099
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
380
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
275
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
|
return canRun('lsb_release'); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub doInventory { |
13
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
16
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $handle = getFileHandle( |
19
|
|
|
|
|
|
|
logger => $logger, |
20
|
|
|
|
|
|
|
command => 'lsb_release -a', |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my ($name, $version, $description); |
24
|
0
|
|
|
|
|
|
while (my $line = <$handle>) { |
25
|
0
|
0
|
|
|
|
|
$name = $1 if $line =~ /^Distributor ID:\s+(.+)/; |
26
|
0
|
0
|
|
|
|
|
$version = $1 if $line =~ /^Release:\s+(.+)/; |
27
|
0
|
0
|
|
|
|
|
$description = $1 if $line =~ /^Description:\s+(.+)/; |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
close $handle; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# See: #1262 |
32
|
0
|
|
|
|
|
|
$description =~ s/^Enterprise Linux Enterprise Linux/Oracle Linux/; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$inventory->setHardware({ |
35
|
|
|
|
|
|
|
OSNAME => $description, |
36
|
|
|
|
|
|
|
}); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
39
|
|
|
|
|
|
|
NAME => $name, |
40
|
|
|
|
|
|
|
VERSION => $version, |
41
|
|
|
|
|
|
|
FULL_NAME => $description |
42
|
|
|
|
|
|
|
}); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |