mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-16 04:02:56 -06:00
Added hostname filtering based on Cyrillic characters
This commit is contained in:
parent
56c19d97de
commit
30545ec0f3
@ -4,6 +4,7 @@
|
|||||||
Device specific handeling for Netbox to Zabbix
|
Device specific handeling for Netbox to Zabbix
|
||||||
"""
|
"""
|
||||||
from os import sys
|
from os import sys
|
||||||
|
from re import search
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from zabbix_utils import APIRequestError
|
from zabbix_utils import APIRequestError
|
||||||
from modules.exceptions import (SyncInventoryError, TemplateError, SyncExternalError,
|
from modules.exceptions import (SyncInventoryError, TemplateError, SyncExternalError,
|
||||||
@ -85,7 +86,8 @@ class PhysicalDevice():
|
|||||||
# Validate hostname format.
|
# Validate hostname format.
|
||||||
odd_character_list = ["ä", "ö", "ü", "Ä", "Ö", "Ü", "ß"]
|
odd_character_list = ["ä", "ö", "ü", "Ä", "Ö", "Ü", "ß"]
|
||||||
self.use_visible_name = False
|
self.use_visible_name = False
|
||||||
if any(letter in self.name for letter in odd_character_list):
|
if (any(letter in self.name for letter in odd_character_list) or
|
||||||
|
bool(search('[\u0400-\u04FF]', self.name))):
|
||||||
self.name = f"NETBOX_ID{self.id}"
|
self.name = f"NETBOX_ID{self.id}"
|
||||||
self.visible_name = self.nb.name
|
self.visible_name = self.nb.name
|
||||||
self.use_visible_name = True
|
self.use_visible_name = True
|
||||||
|
Loading…
Reference in New Issue
Block a user