Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eashaw committed May 15, 2024
1 parent 929f43e commit 288017c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ee/vulnerability-dashboard/scripts/update-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ module.exports = {
})
.timeout(120000)
.retry(['requestFailed', {name: 'TimeoutError'}])
.tolerate({raw:{statusCode: 404}} , (error)=>{
.tolerate({raw:{statusCode: 404}} , ()=>{
// If the hosts API returns a 404 response for a software item that was returned from in the list of vulnerable software, we'll log a warning and remove this software from the list of software.
loggedWarningsFromThisScriptRun.push(`When processing vulnerable software, a request to the '/hosts' endpoint to get a filtered array of hosts with ${ware.name} ${ware.version} installed (software ID: ${ware.id}), the Fleet instance returned a 404 response when we expected it to return an array of ${ware.hosts_count} host(s).\n Impact: If this vulnerable software was previously processed, the database record(s) for it will be marked as uninstalled. If it shows up in a future run of this script, a new database record will be created.`);
vulnerableWaresWithNoHostInformation.push(ware);// Add this software to the vulnerableWaresWithNoHostInformation array, these will be removed before we create and update database records.
Expand Down Expand Up @@ -496,7 +496,6 @@ module.exports = {
}//∞
if (dry) {
sails.log.warn(`Dry run: ${potentialVulnInstalls.length} potential vulnerability installs are available and ${potentialVulnInstallUpdates.length} updates are available for existing vulnerability installs.`);
console.log(potentialVulnInstalls);
} else {
sails.log(`Detected ${potentialVulnInstalls.length} changes to software installations and ${potentialVulnInstallUpdates.length} updates are available for existing vulnerability installs. Saving...`);
let batchedPotentialVulnInstalls = _.chunk(potentialVulnInstalls, 1000);
Expand Down Expand Up @@ -607,7 +606,7 @@ module.exports = {
})
.timeout(120000)
.retry(['requestFailed', {name: 'TimeoutError'}])
.tolerate({raw:{statusCode: 404}} , (error)=>{
.tolerate({raw:{statusCode: 404}} , ()=>{
// If the hosts API returns a 404 response for a software item that was returned from in the list of critical software, we'll log a warning and remove this software from the list of software.
loggedWarningsFromThisScriptRun.push(`When processing critical software, a request to the '/hosts' endpoint to get a filtered array of hosts with ${ware.name} ${ware.version} installed (software ID: ${ware.id}), the Fleet instance returned a 404 response when we expected it to return an array of ${ware.hosts_count} host(s).\n Impact: This software will be marked as uninstalled, and a new database record will be created if it shows up in a future run of this script.`);
criticalWaresWithNoHostInformation.push(ware);// Add this software to the criticalWaresWithNoHostInformation array, these will be removed before we create and update database records.
Expand Down Expand Up @@ -899,8 +898,8 @@ module.exports = {
await Vulnerability.destroy({id: {in: _.pluck(vulnerabilityRecordIdsWithNoAssociatedRecords, 'id')}});
}
if(loggedWarningsFromThisScriptRun.length > 0) {
sails.log.warn(`During this run of the update-reports script ${loggedWarningsFromThisScriptRun.length} warning(s) were logged.`)
for(warning of loggedWarningsFromThisScriptRun){
sails.log.warn(`During this run of the update-reports script ${loggedWarningsFromThisScriptRun.length} warning(s) were logged.`);
for(let warning of loggedWarningsFromThisScriptRun){
sails.log.warn(warning);
}
}
Expand Down

0 comments on commit 288017c

Please sign in to comment.