line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::Dmidecode::Slots; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
120094101
|
use strict; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
99
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
71
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
395
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
141
|
|
7
|
1
|
|
|
1
|
|
470
|
use FusionInventory::Agent::Tools::Generic; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
313
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %status = ( |
10
|
|
|
|
|
|
|
'Unknown' => undef, |
11
|
|
|
|
|
|
|
'In Use' => 'used', |
12
|
|
|
|
|
|
|
'Available' => 'free' |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub isEnabled { |
16
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
17
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{slot}; |
18
|
0
|
|
|
|
|
|
return 1; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub doInventory { |
22
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
25
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $slots = _getSlots(logger => $logger); |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
return unless $slots; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
foreach my $slot (@$slots) { |
32
|
0
|
|
|
|
|
|
$inventory->addEntry( |
33
|
|
|
|
|
|
|
section => 'SLOTS', |
34
|
|
|
|
|
|
|
entry => $slot |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _getSlots { |
40
|
0
|
|
|
0
|
|
|
my $infos = getDmidecodeInfos(@_); |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
return unless $infos->{9}; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $slots; |
45
|
0
|
|
|
|
|
|
foreach my $info (@{$infos->{9}}) { |
|
0
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
my $slot = { |
47
|
|
|
|
|
|
|
DESCRIPTION => $info->{'Type'}, |
48
|
|
|
|
|
|
|
DESIGNATION => $info->{'ID'}, |
49
|
|
|
|
|
|
|
NAME => $info->{'Designation'}, |
50
|
|
|
|
|
|
|
STATUS => $info->{'Current Usage'} ? |
51
|
|
|
|
|
|
|
$status{$info->{'Current Usage'}} : undef, |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
push @$slots, $slot; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $slots; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |