diff --git a/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/monitor_sessions.py b/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/monitor_sessions.py index 1f62e8cf404..7f1ee8185c5 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/monitor_sessions.py +++ b/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/monitor_sessions.py @@ -48,9 +48,10 @@ def monitor_sessions(self: AvdStructuredConfigConnectedEndpoints) -> list | None "direction": get(session, "source_settings.direction"), } - if get(merged_settings, "session_settings.access_group") is not None: - if get(session, "source_settings.access_group") is not None: - msg = f"For {self.shared_utils.hostname}, an ACL is set on {session["interface"]} even though ACL is set for session {session_name}." + if get(merged_settings, "session_settings.access_group") is not None and get(session, "source_settings.access_group") is not None: + msg = ( + f"For {self.shared_utils.hostname}, an ACL is set on {session["interface"]} even though ACL is set for monitor session {session_name}." + ) raise AristaAvdError(msg) elif (access_group := get(session, "source_settings.access_group")) is not None: