mirror of
https://github.com/bb-Ricardo/netbox-sync.git
synced 2026-05-05 08:49:43 -05:00
Merge branch 'main' into development
This commit is contained in:
+2
-2
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user