File Coverage

blib/lib/FusionInventory/Agent/Task/Inventory/Solaris.pm
Criterion Covered Total %
statement 15 27 55.5
branch n/a
condition n/a
subroutine 5 7 71.4
pod 0 2 0.0
total 20 36 55.5


line stmt bran cond sub pod time code
1             package FusionInventory::Agent::Task::Inventory::Solaris;
2              
3 1     1   30127261 use strict;
  1         5  
  1         41  
4 1     1   4 use warnings;
  1         1  
  1         81  
5              
6 1     1   13 use English qw(-no_match_vars);
  1         47  
  1         27  
7              
8 1     1   1274 use FusionInventory::Agent::Tools;
  1         3  
  1         139  
9 1     1   572 use FusionInventory::Agent::Tools::Solaris;
  1         2  
  1         198  
10              
11             our $runAfter = ["FusionInventory::Agent::Task::Inventory::Generic"];
12              
13             sub isEnabled {
14 0     0 0   return $OSNAME eq 'solaris';
15             }
16              
17             sub doInventory {
18 0     0 0   my (%params) = @_;
19              
20 0           my $inventory = $params{inventory};
21              
22             # Operating system informations
23 0           my $info = getReleaseInfo();
24 0           my $kernelArch = getFirstLine(command => 'arch -k');
25 0           my $kernelVersion = getFirstLine(command => 'uname -v');
26 0           my $proct = getFirstLine(command => 'uname -p');
27 0           my $platform = getFirstLine(command => 'uname -i');
28 0           my $hostid = getFirstLine(command => 'hostid');
29 0           my $description = "$platform($kernelArch)/$proct HostID=$hostid";
30              
31             $inventory->setHardware({
32             OSNAME => "Solaris",
33             OSVERSION => $info->{version},
34             OSCOMMENTS => $info->{subversion},
35 0           DESCRIPTION => $description
36             });
37              
38             $inventory->setOperatingSystem({
39             NAME => "Solaris",
40             FULL_NAME => $info->{fullname},
41             VERSION => $info->{version},
42             SERVICE_PACK => $info->{subversion},
43 0           KERNEL_VERSION => $kernelVersion
44             });
45             }
46              
47             1;