@@ -281,19 +281,19 @@ def create_device(self, name, device_role, site_name, device_type, **kwargs):
281281 device_role_id = self .get_device_roles (name = device_role )[0 ]['id' ]
282282 required_fields .update ({"device_role" : device_role_id })
283283 except IndexError :
284- raise exceptions .NotFoundException (' device-role: {}' .format (device_role )) from None
284+ raise exceptions .NotFoundException ({ "detail" : " device-role {}" .format (device_role )} ) from None
285285
286286 try :
287287 site_id = self .get_sites (name = site_name )[0 ]['id' ]
288288 required_fields .update ({"site" : site_id })
289289 except IndexError :
290- raise exceptions .NotFoundException (' site: {}' .format (site_name )) from None
290+ raise exceptions .NotFoundException ({ "detail" : " site: {}" .format (site_name )} ) from None
291291
292292 try :
293293 device_type_id = self .get_device_types (model = device_type )[0 ]['id' ]
294294 required_fields .update ({"device_type" : device_type_id })
295295 except IndexError :
296- raise exceptions .NotFoundException (' device-type: {}' .format (device_type )) from None
296+ raise exceptions .NotFoundException ({ "detail" : " device-type: {}" .format (device_type )} ) from None
297297
298298 return self .netbox_con .post ('/dcim/devices/' , required_fields , ** kwargs )
299299
@@ -306,7 +306,7 @@ def delete_device(self, device_name):
306306 try :
307307 device_id = self .get_devices (name = device_name )[0 ]['id' ]
308308 except IndexError :
309- raise exceptions .NotFoundException (' device: {}' .format (device_name )) from None
309+ raise exceptions .NotFoundException ({ "detail" : " device: {}" .format (device_name )} ) from None
310310 return self .netbox_con .delete ('/dcim/devices/' , device_id )
311311
312312 def delete_device_by_id (self , device_id ):
@@ -362,7 +362,7 @@ def update_device_type(self, device_type, **kwargs):
362362 try :
363363 device_type_id = self .get_device_types (model = device_type )[0 ]['id' ]
364364 except IndexError :
365- raise exceptions .NotFoundException (' device-type: {}' .format (device_type )) from None
365+ raise exceptions .NotFoundException ({ "detail" : " device-type: {}" .format (device_type )} ) from None
366366 return self .netbox_con .patch ('/dcim/device-types/' , device_type_id , ** kwargs )
367367
368368 def update_device_type_by_id (self , device_type_id , ** kwargs ):
@@ -383,7 +383,7 @@ def delete_device_type(self, model_name):
383383 try :
384384 device_type_id = self .get_device_types (model = model_name )[0 ]['id' ]
385385 except IndexError :
386- raise exceptions .NotFoundException (' device-type: {}' .format (model_name )) from None
386+ raise exceptions .NotFoundException ({ "detail" : " device-type: {}" .format (model_name )} ) from None
387387 return self .netbox_con .delete ('/dcim/device-types/' , device_type_id )
388388
389389 def delete_device_type_by_id (self , device_type_id ):
@@ -420,7 +420,7 @@ def update_device_role(self, device_role, **kwargs):
420420 try :
421421 device_role_id = self .get_device_roles (name = device_role )[0 ]['id' ]
422422 except IndexError :
423- raise exceptions .NotFoundException (' device-role: {}' .format (device_role )) from None
423+ raise exceptions .NotFoundException ({ "detail" : " device-role: {}" .format (device_role )} ) from None
424424 return self .netbox_con .patch ('/dcim/device-roles/' , device_role_id , ** kwargs )
425425
426426 def update_device_role_by_id (self , device_role_id , ** kwargs ):
@@ -441,7 +441,7 @@ def delete_device_role(self, device_role):
441441 try :
442442 device_role_id = self .get_device_roles (name = device_role )[0 ]['id' ]
443443 except IndexError :
444- raise exceptions .NotFoundException (' device-role: {}' .format (device_role )) from None
444+ raise exceptions .NotFoundException ({ "detail" : " device-role: {}" .format (device_role )} ) from None
445445 return self .netbox_con .delete ('/dcim/device-roles/' , device_role_id )
446446
447447 def delete_device_role_by_id (self , device_role_id ):
@@ -477,7 +477,7 @@ def update_manufacturer(self, manufacturer_name, **kwargs):
477477 try :
478478 manufacturer_id = self .get_manufacturers (name = manufacturer_name )[0 ]['id' ]
479479 except IndexError :
480- raise exceptions .NotFoundException (' manufacturer: {}' .format (manufacturer_name )) from None
480+ raise exceptions .NotFoundException ({ "detail" : " manufacturer: {}" .format (manufacturer_name )} ) from None
481481 return self .netbox_con .patch ('/dcim/manufacturer/' , manufacturer_id , ** kwargs )
482482
483483 def update_manufacturer_by_id (self , manufacturer_id , ** kwargs ):
@@ -498,7 +498,7 @@ def delete_manufacturer(self, manufacturer_name):
498498 try :
499499 manufacturer_id = self .get_manufacturers (name = manufacturer_name )[0 ]['id' ]
500500 except IndexError :
501- raise exceptions .NotFoundException (' manufacturer: {}' .format (manufacturer_name )) from None
501+ raise exceptions .NotFoundException ({ "detail" : " manufacturer: {}" .format (manufacturer_name )} ) from None
502502 return self .netbox_con .delete ('/dcim/manufacturers/' , manufacturer_id )
503503
504504 def delete_manufacturer_id (self , manufacturer_id ):
@@ -534,7 +534,7 @@ def update_platform(self, platform_name, **kwargs):
534534 try :
535535 platform_id = self .get_platforms (name = platform_name )[0 ]['id' ]
536536 except IndexError :
537- raise exceptions .NotFoundException (' platform: {}' .format (platform_name )) from None
537+ raise exceptions .NotFoundException ({ "detail" : " platform: {}" .format (platform_name )} ) from None
538538 return self .netbox_con .patch ('/dcim/platforms/' , platform_id , ** kwargs )
539539
540540 def update_platform_by_id (self , platform_id , ** kwargs ):
@@ -555,7 +555,7 @@ def delete_platform(self, platform_name):
555555 try :
556556 platform_id = self .get_platforms (name = platform_name )[0 ]['id' ]
557557 except IndexError :
558- raise exceptions .NotFoundException (' platform: {}' .format (platform_name )) from None
558+ raise exceptions .NotFoundException ({ "detail" : " platform: {}" .format (platform_name )} ) from None
559559 return self .netbox_con .delete ('/dcim/platforms/' , platform_id )
560560
561561 def delete_platform_by_id (self , platform_id ):
@@ -593,7 +593,7 @@ def update_interface(self, interface, device, **kwargs):
593593 try :
594594 interface_id = self .get_interfaces (name = interface , device = device )[0 ]['id' ]
595595 except IndexError :
596- raise exceptions .NotFoundException (' interface: {}' .format (interface )) from None
596+ raise exceptions .NotFoundException ({ "detail" : " interface: {}" .format (interface )} ) from None
597597 return self .netbox_con .patch ('/dcim/interfaces/' , interface_id , ** kwargs )
598598
599599 def update_interface_by_id (self , interface_id , ** kwargs ):
@@ -615,7 +615,7 @@ def delete_interface(self, interface_name, device):
615615 try :
616616 interface_id = self .get_interfaces (name = interface_name , device = device )[0 ]['id' ]
617617 except IndexError :
618- raise exceptions .NotFoundException (' interface: {}' .format (interface_name )) from None
618+ raise exceptions .NotFoundException ({ "detail" : " interface: {}" .format (interface_name )} ) from None
619619 return self .netbox_con .delete ('/dcim/interfaces/' , interface_id )
620620
621621 def delete_interface_by_id (self , interface_id ):
@@ -677,7 +677,7 @@ def create_interface_template(self, name, device_type, **kwargs):
677677 try :
678678 device_type_id = self .get_device_types (model = device_type )[0 ]['id' ]
679679 except IndexError :
680- raise exceptions .NotFoundException (' device-type: {}' .format (device_type )) from None
680+ raise exceptions .NotFoundException ({ "detail" : " device-type: {}" .format (device_type )} ) from None
681681 required_fields = {"name" : name , "device_type" : device_type_id }
682682 return self .netbox_con .post ('/dcim/interface-templates/' , required_fields , ** kwargs )
683683
@@ -691,7 +691,7 @@ def update_interface_template(self, interface_template_name, **kwargs):
691691 try :
692692 interface_template_id = self .get_interface_templates (name = interface_template_name )[0 ]['id' ]
693693 except IndexError :
694- raise exceptions .NotFoundException (' interface: {}' .format (interface_template_name )) from None
694+ raise exceptions .NotFoundException ({ "detail" : " interface: {}" .format (interface_template_name )} ) from None
695695 return self .netbox_con .patch ('/dcim/interface-templates/' , interface_template_id , ** kwargs )
696696
697697 def update_interface_template_by_id (self , interface_template_id , ** kwargs ):
@@ -712,7 +712,7 @@ def delete_interface_template(self, interface_template_name):
712712 try :
713713 interface_template_id = self .get_interface_templates (name = interface_template_name )[0 ]['id' ]
714714 except IndexError :
715- raise exceptions .NotFoundException (' interface-template: {}' .format (interface_template_name )) from None
715+ raise exceptions .NotFoundException ({ "detail" : " interface-template: {}" .format (interface_template_name )} ) from None
716716 return self .netbox_con .delete ('/dcim/interface-templates/' , interface_template_id )
717717
718718 def delete_interface_template_by_id (self , interface_template_id ):
@@ -738,7 +738,7 @@ def create_inventory_item(self, name, device_name, **kwargs):
738738 try :
739739 device_id = self .get_devices (name = device_name )[0 ]['id' ]
740740 except IndexError :
741- raise exceptions .NotFoundException (' device: {}' .format (device_name )) from None
741+ raise exceptions .NotFoundException ({ "detail" : " device: {}" .format (device_name )} ) from None
742742 required_fields = {"name" : name , "device" : device_id }
743743 return self .netbox_con .post ('/dcim/inventory-items/' , required_fields , ** kwargs )
744744
@@ -753,7 +753,7 @@ def update_inventory_item(self, name, device_name, **kwargs):
753753 try :
754754 inventory_item_id = self .get_inventory_items (name = name , device = device_name )[0 ]['id' ]
755755 except IndexError :
756- raise exceptions .NotFoundException (' inventory item: {}' .format (name )) from None
756+ raise exceptions .NotFoundException ({ "detail" : " inventory item: {}" .format (name )} ) from None
757757 return self .netbox_con .patch ('/dcim/inventory-items/' , inventory_item_id , ** kwargs )
758758
759759 def update_inventory_item_by_id (self , inventory_item_id , ** kwargs ):
@@ -775,7 +775,7 @@ def delete_inventory_item(self, name, device_name):
775775 try :
776776 inventory_item_id = self .get_inventory_items (name = name , device = device_name )[0 ]['id' ]
777777 except IndexError :
778- raise exceptions .NotFoundException (' inventory item: {}' .format (name )) from None
778+ raise exceptions .NotFoundException ({ "detail" : " inventory item: {}" .format (name )} ) from None
779779 return self .netbox_con .delete ('/dcim/inventory-items/' , inventory_item_id )
780780
781781 def delete_inventory_item_by_id (self , inventory_item_id ):
0 commit comments