File Coverage

blib/lib/FusionInventory/Agent/Task/Inventory/Generic/Hostname.pm
Criterion Covered Total %
statement 15 21 71.4
branch n/a
condition n/a
subroutine 5 7 71.4
pod 0 2 0.0
total 20 30 66.6


line stmt bran cond sub pod time code
1             package FusionInventory::Agent::Task::Inventory::Generic::Hostname;
2              
3 1     1   124345137 use English qw(-no_match_vars);
  1         4  
  1         52  
4              
5 1     1   1097 use strict;
  1         2  
  1         42  
6 1     1   5 use warnings;
  1         91  
  1         84  
7              
8 1     1   919 use Sys::Hostname;
  1         1690  
  1         60  
9              
10 1     1   702 use FusionInventory::Agent::Tools;
  1         3  
  1         301  
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;