netbox-agent/netbox_agent
Christophe Simon 58775c0950 Added option to purge remaining devices
This patch adds an option to clear remaining devices in the context of a
new device replacing an old one with the same name but with a different
hardware.

The serial leading to the bug is described below:

- A first server is registered under name `A` with serial `X`
- A second server is registered under name `B` with serial `Y`
- The server with serial `X` is decomissionned, but not removed
- The server with serial `Y` is reinstalled with name `A`

In this case, a device with serial `X` is well found, and netbox agent
tries to update its name. But this raises an error because of the unique
constraint on name, as another device already holds this name.

The proposed solution to handle this situation is to delete any device
with same `name` but different `serial` before handling a device.

As this is not necessarily the expected behavior, it can be enabled by
using the `--purge-old-devices` to avoid breaking existing inventory.
2022-02-08 18:46:30 +01:00
..
drivers should have used git mv 2019-08-05 12:03:06 +02:00
raid Fix HP raid controller parsing (#131) 2020-06-10 15:24:43 +02:00
vendors Make flake8 and isort happy 2021-07-09 11:10:43 +02:00
__init__.py Project cleanup (#6) 2019-08-04 00:00:22 +02:00
cli.py Virtual Machine feature (#122) 2020-04-19 12:28:49 +02:00
config.py Added option to purge remaining devices 2022-02-08 18:46:30 +01:00
dmidecode.py Setup tests 2020-02-02 20:24:01 +01:00
ethtool.py fix ethtool class in case ethtool works but returns nothing (#123) 2020-04-19 12:19:28 +02:00
inventory.py Truncate GPU product name to 50 characteres. (#169) 2020-10-14 12:39:57 +02:00
ipmi.py Virtual Machine feature (#122) 2020-04-19 12:28:49 +02:00
lldp.py Make flake8 and isort happy 2021-07-09 11:10:43 +02:00
location.py Add tags,device roles,tenants.. (#110) 2020-07-01 18:54:58 +02:00
logging.py Virtual Machine feature (#122) 2020-04-19 12:28:49 +02:00
lshw.py NVME inventory fix. 2021-07-09 11:00:41 +02:00
misc.py Add tags,device roles,tenants.. (#110) 2020-07-01 18:54:58 +02:00
network.py add 25G compatibility (#185) 2021-05-12 15:50:16 +02:00
power.py fix allocated_draw for inactive PSU (#168) 2020-09-07 14:20:32 +02:00
server.py Added option to purge remaining devices 2022-02-08 18:46:30 +01:00
virtualmachine.py fix not passing tenant when tenants exist in Netbox 2020-07-11 15:33:34 +02:00