Skip to content

Commit

Permalink
Removed try/except from get_interfaces_ip to avoid masking unknown is…
Browse files Browse the repository at this point in the history
…sues
  • Loading branch information
gjim83 committed Jan 19, 2018
1 parent 719a0e5 commit d7c67fe
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions napalm_panos/panos.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,15 +618,12 @@ def extract_ip_info(parsed_intf_dict):
ip_interfaces = {}
cmd = "<show><interface>all</interface></show>"

try:
self.device.op(cmd=cmd)
interface_info_xml = xmltodict.parse(self.device.xml_root())
interface_info_json = json.dumps(
interface_info_xml['response']['result']['ifnet']['entry']
)
interface_info = json.loads(interface_info_json)
except KeyError:
return ip_interfaces
self.device.op(cmd=cmd)
interface_info_xml = xmltodict.parse(self.device.xml_root())
interface_info_json = json.dumps(
interface_info_xml['response']['result']['ifnet']['entry']
)
interface_info = json.loads(interface_info_json)

if isinstance(interface_info, dict):
# Same "1 vs many -> dict vs list of dicts" comment.
Expand Down

0 comments on commit d7c67fe

Please sign in to comment.