Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
fix: don't validate wiremap if no location, correct test report
Browse files Browse the repository at this point in the history
  • Loading branch information
Lane Seppala authored and lseppala committed Mar 9, 2018
1 parent cf1a907 commit 78457ec
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
6 changes: 2 additions & 4 deletions Conch/lib/Conch/Legacy/Control/Device/Network.pm
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ sub validate_wiremap {
my @eth_nics = grep { $_->iface_name =~ /eth/ } @device_nics;
my $rack_location = $device->device_location;

if ( !$rack_location ) {
error "$device_id is not assigned in a rack; cannot validate wiremap";
return 0;
}
# don't validate wiremap if no location
return 0 unless $rack_location;

my @rack_layout = $schema->resultset('DatacenterRackLayout')->search(
{ rack_id => $rack_location->rack_id },
Expand Down
7 changes: 2 additions & 5 deletions Conch/lib/Conch/Legacy/Control/Device/Validation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ sub validate_device {
$logger->error(
$device->id . ": Marking FAIL because exception occurred: $message" );
return { health => "FAIL", errors => [$message] };
}

my $validation_errors = $@ if $@;
if ( $validation_errors && $validation_errors->exceptions > 0 ) {
my @errors = $validation_errors->exceptions;
} elsif ( $@->exceptions > 0 ) {
my @errors = $@->exceptions;
$logger->warn( $device->id . ": Marking FAIL" );
$device->update( { health => "FAIL" } );
return { health => "FAIL", errors => \@errors };
Expand Down
30 changes: 15 additions & 15 deletions Conch/t/integration/resource/passing-device-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"health": "OK",
"guid": "55cd2e404c3e2cd2",
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"transport": "sas",
"temp": "26",
"slot": "5",
Expand All @@ -28,7 +28,7 @@
"slot": "6",
"hba": "2",
"guid": "55cd2e404c3ab405",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"model": "INTEL",
"size": 1500000,
"vendor": "ATA",
Expand All @@ -45,12 +45,12 @@
"size": 1500000,
"vendor": "ATA",
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"guid": "55cd2e404c3abbac"
},
"BTHC6404073P1P6PGN": {
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"guid": "55cd2e404c3abb9b",
"health": "OK",
"vendor": "ATA",
Expand All @@ -64,7 +64,7 @@
},
"BTHC6404073N1P6PGN": {
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"guid": "55cd2e404c3abb9a",
"health": "OK",
"vendor": "ATA",
Expand All @@ -84,7 +84,7 @@
"slot": "14",
"transport": "sas",
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"guid": "55cd2e404c3abb97",
"health": "OK",
"size": 1500000,
Expand All @@ -94,7 +94,7 @@
"health": "OK",
"size": 1500000,
"vendor": "ATA",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"model": "INTEL",
"guid": "55cd2e404c3abba2",
"temp": "26",
Expand All @@ -114,7 +114,7 @@
"vendor": "Kingston"
},
"BTHC6404074D1P6PGN": {
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"model": "INTEL",
"guid": "55cd2e404c3abbb3",
"health": "OK",
Expand All @@ -136,7 +136,7 @@
"hba": "2",
"guid": "55cd2e404c3abbab",
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"vendor": "ATA",
"size": 1500000,
"health": "OK"
Expand All @@ -163,7 +163,7 @@
"hba": "2",
"temp": "26",
"guid": "55cd2e404c3abbf2",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"model": "INTEL",
"vendor": "ATA",
"size": 1500000,
Expand All @@ -176,7 +176,7 @@
"hba": "2",
"temp": "26",
"transport": "sas",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"model": "INTEL",
"guid": "55cd2e404c3abbb7",
"health": "OK",
Expand All @@ -185,7 +185,7 @@
},
"BTHC64160A5Y1P6PGN": {
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"guid": "55cd2e404c3e34ca",
"health": "OK",
"size": 1500000,
Expand All @@ -199,7 +199,7 @@
},
"BTHC641609B31P6PGN": {
"guid": "55cd2e404c3e2cb9",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"model": "INTEL",
"vendor": "ATA",
"size": 1500000,
Expand All @@ -213,7 +213,7 @@
},
"BTHC6404074L1P6PGN": {
"model": "INTEL",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"guid": "55cd2e404c3abbba",
"health": "OK",
"vendor": "ATA",
Expand All @@ -236,7 +236,7 @@
"size": 1500000,
"health": "OK",
"guid": "55cd2e404c3abbd9",
"drive_type": "SATA_SSD",
"drive_type": "SAS_HDD",
"model": "INTEL"
}
},
Expand Down

0 comments on commit 78457ec

Please sign in to comment.