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   96667874 use English qw(-no_match_vars);
  1         14  
  1         44  
4              
5 1     1   1201 use strict;
  1         8  
  1         62  
6 1     1   9 use warnings;
  1         63  
  1         84  
7              
8 1     1   814 use Sys::Hostname;
  1         2063  
  1         83  
9              
10 1     1   633 use FusionInventory::Agent::Tools;
  1         3  
  1         210  
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;