Skip to content
Snippets Groups Projects
Commit e775695a authored by Erik Reid's avatar Erik Reid
Browse files

try raising a built-in error rather than juniper ez class

parent dff8a2d4
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ import re
import ipaddress
from jnpr.junos import Device
from jnpr.junos import exception as EzErrors
from lxml import etree
import netifaces
import requests
......@@ -156,7 +157,10 @@ def _rpc(hostname, ssh):
host=hostname,
user=ssh['username'],
ssh_private_key_file=ssh['private-key'])
dev.open()
try:
dev.open()
except EzErrors.ConnectError as e:
raise ConnectionError(str(e))
return dev.rpc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment