make InventoryItem's name attribute <50 char for memory DIMM (#67)

This commit is contained in:
Solvik 2019-09-09 16:52:25 +02:00 committed by GitHub
parent f68fed18b4
commit ba8f58180e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -399,16 +399,16 @@ class Inventory():
def create_netbox_memory(self, memory): def create_netbox_memory(self, memory):
manufacturer = self.find_or_create_manufacturer(memory['vendor']) manufacturer = self.find_or_create_manufacturer(memory['vendor'])
name = 'Slot {} ({}GB)'.format(memory['slot'], memory['size'])
nb_memory = nb.dcim.inventory_items.create( nb_memory = nb.dcim.inventory_items.create(
device=self.device_id, device=self.device_id,
discovered=True, discovered=True,
manufacturer=manufacturer.id, manufacturer=manufacturer.id,
tags=[INVENTORY_TAG['memory']['name']], tags=[INVENTORY_TAG['memory']['name']],
name='{} ({}GB)'.format(memory['description'], memory['size']), name=name,
part_id=memory['product'], part_id=memory['product'],
serial=memory['serial'], serial=memory['serial'],
description='Slot {}'.format(memory['slot']), description=memory['description'],
) )
logging.info('Creating Memory {location} {type} {size}GB'.format( logging.info('Creating Memory {location} {type} {size}GB'.format(