Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
VirtualBoxManager.createCheckpoint = function (checkpointName, callback, dontAddPrefix)
{
if (!dontAddPrefix)
{
checkpointName = VirtualBoxManager.snapshotPrefix + checkpointName;
}
if (Config.virtualbox && Config.virtualbox.active && Config.virtualbox.create_snapshots)
{
const virtualbox = require("virtualbox");
virtualbox.snapshotTake(VirtualBoxManager.vmName, checkpointName, function (error, uuid)
{
if (error)
{
callback(1, "Error taking snapshot!");
}
else
{
if (uuid)
{
console.log("Snapshot has been taken!");
console.log("UUID: ", uuid);
callback(null);
}
else
{
callback(2, "Null checkpoint id returned when creating a new checkpoint!");