fix: dvdrom inventory crash #251
1 changed files with 3 additions and 2 deletions
|
@ -371,13 +371,14 @@ class Inventory():
|
||||||
desc = disk.get('description')
|
desc = disk.get('description')
|
||||||
name = '{} ({})'.format(disk['Model'], disk['Size'])
|
name = '{} ({})'.format(disk['Model'], disk['Size'])
|
||||||
description = disk['Type']
|
description = disk['Type']
|
||||||
|
sn = getattr(disk, 'SN', 'unknown')
|
||||||
|
|
||||||
parms = {
|
parms = {
|
||||||
'device': self.device_id,
|
'device': self.device_id,
|
||||||
'discovered': True,
|
'discovered': True,
|
||||||
'tags': [{'name': INVENTORY_TAG['disk']['name']}],
|
'tags': [{'name': INVENTORY_TAG['disk']['name']}],
|
||||||
'name': name,
|
'name': name,
|
||||||
'serial': disk['SN'],
|
'serial': sn,
|
||||||
'part_id': disk['Model'],
|
'part_id': disk['Model'],
|
||||||
'description': description,
|
'description': description,
|
||||||
'manufacturer': getattr(manufacturer, "id", None),
|
'manufacturer': getattr(manufacturer, "id", None),
|
||||||
|
@ -389,7 +390,7 @@ class Inventory():
|
||||||
|
|
||||||
logging.info('Creating Disk {model} {serial}'.format(
|
logging.info('Creating Disk {model} {serial}'.format(
|
||||||
model=disk['Model'],
|
model=disk['Model'],
|
||||||
serial=disk['SN'],
|
serial=sn,
|
||||||
))
|
))
|
||||||
|
|
||||||
def dump_disks_map(self, disks):
|
def dump_disks_map(self, disks):
|
||||||
|
|
Loading…
Add table
Reference in a new issue