From 30815217744663d2232cc849bb81ac240a04417f Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Mon, 10 Sep 2018 17:41:19 +0200 Subject: [PATCH] feature(esx): servicetag & assettag support update Support 2 ServiceTags case to cover chassis & lame board S/N inventory Updated AssetTag support --- Changes | 4 +++ lib/FusionInventory/Agent/SOAP/VMware/Host.pm | 31 +++++++++++-------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Changes b/Changes index e7aba016cc..4832850473 100644 --- a/Changes +++ b/Changes @@ -24,6 +24,10 @@ deploy: * not p2p file parts are now cleaned up after job success if retention duration is null +esx: +* Support 2 ServiceTags case to cover chassis & lame board S/N inventory +* Updated AssetTag support + maintenance: * bump Maintenance task version to 1.1 * disable Maintenance task if no maintenance module could be used diff --git a/lib/FusionInventory/Agent/SOAP/VMware/Host.pm b/lib/FusionInventory/Agent/SOAP/VMware/Host.pm index e1ff090d2e..e54fccee94 100644 --- a/lib/FusionInventory/Agent/SOAP/VMware/Host.pm +++ b/lib/FusionInventory/Agent/SOAP/VMware/Host.pm @@ -47,31 +47,36 @@ sub getBiosInfo { my $hardware = $self->{hash}[0]{hardware}; my $biosInfo = $hardware->{biosInfo}; my $systemInfo = $hardware->{systemInfo}; - my $ssn; return unless ref($biosInfo) eq 'HASH'; - my $identifierValue; + my $bios = { + BDATE => $biosInfo->{releaseDate}, + BVERSION => $biosInfo->{biosVersion}, + SMODEL => $systemInfo->{model}, + SMANUFACTURER => $systemInfo->{vendor} + }; + if (ref($systemInfo->{otherIdentifyingInfo}) eq 'HASH') { - $identifierValue = $systemInfo->{otherIdentifyingInfo}->{identifierValue}; + $bios->{ASSETTAG} = $systemInfo->{otherIdentifyingInfo}->{identifierValue}; } elsif (ref($systemInfo->{otherIdentifyingInfo}) eq 'ARRAY') { foreach (@{$systemInfo->{otherIdentifyingInfo}}) { if ($_->{identifierType}->{key} eq 'ServiceTag') { - $ssn = $_->{identifierValue}; - last; + # In the case we found more than one ServiceTag, assume there will be + # only two, the first being the chassis S/N, the second the system S/N + # This cover the case where the second is the lame board S/N + if ($bios->{SSN}) { + $bios->{MSN} = $bios->{SSN}; + } + $bios->{SSN} = $_->{identifierValue}; + } elsif ($_->{identifierType}->{key} eq 'AssetTag') { + $bios->{ASSETTAG} = $_->{identifierValue}; } } } - return { - BDATE => $biosInfo->{releaseDate}, - BVERSION => $biosInfo->{biosVersion}, - SMODEL => $systemInfo->{model}, - SMANUFACTURER => $systemInfo->{vendor}, - ASSETTAG => $identifierValue, - SSN => $ssn - }; + return $bios; } sub getHardwareInfo {