PaloAltoNetworks / pan-os-python

The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.
https://pan-os-python.readthedocs.io
ISC License
340 stars 168 forks source link

Fix for None datatype in _parse_job_results() #471

Closed undodelete closed 7 months ago

undodelete commented 2 years ago

Description

Adding an exception handler to catch datatype errors with jobs where details is None.

Motivation and Context

Resolve bug described in #470

How Has This Been Tested?

The command that encountered the issue were rerun and the response was successful.

download_cmd = "<request><plugins><download><file>vm_series-2.1.2</file></download></plugins></request>"
download_response = parent.op(download_cmd, cmd_xml=False)
download_result = parent.syncjob(download_response)

Successful download response

{
   "success":true,
   "result":"OK",
   "jobid":"18",
   "user":"None",
   "warnings":"None",
   "starttime":"2022/07/26 08:58:18",
   "endtime":"08:58:19",
   "messages":[

   ],
   "devices":{

   },
   "xml":"<Element""response"at 0x7f68569ca180>
}

Tested against panos 9.1 using the pan-os-python poetry venv. This is very small and self contained change and won't affect other parts of the code base.

Screenshots (if appropriate)

Types of changes

Checklist

- [ ] I have updated the documentation accordingly.

welcome-to-palo-alto-networks[bot] commented 2 years ago

:tada: Thanks for opening this pull request! We really appreciate contributors like you! :raised_hands:

ewlumpkin commented 1 year ago

I had a similar issue. Can @shinmog or @btorresgil review?