Skip to content
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

Ciac 6453/improve generic polling - hotfix #26372

Merged
merged 49 commits into from May 11, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
445c41d
Fixed script issues
AradCarmi May 7, 2023
7a19533
updated rn
AradCarmi May 7, 2023
5113781
merged from master
AradCarmi May 7, 2023
cbf51f1
Updated rn
AradCarmi May 7, 2023
1ce951f
Apply suggestions from code review
AradCarmi May 7, 2023
10bd746
updated script min version
AradCarmi May 8, 2023
d04af7a
updated script min version
AradCarmi May 8, 2023
271e057
fix pre-commit issues
AradCarmi May 8, 2023
b951845
updated the script to support only XSOAR
AradCarmi May 8, 2023
1a3f9a2
Merge branch 'master' of github.com:demisto/content into CIAC-6453/Im…
AradCarmi May 8, 2023
5e6ef3a
Merged master into current branch.
May 8, 2023
e20eb28
Bump pack from version CommonScripts to 1.11.69.
May 8, 2023
3b9244f
update to use endTime instead of using the context
AradCarmi May 8, 2023
84f8f68
merged from master
AradCarmi May 8, 2023
898b7ad
updated rn
AradCarmi May 8, 2023
3391326
merged from master
AradCarmi May 8, 2023
ddaed11
Merged master into current branch.
May 8, 2023
a2c102d
Bump pack from version CommonScripts to 1.11.70.
May 8, 2023
6e3ce83
updated rn
AradCarmi May 8, 2023
207ea25
Merge branch 'CIAC-6453/Improve_GenericPolling_v2' of github.com:demi…
AradCarmi May 8, 2023
c3664ff
Update Packs/CommonScripts/ReleaseNotes/1_11_70.md
AradCarmi May 9, 2023
7e5a742
merged from master
AradCarmi May 9, 2023
bcf3af0
updated rn and readme
AradCarmi May 9, 2023
324388e
Merge branch 'master' of github.com:demisto/content into CIAC-6453/Im…
AradCarmi May 9, 2023
690bf14
Updated rn
AradCarmi May 9, 2023
596d2ef
updated rn
AradCarmi May 9, 2023
f36084f
Merge branch 'master' of github.com:demisto/content into CIAC-6453/Im…
AradCarmi May 9, 2023
566f50d
updated script
AradCarmi May 9, 2023
5396820
Merge branch 'master' of github.com:demisto/content into CIAC-6453/Im…
AradCarmi May 9, 2023
75766c7
Apply suggestions from code review
AradCarmi May 9, 2023
e810b38
Update Packs/CommonScripts/Scripts/ScheduleGenericPolling/ScheduleGen…
AradCarmi May 9, 2023
5e4a9f4
Merge branch 'master' into CIAC-6453/Improve_GenericPolling_v2
AradCarmi May 9, 2023
89ddc78
Merged master into current branch.
May 9, 2023
9b12da1
Bump pack from version CommonScripts to 1.11.72.
May 9, 2023
e433f4d
Merged master into current branch.
May 10, 2023
a804a12
Bump pack from version CommonScripts to 1.11.73.
May 10, 2023
67b7060
updated script
AradCarmi May 10, 2023
b773bff
updated from master
AradCarmi May 10, 2023
a31aab2
updated rn
AradCarmi May 10, 2023
8d1e08a
Merge branch 'master' of github.com:demisto/content into CIAC-6453/Im…
AradCarmi May 10, 2023
3ceff90
updated docker image
AradCarmi May 10, 2023
bbd5f07
Merge branch 'master' of github.com:demisto/content into CIAC-6453/Im…
AradCarmi May 10, 2023
a84c019
Merge branch 'master' into CIAC-6453/Improve_GenericPolling_v2
AradCarmi May 10, 2023
2d6c641
Merge branch 'master' into CIAC-6453/Improve_GenericPolling_v2
AradCarmi May 10, 2023
144e289
updated script
AradCarmi May 10, 2023
50d17e8
Merge branch 'master' of github.com:demisto/content into CIAC-6453/Im…
AradCarmi May 10, 2023
5142305
Merge branch 'CIAC-6453/Improve_GenericPolling_v2' of github.com:demi…
AradCarmi May 10, 2023
6869e26
Merge branch 'master' into CIAC-6453/Improve_GenericPolling_v2
AradCarmi May 11, 2023
12f108d
updated scripts
AradCarmi May 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_11_68.md
@@ -0,0 +1,13 @@

#### Scripts

##### ScheduleCommand

- Added the *scheduledEntryGuid* argument to support the new ***GenericPolling*** playbook mechanism.

##### GenericPollingScheduledTask
- Added the *scheduledEntryGuid* argument to support the new ***GenericPolling*** playbook mechanism.
- Fixed an issue where the GUID was not accessed correctly in the ***GenericPolling*** playbook context.

##### ScheduleGenericPolling
- Added the *scheduledEntryGuid* argument to support the new ***GenericPolling*** playbook mechanism.
Expand Up @@ -150,19 +150,28 @@ function genericPollingScheduledTaskWithoutGuid() {

function genericPollingScheduledTaskWithGuid() {
try {

if (invContext.RemainingPollingIteration == null || invContext.RemainingPollingIteration == undefined) {
setContext("RemainingPollingIteration", parseInt(args.timeout));
}
var guid = args.scheduledEntryGuid;
var timeout = invContext.RemainingPollingIteration
var origTimeout = (parseInt(timeout) - parseInt(args.interval))
var contextTimeoutKey = `GP-${guid}`;
var timeout = parseInt(args.timeout);
var interval = parseInt(args.interval);

if (origTimeout <= 0) {
return finish(args.playbookId, args.tag, undefined, guid);
if ('playbookId' in args) {
const subPlaybook = `subplaybook-${args.playbookId}`;
if ((!invContext[subPlaybook][contextTimeoutKey]) && (invContext[subPlaybook][contextTimeoutKey] !== 0)) {
setContext(`${subPlaybook}.${contextTimeoutKey}`, (Math.floor(timeout / interval)));
}
else{
timeout = invContext[subPlaybook][contextTimeoutKey];
}
var origTimeout = timeout - interval;
if (origTimeout <= 0) {
return finish(args.playbookId, args.tag, undefined, guid);
}
setContext(`${subPlaybook}.${contextTimeoutKey}`, origTimeout);
}
else{
logError('playbookId is not defined');
AradCarmi marked this conversation as resolved.
Show resolved Hide resolved
}

setContext("RemainingPollingIteration", origTimeout);

// Get ids that have not finished yet
var ids = argToList(args.ids);
Expand Down Expand Up @@ -224,7 +233,7 @@ function genericPollingScheduledTaskWithGuid() {

function main() {
res = getDemistoVersion();
platform = res.platform
platform = res.platform;
AradCarmi marked this conversation as resolved.
Show resolved Hide resolved
version = res.version;
buildNumber = res.buildNumber;

Expand Down
Expand Up @@ -42,6 +42,9 @@ args:
- name: additionalPollingCommandArgValues
description: Commas separated arguments values of the polling command
isArray: true
- name: scheduledEntryGuid
description: The GUID of the scheduled entry that runs the polling command.
type: textArea
scripttarget: 0
runonce: false
tests:
Expand Down
Expand Up @@ -22,6 +22,9 @@ args:
not provided. Optional. Format is 'Mon, 02 Jan 2006 15:04:05 MST'
- name: times
description: The number of times to run. Optional.
- name: scheduledEntryGuid
description: The GUID of the scheduled entry that runs the polling command.
type: textArea
scripttarget: 0
dependson: {}
timeout: 0s
Expand Down
Expand Up @@ -46,6 +46,9 @@ args:
- name: additionalPollingCommandArgValues
description: Values of the additional arguments for the polling command (e.g. value1,value2,...)
isArray: true
- name: scheduledEntryGuid
description: The GUID of the scheduled entry that runs the polling command.
type: textArea
scripttarget: 0
runonce: false
tests:
Expand Down
2 changes: 1 addition & 1 deletion Packs/CommonScripts/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "Common Scripts",
"description": "Frequently used scripts pack.",
"support": "xsoar",
"currentVersion": "1.11.67",
"currentVersion": "1.11.68",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down