From 408a9c3327f8c8c8c3dae0c9f565b6b04165932f Mon Sep 17 00:00:00 2001 From: pederhan Date: Thu, 10 Aug 2023 11:44:31 +0200 Subject: [PATCH] No validation --- zabbix_auto_config/models.py | 2 +- zabbix_auto_config/processing.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/zabbix_auto_config/models.py b/zabbix_auto_config/models.py index a0b3e62..a2b8a7e 100644 --- a/zabbix_auto_config/models.py +++ b/zabbix_auto_config/models.py @@ -144,7 +144,7 @@ class Host(BaseModel): siteadmins: Set[str] = set() sources: Set[str] = set() tags: Set[Tuple[str, str]] = set() - model_config = ConfigDict(validate_assignment=True, revalidate_instances="always") + model_config = ConfigDict(validate_assignment=True) @model_validator(mode="before") @classmethod diff --git a/zabbix_auto_config/processing.py b/zabbix_auto_config/processing.py index ec99e8d..efccd0d 100644 --- a/zabbix_auto_config/processing.py +++ b/zabbix_auto_config/processing.py @@ -418,8 +418,7 @@ def handle_host( assert ( host.hostname == modified_host.hostname ), f"Modifier changed the hostname, '{host.hostname}' -> '{modified_host.hostname}'" - # Re-validate the host after modification - host = host.model_validate(modified_host) + host = modified_host except AssertionError as e: logging.warning( "Host, '%s', was modified to be invalid by modifier: '%s'. Error: %s",