Merge branch 'main' into development

This commit is contained in:
ricardo.bartels@telekom.de
2023-09-25 09:11:06 +02:00
4 changed files with 18 additions and 4 deletions

View File

@@ -100,7 +100,7 @@ usage: netbox-sync.py [-h] [-c settings.ini [settings.ini ...]] [-g]
Sync objects from various sources to NetBox
Version: 1.5.0 (2023-07-07)
Version: 1.5.1 (2023-09-25)
Project URL: https://github.com/bb-ricardo/netbox-sync
options:

View File

@@ -7,8 +7,8 @@
# For a copy, see file LICENSE.txt included in this
# repository or visit: <https://opensource.org/licenses/MIT>.
__version__ = "1.5.0"
__version_date__ = "2023-07-07"
__version__ = "1.5.1"
__version_date__ = "2023-09-25"
__author__ = "Ricardo Bartels <ricardo.bartels@telekom.de>"
__description__ = "NetBox Sync"
__license__ = "MIT"

View File

@@ -10,6 +10,9 @@
import json
from ipaddress import ip_network, IPv4Network, IPv6Network
# noinspection PyUnresolvedReferences
from packaging import version
from module.common.misc import grab, do_error_exit
from module.common.logging import get_logger
from module.netbox.manufacturer_mapping import sanitize_manufacturer_name
@@ -1513,6 +1516,7 @@ class NBDevice(NetBoxObject):
"name": 64,
"device_type": NBDeviceType,
"device_role": NBDeviceRole,
"role": NBDeviceRole,
"platform": NBPlatform,
"serial": 50,
"site": NBSite,
@@ -1527,6 +1531,16 @@ class NBDevice(NetBoxObject):
}
super().__init__(*args, **kwargs)
def update(self, data=None, read_from_netbox=False, source=None):
# Add adaption for change in NetBox 3.6.0 Device model
if version.parse(self.inventory.netbox_api_version) >= version.parse("3.6.0"):
if data.get("device_role") is not None:
data["role"] = data.get("device_role")
del data["device_role"]
super().update(data=data, read_from_netbox=read_from_netbox, source=source)
class NBVM(NetBoxObject):
name = "virtual machine"

View File

@@ -1,5 +1,5 @@
;;; Welcome to the NetBox Sync configuration file.
;;; Version: 1.5.0 (2023-07-07)
;;; Version: 1.5.1 (2023-09-25)
;;; Project URL: https://github.com/bb-ricardo/netbox-sync
; The values in this file override the default values used by the system if a config