diff --git a/netbox_onboarding/netdev_keeper.py b/netbox_onboarding/netdev_keeper.py index d9aa536..651b707 100644 --- a/netbox_onboarding/netdev_keeper.py +++ b/netbox_onboarding/netdev_keeper.py @@ -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 @@ -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 @@ -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: + 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