Open bit opened 1 year ago
This happened for an HP Blade where the bays did not have the names expected. An error was printed earlier but it did not fail.
"Could not find slot {slot} for chassis" was printed
so might be better fail in that case instead of throwing an error later. or adjust the check in power so it can handle the missing parent
Hi, I got the same issue @Solvik if you have an idea please.
Traceback (most recent call last):
File "/opt/pyenv/versions/3.9.2/bin/netbox_agent", line 8, in <module>
sys.exit(main())
File "/opt/pyenv/versions/3.9.2/lib/python3.9/site-packages/netbox_agent/cli.py", line 50, in main
return run(config)
File "/opt/pyenv/versions/3.9.2/lib/python3.9/site-packages/netbox_agent/cli.py", line 43, in run
server.netbox_create_or_update(config)
File "/opt/pyenv/versions/3.9.2/lib/python3.9/site-packages/netbox_agent/server.py", line 422, in netbox_create_or_update
self.power = PowerSupply(server=self)
File "/opt/pyenv/versions/3.9.2/lib/python3.9/site-packages/netbox_agent/power.py", line 14, in __init__
self.device_id = self.netbox_server.parent_device.id if self.netbox_server else None
AttributeError: 'NoneType' object has no attribute 'id'
My file :
# Network configuration
network:
# Regex to ignore interfaces
ignore_interfaces: "(dummy.*|docker.*)"
# Regex to ignore IP addresses
ignore_ips: (127\.0\.0\..*)
# enable auto-cabling by parsing LLDP answers
#lldp: true
#
# You can use these to change the Netbox roles.
# These are the defaults.
#
device:
# chassis_role: "HPE BladeSystem c7000 Enclosure"
blade_role: "Blade"
server_role: "Server"
# tags: server, blade, ,just a comma,delimited,list
# custom_fields: field1="value1"
#
# Can use this to set the tenant
#
#tenant:
# driver: "file:/tmp/tenant"
# regex: "(.*)"
## Enable virtual machine support
# virtual:
# # not mandatory, can be guessed
# enabled: True
# # see https://netbox.company.com/virtualization/clusters/
# cluster_name: my_vm_cluster
# Enable datacenter location feature in Netbox
datacenter_location:
#driver: "cmd:cat /etc/qualification | tr [A-Z] [a-z]"
driver: "cmd:cat /etc/netbox-agent/site | tr [A-Z] [a-z]"
#regex: "datacenter: (?P<datacenter>[A-Za-z0-9]+)"
regex: "(?P<datacenter>.+)"
#driver: 'cmd:lldpctl'
#regex: 'SysName: .*\.([A-Za-z0-9]+)'
#
# driver: "file:/tmp/datacenter"
# regex: "(.*)"
# Enable rack location feature in Netbox
#rack_location:
# driver: 'cmd:lldpctl'
# match SysName: sw-dist-a1.dc42
# regex: 'SysName:[ ]+[A-Za-z]+-[A-Za-z]+-([A-Za-z0-9]+)'
#
# driver: "file:/tmp/datacenter"
# regex: "(.*)"
# Enable local inventory reporting
inventory: true
register fails with: