line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::Hostname; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
106063766
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
25
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
995
|
use strict; |
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
45
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
57
|
|
|
1
|
|
|
|
|
75
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
720
|
use Sys::Hostname; |
|
1
|
|
|
|
|
1671
|
|
|
1
|
|
|
|
|
78
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
578
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
205
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub isEnabled { |
13
|
|
|
|
|
|
|
# We use WMI for Windows because of charset issue |
14
|
0
|
|
|
0
|
0
|
|
return $OSNAME ne 'MSWin32'; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub doInventory { |
18
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $hostname = hostname(); |
23
|
0
|
|
|
|
|
|
$hostname =~ s/\..*//; # keep just the hostname |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$inventory->setHardware({NAME => $hostname}); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |