Skip to content

Commit

Permalink
Trust get_preferred_snmp_management_profile
Browse files Browse the repository at this point in the history
Netbox.get_preferred_snmp_manage_profile() should be trusted to return
a proper SNMP profile.  I see no reason to guard against faulty
return values like this.
  • Loading branch information
lunkwill42 committed Nov 16, 2023
1 parent 75a6331 commit 5368290
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions python/nav/portadmin/snmp/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing import Dict, Sequence, List, Any

from nav import Snmp
from nav.Snmp.profile import get_snmp_session_for_profile
from nav.Snmp import safestring, OID
from nav.Snmp.errors import (
UnsupportedSnmpVersionError,
Expand Down Expand Up @@ -174,10 +175,6 @@ def _get_read_only_handle(self):

if not profile:
raise NoReadOnlyManagementProfileError
if not hasattr(profile, "snmp_community") or not hasattr(
profile, "snmp_version"
):
raise InvalidManagementProfileError

self.read_only_handle = Snmp.Snmp(
host=self.netbox.ip,
Expand Down

0 comments on commit 5368290

Please sign in to comment.