From a5aa07e8472413418763094eea5074f2be7ee104 Mon Sep 17 00:00:00 2001 From: Menachem Date: Thu, 31 Oct 2024 11:26:05 +0200 Subject: [PATCH] [FailedInstances] Fixed an issue related to instances in an error state --- Packs/CommonScripts/ReleaseNotes/1_15_77.md | 6 ++++++ .../Scripts/FailedInstances/FailedInstances.js | 13 ++++++++++++- Packs/CommonScripts/pack_metadata.json | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 Packs/CommonScripts/ReleaseNotes/1_15_77.md diff --git a/Packs/CommonScripts/ReleaseNotes/1_15_77.md b/Packs/CommonScripts/ReleaseNotes/1_15_77.md new file mode 100644 index 000000000000..b0f7f2fdd022 --- /dev/null +++ b/Packs/CommonScripts/ReleaseNotes/1_15_77.md @@ -0,0 +1,6 @@ + +#### Scripts + +##### FailedInstances + +Fixed an issue where the script was ignoring instances in an error state. \ No newline at end of file diff --git a/Packs/CommonScripts/Scripts/FailedInstances/FailedInstances.js b/Packs/CommonScripts/Scripts/FailedInstances/FailedInstances.js index 18b372c11945..106cfc316201 100644 --- a/Packs/CommonScripts/Scripts/FailedInstances/FailedInstances.js +++ b/Packs/CommonScripts/Scripts/FailedInstances/FailedInstances.js @@ -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, @@ -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' }); } }); diff --git a/Packs/CommonScripts/pack_metadata.json b/Packs/CommonScripts/pack_metadata.json index 00d765398020..c73d03670af7 100644 --- a/Packs/CommonScripts/pack_metadata.json +++ b/Packs/CommonScripts/pack_metadata.json @@ -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": "",