1208
This commit is contained in:
@@ -72,6 +72,14 @@ PRODUCT_TAG_SLUG = {
|
|||||||
# "fox200": "fox200-auto-upgrade-latest",
|
# "fox200": "fox200-auto-upgrade-latest",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# MACs to ignore completely when seen in registrations
|
||||||
|
IGNORE_MACS_RAW = [
|
||||||
|
"AA:BB:CC:DD:EE:FF",
|
||||||
|
"D0:6C:37:00:D5:84",
|
||||||
|
"44:D1:FA:7E:3F:65",
|
||||||
|
"C4:93:00:4E:92:7C",
|
||||||
|
]
|
||||||
|
|
||||||
# Global counter for any NetBox-related problems
|
# Global counter for any NetBox-related problems
|
||||||
NB_PROBLEM_COUNTER = 0
|
NB_PROBLEM_COUNTER = 0
|
||||||
NB_PROBLEM_LOCK = asyncio.Lock()
|
NB_PROBLEM_LOCK = asyncio.Lock()
|
||||||
@@ -158,6 +166,9 @@ def normalize_mac(mac: str) -> Optional[str]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
IGNORE_MACS = {m for m in (normalize_mac(x) for x in IGNORE_MACS_RAW) if m}
|
||||||
|
|
||||||
|
|
||||||
def http_get_json(url: str, params: Optional[Dict[str, str]] = None, headers: Optional[Dict[str, str]] = None, timeout: float = NB_TIMEOUT):
|
def http_get_json(url: str, params: Optional[Dict[str, str]] = None, headers: Optional[Dict[str, str]] = None, timeout: float = NB_TIMEOUT):
|
||||||
if params:
|
if params:
|
||||||
url = f"{url}?{urlencode(params)}"
|
url = f"{url}?{urlencode(params)}"
|
||||||
@@ -426,6 +437,16 @@ async def main():
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
mac_norm = normalize_mac(mac)
|
||||||
|
if mac_norm in IGNORE_MACS:
|
||||||
|
async with print_lock:
|
||||||
|
print(
|
||||||
|
f"[{ts()}] ignoring registration for mac={mac}",
|
||||||
|
file=sys.stdout,
|
||||||
|
flush=True,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
host_suffix = ""
|
host_suffix = ""
|
||||||
action_suffix = "" # kept; not used
|
action_suffix = "" # kept; not used
|
||||||
bell_prefix = "" # ASCII BEL when action_next present (3x)
|
bell_prefix = "" # ASCII BEL when action_next present (3x)
|
||||||
|
|||||||
Reference in New Issue
Block a user