line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Solaris::Bios; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
91614723
|
use strict; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
105
|
|
4
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
91
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use Config; |
|
1
|
|
|
|
|
59
|
|
|
1
|
|
|
|
|
108
|
|
7
|
1
|
|
|
1
|
|
7
|
use List::Util qw(first); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
316
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
643
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
218
|
|
10
|
1
|
|
|
1
|
|
773
|
use FusionInventory::Agent::Tools::Solaris; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1372
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub isEnabled { |
13
|
|
|
|
|
|
|
return |
14
|
0
|
|
0
|
0
|
0
|
|
canRun('showrev') || |
15
|
|
|
|
|
|
|
canRun('/usr/sbin/smbios'); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub doInventory { |
19
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
22
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
my $arch = $Config{archname} =~ /^i86pc/ ? 'i386' : 'sparc'; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my ($bios, $hardware); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if (getZone() eq 'global') { |
29
|
0
|
0
|
|
|
|
|
if (canRun('showrev')) { |
30
|
0
|
|
|
|
|
|
my $infos = _parseShowRev(logger => $logger); |
31
|
0
|
|
|
|
|
|
$bios->{SMODEL} = $infos->{'Application architecture'}; |
32
|
0
|
|
|
|
|
|
$bios->{SMANUFACTURER} = $infos->{'Hardware provider'}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if ($arch eq "i386") { |
36
|
0
|
|
|
|
|
|
my $infos = _parseSmbios(logger => $logger); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $biosInfos = $infos->{SMB_TYPE_BIOS}; |
39
|
0
|
|
|
|
|
|
$bios->{BMANUFACTURER} = $biosInfos->{'Vendor'}; |
40
|
0
|
|
|
|
|
|
$bios->{BVERSION} = $biosInfos->{'Version String'}; |
41
|
0
|
|
|
|
|
|
$bios->{BDATE} = $biosInfos->{'Release Date'}; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $systemInfos = $infos->{SMB_TYPE_SYSTEM}; |
44
|
0
|
|
|
|
|
|
$bios->{SMANUFACTURER} = $systemInfos->{'Manufacturer'}; |
45
|
0
|
|
|
|
|
|
$bios->{SMODEL} = $systemInfos->{'Product'}; |
46
|
0
|
|
|
|
|
|
$bios->{SKUNUMBER} = $systemInfos->{'SKU Number'}; |
47
|
0
|
|
|
|
|
|
$hardware->{UUID} = $systemInfos->{'UUID'}; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $motherboardInfos = $infos->{SMB_TYPE_BASEBOARD}; |
50
|
0
|
|
|
|
|
|
$bios->{MMODEL} = $motherboardInfos->{'Product'}; |
51
|
0
|
|
|
|
|
|
$bios->{MSN} = $motherboardInfos->{'Serial Number'}; |
52
|
0
|
|
|
|
|
|
$bios->{MMANUFACTURER} = $motherboardInfos->{'Manufacturer'}; |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
|
my $info = getPrtconfInfos(logger => $logger); |
55
|
0
|
0
|
|
|
|
|
if ($info) { |
56
|
0
|
|
|
0
|
|
|
my $root = first { ref $_ eq 'HASH' } values %$info; |
|
0
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$bios->{SMODEL} = $root->{'banner-name'}; |
58
|
0
|
0
|
|
|
|
|
if ($root->{openprom}->{version} =~ |
59
|
|
|
|
|
|
|
m{OBP \s+ ([\d.]+) \s+ (\d{4})/(\d{2})/(\d{2})}x) { |
60
|
0
|
|
|
|
|
|
$bios->{BVERSION} = $1; |
61
|
0
|
|
|
|
|
|
$bios->{BDATE} = join('/', $4, $3, $2); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
my $command = -x '/opt/SUNWsneep/bin/sneep' ? |
66
|
|
|
|
|
|
|
'/opt/SUNWsneep/bin/sneep' : 'sneep'; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$bios->{SSN} = getFirstLine( |
69
|
|
|
|
|
|
|
command => $command, |
70
|
|
|
|
|
|
|
logger => $logger |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$hardware->{UUID} = _getUUID( |
74
|
|
|
|
|
|
|
command => '/usr/sbin/zoneadm -z global list -p', |
75
|
|
|
|
|
|
|
logger => $logger |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} else { |
79
|
0
|
|
|
|
|
|
my $infos = _parseShowRev(logger => $logger); |
80
|
0
|
|
|
|
|
|
$bios->{SMANUFACTURER} = $infos->{'Hardware provider'}; |
81
|
0
|
|
|
|
|
|
$bios->{SMODEL} = "Solaris Containers"; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if ($arch eq 'sparc') { |
84
|
0
|
|
|
|
|
|
$hardware->{UUID} = _getUUID( |
85
|
|
|
|
|
|
|
command => '/usr/sbin/zoneadm list -p', |
86
|
|
|
|
|
|
|
logger => $logger |
87
|
|
|
|
|
|
|
) |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$inventory->setBios($bios); |
92
|
0
|
|
|
|
|
|
$inventory->setHardware($hardware); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _parseShowRev { |
96
|
0
|
|
|
0
|
|
|
my (%params) = ( |
97
|
|
|
|
|
|
|
command => 'showrev', |
98
|
|
|
|
|
|
|
@_ |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
102
|
0
|
0
|
|
|
|
|
return unless $handle; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my $infos; |
105
|
0
|
|
|
|
|
|
while (my $line = <$handle>) { |
106
|
0
|
0
|
|
|
|
|
next unless $line =~ /^ ([^:]+) : \s+ (\S+)/x; |
107
|
0
|
|
|
|
|
|
$infos->{$1} = $2; |
108
|
|
|
|
|
|
|
} |
109
|
0
|
|
|
|
|
|
close $handle; |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
return $infos; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _parseSmbios { |
115
|
0
|
|
|
0
|
|
|
my (%params) = ( |
116
|
|
|
|
|
|
|
command => '/usr/sbin/smbios', |
117
|
|
|
|
|
|
|
@_ |
118
|
|
|
|
|
|
|
); |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
121
|
0
|
0
|
|
|
|
|
return unless $handle; |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
my ($infos, $current); |
124
|
0
|
|
|
|
|
|
while (my $line = <$handle>) { |
125
|
0
|
0
|
|
|
|
|
if ($line =~ /^ \d+ \s+ \d+ \s+ (\S+)/x) { |
126
|
0
|
|
|
|
|
|
$current = $1; |
127
|
0
|
|
|
|
|
|
next; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
if ($line =~ /^ \s* ([^:]+) : \s* (.+) $/x) { |
131
|
0
|
|
|
|
|
|
$infos->{$current}->{$1} = $2; |
132
|
0
|
|
|
|
|
|
next; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
} |
135
|
0
|
|
|
|
|
|
close $handle; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
return $infos; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub _getUUID { |
141
|
0
|
|
|
0
|
|
|
my (%params) = ( |
142
|
|
|
|
|
|
|
command => '/usr/sbin/zoneadm list -p', |
143
|
|
|
|
|
|
|
@_ |
144
|
|
|
|
|
|
|
); |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
my $line = getFirstLine(%params); |
147
|
0
|
0
|
|
|
|
|
return unless $line; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my @info = split(/:/, $line); |
150
|
0
|
|
|
|
|
|
my $uuid = $info[4]; |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
return $uuid; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |