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:
parent
7999244096
commit
00653628c6
1 changed files with 2 additions and 0 deletions
|
@ -442,6 +442,8 @@ class Inventory():
|
||||||
|
|
||||||
def create_netbox_gpus(self):
|
def create_netbox_gpus(self):
|
||||||
for gpu in self.lshw.get_hw_linux('gpu'):
|
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"])
|
manufacturer = self.find_or_create_manufacturer(gpu["vendor"])
|
||||||
_ = nb.dcim.inventory_items.create(
|
_ = nb.dcim.inventory_items.create(
|
||||||
device=self.device_id,
|
device=self.device_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue