2023-11-01 Website: Update script for Vanta integration (#14807)
Closes: #14751 Changes: - Added new errors that are thrown if the response from the `/hosts/{id}` endpoint does not contain a `host` object.
This commit is contained in:
+9
@@ -8,6 +8,7 @@ module.exports = {
|
||||
|
||||
|
||||
fn: async function () {
|
||||
let util = require('util');
|
||||
|
||||
// Find all VantaConnection records with isConnectedToVanta: true
|
||||
let allActiveVantaConnections = await VantaConnection.find({isConnectedToVanta: true});
|
||||
@@ -198,6 +199,10 @@ module.exports = {
|
||||
return new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), an error occurred: ${err}`);
|
||||
});
|
||||
|
||||
if(!detailedInformationAboutThisHost.host) {
|
||||
throw new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), the response from the Fleet API did not include a host. Response from the Fleet API: ${util.inspect(detailedInformationAboutThisHost)}`);
|
||||
}
|
||||
|
||||
if (detailedInformationAboutThisHost.host.disk_encryption_enabled !== undefined && detailedInformationAboutThisHost.host.disk_encryption_enabled !== null) {
|
||||
// Build a drive object for this host, using the host's disk_encryption_enabled value to set the boolean values for `encrytped` and `filevaultEnabled`
|
||||
let driveInformationForThisHost = {
|
||||
@@ -283,6 +288,10 @@ module.exports = {
|
||||
return new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), an error occurred: ${err}`);
|
||||
});
|
||||
|
||||
if(!detailedInformationAboutThisHost.host){
|
||||
throw new Error(`When sending a request to the Fleet instance's /hosts/${host.id} endpoint for a Vanta connection (id: ${connectionIdAsString}), the response from the Fleet API did not include a host. Response from the Fleet API: ${util.inspect(detailedInformationAboutThisHost)}`);
|
||||
}
|
||||
|
||||
if (detailedInformationAboutThisHost.host.disk_encryption_enabled !== undefined && detailedInformationAboutThisHost.host.disk_encryption_enabled !== null) {
|
||||
// Build a drive object for this host, using the host's disk_encryption_enabled value to set the boolean values for `encrytped` and `filevaultEnabled`
|
||||
let driveInformationForThisHost = {
|
||||
|
||||
Reference in New Issue
Block a user