Merge pull request #2552 from balena-io/reject-drives-null-size

fix(GUI): Reject drives with null size
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2018-11-22 20:50:56 +01:00 committed by GitHub
commit aa1e83dc24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 13 deletions

View File

@ -92,7 +92,7 @@ class BlockDeviceAdapter extends EventEmitter {
if (drive.busType === 'RAID') { if (drive.busType === 'RAID') {
return false return false
} }
return !drive.error && (options.includeSystemDrives || !drive.isSystem) return !drive.error && Number.isFinite(drive.size) && (options.includeSystemDrives || !drive.isSystem)
}).map((drive) => { }).map((drive) => {
drive.displayName = drive.device drive.displayName = drive.device
if (/PhysicalDrive/i.test(drive.device) && drive.mountpoints.length) { if (/PhysicalDrive/i.test(drive.device) && drive.mountpoints.length) {

View File

@ -65,7 +65,7 @@ describe('Model: availableDrives', function () {
{ {
device: '/dev/sdb', device: '/dev/sdb',
description: 'Foo', description: 'Foo',
size: '14G', size: 14000000000,
mountpoints: [ { mountpoints: [ {
path: '/mnt/foo' path: '/mnt/foo'
} ], } ],
@ -82,7 +82,7 @@ describe('Model: availableDrives', function () {
{ {
device: '/dev/sdb', device: '/dev/sdb',
description: 'Foo', description: 'Foo',
size: '14G', size: 14000000000,
mountpoints: [ { mountpoints: [ {
path: '/mnt/foo' path: '/mnt/foo'
} ], } ],

View File

@ -118,7 +118,7 @@ describe('Browser: driveScanner', function () {
device: '/dev/sdb', device: '/dev/sdb',
displayName: '/dev/sdb', displayName: '/dev/sdb',
description: 'Foo', description: 'Foo',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: '/mnt/foo' path: '/mnt/foo'
@ -131,7 +131,7 @@ describe('Browser: driveScanner', function () {
device: '/dev/sdc', device: '/dev/sdc',
displayName: '/dev/sdc', displayName: '/dev/sdc',
description: 'Bar', description: 'Bar',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: '/mnt/bar' path: '/mnt/bar'
@ -158,7 +158,7 @@ describe('Browser: driveScanner', function () {
device: '/dev/sdb', device: '/dev/sdb',
displayName: '/dev/sdb', displayName: '/dev/sdb',
description: 'Foo', description: 'Foo',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: '/mnt/foo' path: '/mnt/foo'
@ -172,7 +172,7 @@ describe('Browser: driveScanner', function () {
device: '/dev/sdc', device: '/dev/sdc',
displayName: '/dev/sdc', displayName: '/dev/sdc',
description: 'Bar', description: 'Bar',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: '/mnt/bar' path: '/mnt/bar'
@ -230,7 +230,7 @@ describe('Browser: driveScanner', function () {
device: '\\\\.\\PHYSICALDRIVE2', device: '\\\\.\\PHYSICALDRIVE2',
displayName: '\\\\.\\PHYSICALDRIVE2', displayName: '\\\\.\\PHYSICALDRIVE2',
description: 'Foo', description: 'Foo',
size: '14G', size: 14000000000,
mountpoints: [], mountpoints: [],
isSystem: false, isSystem: false,
isRemovable: false isRemovable: false
@ -239,7 +239,7 @@ describe('Browser: driveScanner', function () {
device: '\\\\.\\PHYSICALDRIVE3', device: '\\\\.\\PHYSICALDRIVE3',
displayName: 'F:', displayName: 'F:',
description: 'Bar', description: 'Bar',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: 'F:' path: 'F:'
@ -266,7 +266,7 @@ describe('Browser: driveScanner', function () {
device: '\\\\.\\PHYSICALDRIVE2', device: '\\\\.\\PHYSICALDRIVE2',
displayName: '\\\\.\\PHYSICALDRIVE2', displayName: '\\\\.\\PHYSICALDRIVE2',
description: 'Foo', description: 'Foo',
size: '14G', size: 14000000000,
mountpoints: [], mountpoints: [],
adapter: 'blockdevice', adapter: 'blockdevice',
isSystem: false, isSystem: false,
@ -276,7 +276,7 @@ describe('Browser: driveScanner', function () {
device: '\\\\.\\PHYSICALDRIVE3', device: '\\\\.\\PHYSICALDRIVE3',
displayName: 'F:', displayName: 'F:',
description: 'Bar', description: 'Bar',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: 'F:' path: 'F:'
@ -309,7 +309,7 @@ describe('Browser: driveScanner', function () {
device: '\\\\.\\PHYSICALDRIVE3', device: '\\\\.\\PHYSICALDRIVE3',
raw: '\\\\.\\PHYSICALDRIVE3', raw: '\\\\.\\PHYSICALDRIVE3',
description: 'Bar', description: 'Bar',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: 'F:' path: 'F:'
@ -355,7 +355,7 @@ describe('Browser: driveScanner', function () {
device: '\\\\.\\PHYSICALDRIVE3', device: '\\\\.\\PHYSICALDRIVE3',
raw: '\\\\.\\PHYSICALDRIVE3', raw: '\\\\.\\PHYSICALDRIVE3',
description: 'Bar', description: 'Bar',
size: '14G', size: 14000000000,
mountpoints: [ mountpoints: [
{ {
path: 'F:' path: 'F:'