From 7f9b82fd0cc965085fdc36c34a347a54ad53aa8b Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Thu, 2 Nov 2023 11:57:34 +0100 Subject: [PATCH] Update is_snmp and snmp_version properties These need to reflect the existence of the new SNMPv3 profile type. --- python/nav/models/manage.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/nav/models/manage.py b/python/nav/models/manage.py index b87df8602c..385c8d322e 100644 --- a/python/nav/models/manage.py +++ b/python/nav/models/manage.py @@ -154,16 +154,18 @@ def __str__(self): @property def is_snmp(self): - return self.protocol == self.PROTOCOL_SNMP + return self.protocol in (self.PROTOCOL_SNMP, self.PROTOCOL_SNMPV3) @property def snmp_version(self): """Returns the configured SNMP version as an integer""" - if self.is_snmp: + if self.protocol == self.PROTOCOL_SNMP: value = self.configuration['version'] if value == "2c": return 2 return int(value) + elif self.protocol == self.PROTOCOL_SNMPV3: + return 3 raise ValueError( "Getting snmp protocol version for non-snmp management profile"