Skip to content

Commit

Permalink
PAN-OS Panorama integration implement show jobs id (#35929)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update release notes for PAN-OS pack

* Update Packs/PAN-OS/ReleaseNotes/2_1_34.md

Co-authored-by: Jacob Levy <[email protected]>

---------

Co-authored-by: Jacob Levy <[email protected]>
Co-authored-by: israelpoli <[email protected]>

* autopep

---------

Co-authored-by: Alp Eren Kose <[email protected]>
Co-authored-by: Jacob Levy <[email protected]>
Co-authored-by: israelpoli <[email protected]>
Co-authored-by: ipolishuk <[email protected]>
  • Loading branch information
5 people authored Aug 18, 2024
1 parent 58c95a0 commit 3546245
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Packs/PAN-OS/Integrations/Panorama/Panorama.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions Packs/PAN-OS/ReleaseNotes/2_1_34.md
Original file line number Diff line number Diff line change
@@ -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*.
2 changes: 1 addition & 1 deletion Packs/PAN-OS/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down

0 comments on commit 3546245

Please sign in to comment.