diff --git a/panos_upgrade_assurance/firewall_proxy.py b/panos_upgrade_assurance/firewall_proxy.py
index 050c4a6..24fea21 100644
--- a/panos_upgrade_assurance/firewall_proxy.py
+++ b/panos_upgrade_assurance/firewall_proxy.py
@@ -1393,7 +1393,7 @@ def get_jobs(self) -> dict:
jobs = self.op_parser(cmd="show jobs all")
results = dict()
- job_results = jobs.get("job")
+ job_results = jobs.get("job") if isinstance(jobs, dict) else None
if isinstance(job_results, list):
for job in job_results:
jid = job["id"]
diff --git a/tests/test_firewall_proxy.py b/tests/test_firewall_proxy.py
index 409d7eb..4b5c4aa 100644
--- a/tests/test_firewall_proxy.py
+++ b/tests/test_firewall_proxy.py
@@ -1429,6 +1429,56 @@ def test_get_jobs(self, fw_proxy_mock):
},
}
+ def test_get_jobs_single_job(self, fw_proxy_mock):
+ xml_text = """
+
+
+
+ 2023/08/07 03:59:57
+ 03:59:57
+ 1
+
+ AutoCom
+ FIN
+ NO
+ no
+ OK
+ 2023/08/07 04:00:28
+
+ 0
+
+
+ Configuration committed successfully
+ Successfully committed last configuration
+
+
+
+
+
+ """
+
+ raw_response = ET.fromstring(xml_text)
+ fw_proxy_mock.op.return_value = raw_response
+
+ assert fw_proxy_mock.get_jobs() == {
+ "1": {
+ "tenq": "2023/08/07 03:59:57",
+ "tdeq": "03:59:57",
+ "user": None,
+ "type": "AutoCom",
+ "status": "FIN",
+ "queued": "NO",
+ "stoppable": "no",
+ "result": "OK",
+ "tfin": "2023/08/07 04:00:28",
+ "description": None,
+ "positionInQ": "0",
+ "progress": "100",
+ "details": {"line": ["Configuration committed successfully", "Successfully committed last configuration"]},
+ "warnings": None,
+ },
+ }
+
def test_get_jobs_no_jobs(self, fw_proxy_mock):
xml_text = """