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

[FailedInstances] Fixed an issue related to instances in an error state #37004

Merged
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
6 changes: 6 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_15_77.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Scripts

##### FailedInstances

Fixed an issue where the script was ignoring instances in an error state.
13 changes: 12 additions & 1 deletion Packs/CommonScripts/Scripts/FailedInstances/FailedInstances.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var countSuccess = 0;
var instances = [];

Object.keys(all).forEach(function(m) {
if (all[m].state === 'active' && all[m].defaultIgnored !== 'true' && INTERNAL_MODULES_BRANDS.indexOf(all[m].brand) === -1) {
var isShouldBeTesting = all[m].defaultIgnored !== 'true' && INTERNAL_MODULES_BRANDS.indexOf(all[m].brand) === -1;
if (all[m].state === 'active' && isShouldBeTesting) {
var cmd = m.replace(/\s/g,'_') + '-test-module';
var firstRest = executeCommand("addEntries", {"entries": JSON.stringify([{
Type: entryTypes.note,
Expand Down Expand Up @@ -43,6 +44,16 @@ Object.keys(all).forEach(function(m) {
instances.push({instance: m, brand: all[m].brand, category: all[m].category, information: 'succeed', status: 'success' });
}

} else if (all[m].state === 'error' && isShouldBeTesting) {
var errorMessage = 'The instance is in an error state, potentially due to an issue with the engine.';
executeCommand("addEntries", {"entries": JSON.stringify([{
Type: entryTypes.note,
Contents: 'done testing **' + m + '**:\n' + errorMessage,
HumanReadable: 'done testing **' + m + '**:\n' + errorMessage,
ContentsFormat: formats.markdown
}])});
countFailed++;
failedInstances.push({instance: m, brand: all[m].brand, category: all[m].category, information: errorMessage, status: 'failure' });
}
});

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.15.76",
"currentVersion": "1.15.77",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Loading