replace device_role with role

This commit is contained in:
clbu 2024-08-07 12:24:49 +02:00
parent ba4cdb217b
commit ee41fb4fc2
No known key found for this signature in database
GPG key ID: 0891443A5398527F
3 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View file

@ -181,3 +181,4 @@ dmypy.json
# End of https://www.gitignore.io/api/emacs,python # End of https://www.gitignore.io/api/emacs,python
netbox-docker netbox-docker
/.vscode

View file

@ -34,8 +34,8 @@ def run(config):
except KeyError: except KeyError:
server = GenericHost(dmi=dmi) server = GenericHost(dmi=dmi)
if version.parse(nb.version) < version.parse('2.9'): if version.parse(nb.version) < version.parse('3.7'):
print('netbox-agent is not compatible with Netbox prior to verison 2.9') print('netbox-agent is not compatible with Netbox prior to verison 3.7')
return False return False
if config.register or config.update_all or config.update_network or \ if config.register or config.update_all or config.update_network or \

View file

@ -199,7 +199,7 @@ class ServerBase():
name=self.get_chassis_name(), name=self.get_chassis_name(),
device_type=device_type.id, device_type=device_type.id,
serial=serial, serial=serial,
device_role=device_role.id, role=device_role.id,
site=datacenter.id if datacenter else None, site=datacenter.id if datacenter else None,
tenant=tenant.id if tenant else None, tenant=tenant.id if tenant else None,
rack=rack.id if rack else None, rack=rack.id if rack else None,
@ -220,7 +220,7 @@ class ServerBase():
new_blade = nb.dcim.devices.create( new_blade = nb.dcim.devices.create(
name=hostname, name=hostname,
serial=serial, serial=serial,
device_role=device_role.id, role=device_role.id,
device_type=device_type.id, device_type=device_type.id,
parent_device=chassis.id, parent_device=chassis.id,
site=datacenter.id if datacenter else None, site=datacenter.id if datacenter else None,
@ -243,7 +243,7 @@ class ServerBase():
new_blade = nb.dcim.devices.create( new_blade = nb.dcim.devices.create(
name=hostname, name=hostname,
serial=serial, serial=serial,
device_role=device_role.id, role=device_role.id,
device_type=device_type.id, device_type=device_type.id,
parent_device=chassis.id, parent_device=chassis.id,
site=datacenter.id if datacenter else None, site=datacenter.id if datacenter else None,
@ -272,7 +272,7 @@ class ServerBase():
new_server = nb.dcim.devices.create( new_server = nb.dcim.devices.create(
name=hostname, name=hostname,
serial=serial, serial=serial,
device_role=device_role.id, role=device_role.id,
device_type=device_type.id, device_type=device_type.id,
platform=self.device_platform.id, platform=self.device_platform.id,
site=datacenter.id if datacenter else None, site=datacenter.id if datacenter else None,