From 710e426ec5b1d9eb6efb05ddfb8fccd0ba3410b9 Mon Sep 17 00:00:00 2001 From: content-bot <55035720+content-bot@users.noreply.github.com> Date: Mon, 19 Aug 2024 00:50:20 +0300 Subject: [PATCH] PAN-OS Panorama integration implement `show jobs id` (#35929) * PAN-OS Panorama integration implement `show jobs id` (#35761) * PAN-OS Panorama integration implement `show jobs id` Refactor Panorama integration `show_jobs()` method to fetch job by id with the `show jobs id` command instead of filtering through `show jobs all`. * Apply suggestions from code review Co-authored-by: Jacob Levy <129657918+jlevypaloalto@users.noreply.github.com> * Update release notes for PAN-OS pack * Update Packs/PAN-OS/ReleaseNotes/2_1_34.md Co-authored-by: Jacob Levy <129657918+jlevypaloalto@users.noreply.github.com> --------- Co-authored-by: Jacob Levy <129657918+jlevypaloalto@users.noreply.github.com> Co-authored-by: israelpoli <72099621+israelpoli@users.noreply.github.com> * autopep --------- Co-authored-by: Alp Eren Kose Co-authored-by: Jacob Levy <129657918+jlevypaloalto@users.noreply.github.com> Co-authored-by: israelpoli <72099621+israelpoli@users.noreply.github.com> Co-authored-by: ipolishuk --- Packs/PAN-OS/Integrations/Panorama/Panorama.py | 6 ++++-- Packs/PAN-OS/ReleaseNotes/2_1_34.md | 7 +++++++ Packs/PAN-OS/pack_metadata.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 Packs/PAN-OS/ReleaseNotes/2_1_34.md diff --git a/Packs/PAN-OS/Integrations/Panorama/Panorama.py b/Packs/PAN-OS/Integrations/Panorama/Panorama.py index 96a2125b0c36..692521bd0f5f 100644 --- a/Packs/PAN-OS/Integrations/Panorama/Panorama.py +++ b/Packs/PAN-OS/Integrations/Panorama/Panorama.py @@ -10966,6 +10966,7 @@ class UniversalCommand: """Command list for commands that are consistent between PANORAMA and NGFW""" SYSTEM_INFO_COMMAND = "show system info" SHOW_JOBS_COMMAND = "show jobs all" + SHOW_JOBS_ID_PREFIX = "show jobs id \"{}\"" @staticmethod def get_system_info( @@ -11123,7 +11124,9 @@ def show_jobs( """ result_data = [] for device in topology.all(filter_string=device_filter_str, target=target): - response = run_op_command(device, UniversalCommand.SHOW_JOBS_COMMAND) + command = UniversalCommand.SHOW_JOBS_ID_PREFIX.format(id) if id else UniversalCommand.SHOW_JOBS_COMMAND + response = run_op_command(device, command) + for job in response.findall("./result/job"): result_data_obj: ShowJobsAllResultData = dataclass_from_element(device, ShowJobsAllResultData, job) @@ -11133,7 +11136,6 @@ def show_jobs( # Filter the result data result_data = [x for x in result_data if x.status == status or not status] result_data = [x for x in result_data if x.type == job_type or not job_type] - result_data = [x for x in result_data if x.id == id or not id] # The below is very important for XSOAR to de-duplicate the returned key. If there is only one obj # being returned, return it as a dict instead of a list. diff --git a/Packs/PAN-OS/ReleaseNotes/2_1_34.md b/Packs/PAN-OS/ReleaseNotes/2_1_34.md new file mode 100644 index 000000000000..5d24db9965cd --- /dev/null +++ b/Packs/PAN-OS/ReleaseNotes/2_1_34.md @@ -0,0 +1,7 @@ + +#### Integrations + +##### Palo Alto Networks PAN-OS + +- Added support for the `show jobs id` OP command in the ***pan-os-platform-get-jobs*** command which improves the efficiency of searching for a job by ID. +- Updated the Docker image to: *demisto/pan-os-python:1.0.0.107786*. diff --git a/Packs/PAN-OS/pack_metadata.json b/Packs/PAN-OS/pack_metadata.json index 5c16e0d84441..aa4f1a8222ef 100644 --- a/Packs/PAN-OS/pack_metadata.json +++ b/Packs/PAN-OS/pack_metadata.json @@ -2,7 +2,7 @@ "name": "PAN-OS by Palo Alto Networks", "description": "Manage Palo Alto Networks Firewall and Panorama. Use this pack to manage Prisma Access through Panorama. For more information see Panorama documentation.", "support": "xsoar", - "currentVersion": "2.1.33", + "currentVersion": "2.1.34", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",