Skip to content

hide trimevents arg #22241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_11_23.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### Scripts
##### SearchIncidentsV2
- Updated the Docker image to: *demisto/python3:3.10.10.47713*.
- Hid the trimevents argument. This argument is not supported in XSOAR.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,13 @@ def search_incidents(args: Dict): # pragma: no cover
to_date = todate.isoformat()
args['todate'] = to_date

if args.get('trimevents') == '0':
args.pop('trimevents')
if args.get('trimevents'):
platform = demisto.demistoVersion().get('platform', 'xsoar')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protect against case mismatches.

Suggested change
platform = demisto.demistoVersion().get('platform', 'xsoar')
platform = demisto.demistoVersion().get('platform', 'xsoar').lower()

if platform == 'xsoar' or platform == 'xsoar_hosted':
raise ValueError('The trimevents argument is not supported in XSOAR.')

if args.get('trimevents') == '0':
args.pop('trimevents')

platform = get_demisto_version().get('platform')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ args:
name: trimevents
required: false
secret: false
defaultValue: '0'
hidden: true
- default: false
description: Number of incidents per page (per fetch)
isArray: false
Expand Down Expand Up @@ -202,7 +202,7 @@ tags:
- Utility
timeout: '0'
type: python
dockerimage: demisto/python3:3.10.9.45313
dockerimage: demisto/python3:3.10.10.47713
fromversion: 5.0.0
tests:
- No tests (auto formatted)
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ def test_filter_events(mocker, args, filtered_args, expected_result):
"""
import SearchIncidentsV2
execute_mock = mocker.patch.object(SearchIncidentsV2, 'execute_command', side_effect=get_incidents_mock)
if 'trimevents' in args:
# trimevents supported only in XSIAM
mocker.patch.object(demisto, 'demistoVersion', return_value={'platform': 'xsiam'})

_, res, _ = SearchIncidentsV2.search_incidents(args)
assert res == expected_result
assert execute_mock.call_count == 1
Expand Down
2 changes: 1 addition & 1 deletion Packs/CommonScripts/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Common Scripts",
"description": "Frequently used scripts pack.",
"support": "xsoar",
"currentVersion": "1.11.22",
"currentVersion": "1.11.23",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down