File Coverage

blib/lib/FusionInventory/Agent/Task/Inventory/MacOS/Bios.pm
Criterion Covered Total %
statement 12 21 57.1
branch n/a
condition 0 11 0.0
subroutine 4 6 66.6
pod 0 2 0.0
total 16 40 40.0


line stmt bran cond sub pod time code
1             package FusionInventory::Agent::Task::Inventory::MacOS::Bios;
2              
3 1     1   68169369 use strict;
  1         19  
  1         83  
4 1     1   6 use warnings;
  1         1  
  1         63  
5              
6 1     1   511 use FusionInventory::Agent::Tools;
  1         2  
  1         137  
7 1     1   408 use FusionInventory::Agent::Tools::MacOS;
  1         2  
  1         238  
8              
9             sub isEnabled {
10 0     0 0   return canRun('/usr/sbin/system_profiler');
11             }
12              
13             sub doInventory {
14 0     0 0   my (%params) = @_;
15              
16 0           my $inventory = $params{inventory};
17 0           my $logger = $params{logger};
18              
19 0           my $infos = getSystemProfilerInfos(logger => $logger);
20 0           my $info = $infos->{'Hardware'}->{'Hardware Overview'};
21              
22 0           my ($device) = getIODevices(
23             class => 'IOPlatformExpertDevice',
24             logger => $logger
25             );
26              
27             # set the bios informaiton from the apple system profiler
28 0   0       $inventory->setBios({
      0        
      0        
29             SMANUFACTURER => $device->{'manufacturer'} || 'Apple Inc', # duh
30             SMODEL => $info->{'Model Identifier'} ||
31             $info->{'Machine Model'},
32             # New method to get the SSN, because of MacOS 10.5.7 update
33             # system_profiler gives 'Serial Number (system): XXXXX' where 10.5.6
34             # and lower give 'Serial Number: XXXXX'
35             SSN => $info->{'Serial Number'} ||
36             $info->{'Serial Number (system)'} ||
37             $device->{'serial-number'},
38             BVERSION => $info->{'Boot ROM Version'},
39             });
40              
41 0   0       $inventory->setHardware({
42             UUID => $info->{'Hardware UUID'} || $device->{'IOPlatformUUID'}
43             });
44             }
45              
46             1;