Truncate GPU product name to 50 characteres. (#169)

Example: Hi1710 [iBMC Intelligent Management system chip w/VGA support]
This product is too long, the api want max_length = 50 ...
This commit is contained in:
Cyrinux 2020-10-14 12:39:57 +02:00 committed by GitHub
parent 7999244096
commit 00653628c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -442,6 +442,8 @@ class Inventory():
def create_netbox_gpus(self):
for gpu in self.lshw.get_hw_linux('gpu'):
if 'product' in gpu and len(gpu['product']) > 50:
gpu['product'] = (gpu['product'][:48] + '..')
manufacturer = self.find_or_create_manufacturer(gpu["vendor"])
_ = nb.dcim.inventory_items.create(
device=self.device_id,