From f5b22a31dfddee2bb20d48376b63053e35bdc500 Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Mon, 13 Nov 2023 11:51:18 +0100 Subject: [PATCH] Use get_snmp_session_for_profile() in Arnold Arnold mostly uses PortAdmin management handlers, except for when changing the ifAdminStatus value of a port. This lets the get_snmp_session_for_profile() utility function set up these SNMP sessions instead, so that even SNMPv3 sessions will be supported. --- python/nav/arnold.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/python/nav/arnold.py b/python/nav/arnold.py index 58eb59bbc5..61544c1d35 100644 --- a/python/nav/arnold.py +++ b/python/nav/arnold.py @@ -40,6 +40,7 @@ from nav.Snmp.errors import AgentError import nav.bitvector import nav.buildconf +from nav.Snmp.profile import get_snmp_session_for_profile from nav.config import find_config_file from nav.errors import GeneralException from nav.models.arnold import Identity, Event @@ -464,11 +465,7 @@ def change_port_status(action, identity): if not profile: raise NoReadWriteManagementProfileError - agent = nav.Snmp.Snmp( - host=netbox.ip, - community=profile.snmp_community, - version=profile.snmp_version, - ) + agent = get_snmp_session_for_profile(profile)(host=netbox.ip) # Disable or enable based on input try: