Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions netbox_onboarding/netdev_keeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import importlib
import logging
import socket

from dcim.models import Platform
from django.conf import settings
from napalm import get_network_driver
from napalm.base.exceptions import ConnectionException, CommandErrorException
Expand All @@ -25,8 +25,6 @@
from netmiko.ssh_exception import NetMikoTimeoutException
from paramiko.ssh_exception import SSHException

from dcim.models import Platform

from netbox_onboarding.onboarding.onboarding import StandaloneOnboarding
from .constants import NETMIKO_TO_NAPALM_STATIC
from .exceptions import OnboardException
Expand Down Expand Up @@ -178,7 +176,12 @@ def guess_netmiko_device_type(self):
logger.error("ERROR: %s", str(err))
raise OnboardException(reason="fail-general", message=f"ERROR: {str(err)}")

logger.info("INFO device type is: %s", guessed_device_type)
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the else: is needed here per se, but it's probably harmless.

if guessed_device_type is None:
logger.error("ERROR: Could not detect device type with SSHDetect")
raise OnboardException(
reason="fail-general", message="ERROR: Could not detect device type with SSHDetect"
)

return guessed_device_type

Expand Down