Skip to content

Commit

Permalink
Raise POENotSupportedError if missing PoE indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed Dec 5, 2023
1 parent b96ffeb commit 7572d30
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/nav/portadmin/snmp/cisco.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ def set_poe_state(self, interface: manage.Interface, state: PoeState):
"""Set state for enabling/disabling PoE on this interface.
Available options should be retrieved using `get_poe_state_options`
"""
unit_number, interface_number = self._get_poe_indexes_for_interface(interface)
try:
unit_number, interface_number = self._get_poe_indexes_for_interface(

Check warning on line 335 in python/nav/portadmin/snmp/cisco.py

View check run for this annotation

Codecov / codecov/patch

python/nav/portadmin/snmp/cisco.py#L334-L335

Added lines #L334 - L335 were not covered by tests
interface
)
except POEIndexNotFoundError as error:
raise POENotSupportedError(error)

Check warning on line 339 in python/nav/portadmin/snmp/cisco.py

View check run for this annotation

Codecov / codecov/patch

python/nav/portadmin/snmp/cisco.py#L338-L339

Added lines #L338 - L339 were not covered by tests
oid_with_unit_number = self.POEENABLE + OID((unit_number,))
try:
self._set_netbox_value(
Expand Down

0 comments on commit 7572d30

Please sign in to comment.