awscli
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "qmi-cloud-app",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"scripts": {
|
||||
"start": "node -r esm server/server.js",
|
||||
"start:dev": "nodemon -r esm server/server.js",
|
||||
|
||||
@@ -14,7 +14,7 @@ const WARNING_DAYS = 1;
|
||||
const db = require('qmi-cloud-common/mongo');
|
||||
const sendEmail = require("qmi-cloud-common/send-email");
|
||||
const moment = require('moment');
|
||||
const azurecli = require('qmi-cloud-common/azurecli');
|
||||
const cli = require('qmi-cloud-common/cli');
|
||||
|
||||
function timeRunningIs24x7(p) {
|
||||
let runningFromTime = p.runningFrom? new Date(p.runningFrom).getTime() : new Date(p.created).getTime();
|
||||
@@ -130,7 +130,7 @@ const doStop = async function(p, limit, typeSchedule) {
|
||||
if (p.schedule){
|
||||
//Disable Divvy
|
||||
await db.schedule.update(p.schedule._id, {"isStartupTimeEnable": false});
|
||||
await azurecli.updateVmsTags(p._id, {
|
||||
await cli.updateVmsTags(p._id, {
|
||||
"24x7": false,
|
||||
"StartupTime": false,
|
||||
"ShutdownTime": false
|
||||
@@ -138,7 +138,7 @@ const doStop = async function(p, limit, typeSchedule) {
|
||||
}
|
||||
//Stop VMs indefinitely
|
||||
db.event.add({ user: p.user._id, provision: p._id, type: 'vms.exec-stop' });
|
||||
await azurecli.deallocate(p._id, true);
|
||||
await cli.deallocate(p._id, true);
|
||||
await db.notification.add({ provision: p._id.toString(), type: 'stop', message: msg });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "qmi-cloud-cli",
|
||||
"version": "1.1.8",
|
||||
"version": "1.3.0",
|
||||
"scripts": {
|
||||
},
|
||||
"private": true,
|
||||
|
||||
108
qmi-cloud-common/awscli.js
Normal file
108
qmi-cloud-common/awscli.js
Normal file
@@ -0,0 +1,108 @@
|
||||
const AWS = require("aws-sdk");
|
||||
const db = require("./mongo");
|
||||
const utils = require("./utils");
|
||||
|
||||
|
||||
function _getRgName(provision) {
|
||||
let rgName = provision.scenario.toUpperCase();
|
||||
rgName = rgName.replace(/AZQMI/g, 'QMI');
|
||||
rgName = rgName + "-" + provision._id.toString();
|
||||
return rgName;
|
||||
}
|
||||
|
||||
function _getRegion(provision) {
|
||||
let region = "eu-west-1";
|
||||
if ( provision.deployOpts.location === 'East US') {
|
||||
region = "us-east-1";
|
||||
} else if ( provision.deployOpts.location === 'Southeast Asia' ) {
|
||||
region = "ap-southeast-1";
|
||||
}
|
||||
return region;
|
||||
}
|
||||
|
||||
async function deallocate(provision, isSendEmailAfter) {
|
||||
|
||||
let rgName = _getRgName(provision);
|
||||
let region = _getRegion(provision);
|
||||
|
||||
console.log("AWSCLI# Stopping EC2s for resource group: "+rgName);
|
||||
|
||||
var ec2 = new AWS.EC2({apiVersion: '2016-11-15', region: region});
|
||||
var params = {
|
||||
DryRun: false,
|
||||
Filters: [
|
||||
{
|
||||
Name: 'tag:Name',
|
||||
Values: [ `fort-${provision._id}` ]
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
ec2.describeInstances(params, async function (err, data) {
|
||||
if (err) {
|
||||
console.log("AWSCLI# ERROR describing EC2s: "+rgName, err.stack);
|
||||
} else {
|
||||
|
||||
var ec2Ids = data.Reservations[0].Instances.map(ec2=> ec2.InstanceId);
|
||||
console.log("AWSCLI# Stopping EC2s ids", ec2Ids);
|
||||
params = {
|
||||
DryRun: false,
|
||||
InstanceIds: ec2Ids
|
||||
};
|
||||
|
||||
ec2.stopInstances(params, async function(err, data) {
|
||||
if (err) {
|
||||
console.log("AWSCLI# ERROR stopping EC2s: "+rgName, err.stack);
|
||||
} else {
|
||||
console.log("AWSCLI# EC2s stopped!");
|
||||
utils.afterStopVms( provision, isSendEmailAfter );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function start(provision) {
|
||||
|
||||
let rgName = _getRgName(provision);
|
||||
let region = _getRegion(provision);
|
||||
|
||||
console.log("AWSCLI# Stopping EC2s for resource group: "+rgName);
|
||||
|
||||
var ec2 = new AWS.EC2({apiVersion: '2016-11-15', region: region});
|
||||
var params = {
|
||||
DryRun: false,
|
||||
Filters: [
|
||||
{
|
||||
Name: 'tag:Name',
|
||||
Values: [ `fort-${provision._id}` ]
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
ec2.describeInstances(params, async function (err, data) {
|
||||
if (err) {
|
||||
console.log("AWSCLI# ERROR describing EC2s: "+rgName, err.stack);
|
||||
} else {
|
||||
|
||||
var ec2Ids = data.Reservations[0].Instances.map(ec2=> ec2.InstanceId);
|
||||
console.log("AWSCLI# Starting EC2s ids", ec2Ids);
|
||||
params = {
|
||||
DryRun: false,
|
||||
InstanceIds: ec2Ids
|
||||
};
|
||||
|
||||
ec2.startInstances(params, async function(err, data) {
|
||||
if (err) {
|
||||
console.log("AWSCLI# ERROR starting EC2s: "+rgName, err.stack);
|
||||
} else if (data) {
|
||||
console.log("AWSCLI# EC2s started!");
|
||||
utils.afterStartVms( provision );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.deallocate = deallocate;
|
||||
module.exports.start = start;
|
||||
@@ -2,7 +2,7 @@ const loginWithVmMSI = require("@azure/ms-rest-nodeauth").loginWithVmMSI;
|
||||
const computeManagementClient = require("@azure/arm-compute").ComputeManagementClient;
|
||||
const dnsManagementClient = require("@azure/arm-dns").DnsManagementClient;
|
||||
const db = require("./mongo");
|
||||
const sendEmail = require("./send-email");
|
||||
const utils = require("./utils");
|
||||
|
||||
const SUBSCRIPTION_ID = "62ebff8f-c40b-41be-9239-252d6c0c8ad9";
|
||||
|
||||
@@ -42,12 +42,11 @@ async function asyncForEach(array, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
async function deallocate(provId, isSendEmailAfter ) {
|
||||
let provision = await db.provision.getById(provId);
|
||||
if ( !provision ) return;
|
||||
|
||||
async function deallocate(provision, isSendEmailAfter ) {
|
||||
|
||||
let rgName = _getRgName(provision);
|
||||
console.log("AzureCLI# Deallocating VMs for resource group: "+rgName);
|
||||
|
||||
var computeClient = await _getClient(provision.scenario);
|
||||
let finalResult = await computeClient.virtualMachines.list(rgName);
|
||||
if ( finalResult && finalResult.length > 0 ) {
|
||||
@@ -59,54 +58,7 @@ async function deallocate(provId, isSendEmailAfter ) {
|
||||
await computeClient.virtualMachines.deallocate(rgName, vm.name);
|
||||
});
|
||||
|
||||
let timeRunning = db.utils.getNewTimeRunning(provision);
|
||||
const dateNow = new Date();
|
||||
let patch = {
|
||||
"statusVms": "Stopped",
|
||||
"timeRunning": timeRunning,
|
||||
"stoppedFrom": dateNow,
|
||||
"pendingNextAction": undefined
|
||||
};
|
||||
|
||||
if ( isSendEmailAfter && provision._scenarioDoc ) { //From CLI (auto stop)
|
||||
let msg = "";
|
||||
// Actual onschedule reset
|
||||
if ( provision.schedule && !provision.schedule.is24x7 ) {
|
||||
patch["startDateOnSchedule"] = dateNow;
|
||||
patch["endDateOnSchedule"] = dateNow;
|
||||
msg = "Schedule time has been reset.";
|
||||
} else {
|
||||
msg = "24x7 vms auto-stopped due to limitted running time reached.";
|
||||
}
|
||||
|
||||
msg += `New totalTimeRunning: ${timeRunning} mins`;
|
||||
|
||||
await db.provision.update(provision._id.toString(), patch);
|
||||
await sendEmail.sendVMsStopped(provision, provision._scenarioDoc);
|
||||
db.event.add({ user: provision.user._id, provision: provision._id, type: 'vms.stop-auto', message: msg });
|
||||
|
||||
} else { //On Demand stop
|
||||
let msg = "";
|
||||
if ( provision.schedule && !provision.schedule.is24x7 ) {
|
||||
patch["endDateOnSchedule"] = dateNow;
|
||||
|
||||
//This is temporary, only to make sure there is some initial value soon
|
||||
if ( !provision["startDateOnSchedule"] ) {
|
||||
patch["startDateOnSchedule"] = dateNow;
|
||||
msg = "startDateOS: " + dateNow.toISOString();
|
||||
} else {
|
||||
msg = "startDateOS: " + new Date(provision.startDateOnSchedule).toISOString();
|
||||
}
|
||||
msg += (" - endDateOS: " + dateNow.toISOString());
|
||||
|
||||
}
|
||||
|
||||
msg += ` - New totalTimeRunning: ${timeRunning} mins`;
|
||||
|
||||
await db.provision.update(provision._id.toString(), patch);
|
||||
|
||||
db.event.add({ user: provision.user._id, provision: provision._id, type: 'vms.stop-ondemand', message: msg });
|
||||
}
|
||||
await utils.afterStopVms(provision, isSendEmailAfter);
|
||||
|
||||
console.log("AzureCLI# All VMs DEALLOCATED for resource group: "+rgName);
|
||||
} catch ( error ) {
|
||||
@@ -115,11 +67,8 @@ async function deallocate(provId, isSendEmailAfter ) {
|
||||
}
|
||||
}
|
||||
|
||||
async function start(provId){
|
||||
async function start(provision){
|
||||
|
||||
let provision = await db.provision.getById(provId);
|
||||
if ( !provision ) return;
|
||||
|
||||
let rgName = _getRgName(provision);
|
||||
console.log("AzureCLI# Starting VMs for resource group: "+rgName);
|
||||
|
||||
@@ -134,31 +83,8 @@ async function start(provId){
|
||||
await asyncForEach(finalResult, async function(vm) {
|
||||
await computeClient.virtualMachines.start(rgName, vm.name);
|
||||
});
|
||||
const dateNow = new Date();
|
||||
let countExtend = db.utils.getNewCountExtend(provision);
|
||||
var patch = {
|
||||
"statusVms": "Running",
|
||||
"runningFrom": dateNow,
|
||||
"countExtend": countExtend,
|
||||
"pendingNextAction": undefined
|
||||
};
|
||||
|
||||
// Actual onschedule reset
|
||||
let msg = "";
|
||||
if ( provision.schedule && !provision.schedule.is24x7 ) {
|
||||
msg = "Schedule time has been reset.";
|
||||
patch["startDateOnSchedule"] = dateNow;
|
||||
patch["endDateOnSchedule"] = dateNow;
|
||||
} else {
|
||||
msg = `24x7, New count extend: ${countExtend}`;
|
||||
}
|
||||
|
||||
msg += `TotalTimeRunning so far: ${provision.timeRunning} mins`;
|
||||
|
||||
await db.provision.update(provision._id.toString(), patch);
|
||||
console.log("AzureCLI# All VMs RUNNING for resource group: "+rgName);
|
||||
|
||||
db.event.add({ user: provision.user._id, provision: provision._id, type: 'vms.start-ondemand', message: msg });
|
||||
await utils.afterStartVms( provision );
|
||||
|
||||
} catch ( error ) {
|
||||
console.log("AzureCLI# ERROR starting VMs: "+rgName, error);
|
||||
|
||||
38
qmi-cloud-common/cli.js
Normal file
38
qmi-cloud-common/cli.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const awscli = require("./awscli");
|
||||
const azurecli = require("./azurecli");
|
||||
const db = require("./mongo");
|
||||
|
||||
|
||||
async function deallocate(provId, isSendEmailAfter ) {
|
||||
let provision = await db.provision.getById(provId);
|
||||
if ( !provision ) return;
|
||||
|
||||
azurecli.deallocate(provision, isSendEmailAfter);
|
||||
|
||||
if (provision.scenario === 'azqmi-fort'){
|
||||
awscli.stop(provision, isSendEmailAfter);
|
||||
} else {
|
||||
azurecli.deallocate(provision, isSendEmailAfter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function start(provId){
|
||||
|
||||
let provision = await db.provision.getById(provId);
|
||||
if ( !provision ) return;
|
||||
|
||||
if (provision.scenario === 'azqmi-fort'){
|
||||
awscli.start(provision);
|
||||
} else {
|
||||
azurecli.start(provision);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateVmsTags(provId, tagsEdit) {
|
||||
azurecli.updateVmsTags(provId, tagsEdit);
|
||||
}
|
||||
|
||||
module.exports.deallocate = deallocate;
|
||||
module.exports.start = start;
|
||||
module.exports.updateVmsTags = updateVmsTags;
|
||||
@@ -6,10 +6,12 @@
|
||||
"@azure/arm-dns": "^4.0.0",
|
||||
"@azure/ms-rest-nodeauth": "^3.0.7",
|
||||
"@hapi/boom": "^9.1.0",
|
||||
"aws-sdk": "^2.942.0",
|
||||
"axios": "^0.21.1",
|
||||
"barracuda-api": "https://gitlab.com/qlik_gear/barracuda-api-node.git#0.0.10",
|
||||
"bull": "^3.11.0",
|
||||
"mongoose": "^5.7.4",
|
||||
"nodemailer": "^6.4.2"
|
||||
"nodemailer": "^6.4.2",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
85
qmi-cloud-common/utils.js
Normal file
85
qmi-cloud-common/utils.js
Normal file
@@ -0,0 +1,85 @@
|
||||
const db = require("./mongo");
|
||||
const sendEmail = require("./send-email");
|
||||
|
||||
async function afterStopVms( provision, auto ) {
|
||||
let timeRunning = db.utils.getNewTimeRunning(provision);
|
||||
const dateNow = new Date();
|
||||
let patch = {
|
||||
"statusVms": "Stopped",
|
||||
"timeRunning": timeRunning,
|
||||
"stoppedFrom": dateNow,
|
||||
"pendingNextAction": undefined
|
||||
};
|
||||
|
||||
if ( auto && provision._scenarioDoc ) { //From CLI (auto stop)
|
||||
let msg = "";
|
||||
// Actual onschedule reset
|
||||
if ( provision.schedule && !provision.schedule.is24x7 ) {
|
||||
patch["startDateOnSchedule"] = dateNow;
|
||||
patch["endDateOnSchedule"] = dateNow;
|
||||
msg = "Schedule time has been reset.";
|
||||
} else {
|
||||
msg = "24x7 vms auto-stopped due to limitted running time reached.";
|
||||
}
|
||||
|
||||
msg += `New totalTimeRunning: ${timeRunning} mins`;
|
||||
|
||||
await db.provision.update(provision._id.toString(), patch);
|
||||
await sendEmail.sendVMsStopped(provision, provision._scenarioDoc);
|
||||
db.event.add({ user: provision.user._id, provision: provision._id, type: 'vms.stop-auto', message: msg });
|
||||
|
||||
} else { //On Demand stop
|
||||
let msg = "";
|
||||
if ( provision.schedule && !provision.schedule.is24x7 ) {
|
||||
patch["endDateOnSchedule"] = dateNow;
|
||||
|
||||
//This is temporary, only to make sure there is some initial value soon
|
||||
if ( !provision["startDateOnSchedule"] ) {
|
||||
patch["startDateOnSchedule"] = dateNow;
|
||||
msg = "startDateOS: " + dateNow.toISOString();
|
||||
} else {
|
||||
msg = "startDateOS: " + new Date(provision.startDateOnSchedule).toISOString();
|
||||
}
|
||||
msg += (" - endDateOS: " + dateNow.toISOString());
|
||||
|
||||
}
|
||||
|
||||
msg += ` - New totalTimeRunning: ${timeRunning} mins`;
|
||||
|
||||
await db.provision.update(provision._id.toString(), patch);
|
||||
|
||||
db.event.add({ user: provision.user._id, provision: provision._id, type: 'vms.stop-ondemand', message: msg });
|
||||
}
|
||||
}
|
||||
|
||||
async function afterStartVms( provision ) {
|
||||
const dateNow = new Date();
|
||||
let countExtend = db.utils.getNewCountExtend(provision);
|
||||
var patch = {
|
||||
"statusVms": "Running",
|
||||
"runningFrom": dateNow,
|
||||
"countExtend": countExtend,
|
||||
"pendingNextAction": undefined
|
||||
};
|
||||
|
||||
// Actual onschedule reset
|
||||
let msg = "";
|
||||
if ( provision.schedule && !provision.schedule.is24x7 ) {
|
||||
msg = "Schedule time has been reset.";
|
||||
patch["startDateOnSchedule"] = dateNow;
|
||||
patch["endDateOnSchedule"] = dateNow;
|
||||
} else {
|
||||
msg = `24x7, New count extend: ${countExtend}`;
|
||||
}
|
||||
|
||||
msg += `TotalTimeRunning so far: ${provision.timeRunning} mins`;
|
||||
|
||||
await db.provision.update(provision._id.toString(), patch);
|
||||
console.log("AzureCLI# All VMs RUNNING for resource group: "+rgName);
|
||||
|
||||
db.event.add({ user: provision.user._id, provision: provision._id, type: 'vms.start-ondemand', message: msg });
|
||||
|
||||
}
|
||||
|
||||
module.exports.afterStopVms = afterStopVms;
|
||||
module.exports.afterStartVms = afterStartVms;
|
||||
@@ -181,6 +181,21 @@ asynckit@^0.4.0:
|
||||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
|
||||
|
||||
aws-sdk@^2.942.0:
|
||||
version "2.942.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.942.0.tgz#594d2e629ab4a2286eaf69c54658cea3acce4ec7"
|
||||
integrity sha512-9Y+DWSTvolTJe0nl55sKnsPgtfBCV8WKDE8cAUhgn9MIb4tAGpwejS14AUmqeZ12J58AsgPT3PffdI7Hq9IEtQ==
|
||||
dependencies:
|
||||
buffer "4.9.2"
|
||||
events "1.1.1"
|
||||
ieee754 "1.1.13"
|
||||
jmespath "0.15.0"
|
||||
querystring "0.2.0"
|
||||
sax "1.2.1"
|
||||
url "0.10.3"
|
||||
uuid "3.3.2"
|
||||
xml2js "0.4.19"
|
||||
|
||||
aws-sign2@~0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
|
||||
@@ -198,12 +213,17 @@ axios@^0.21.1:
|
||||
dependencies:
|
||||
follow-redirects "^1.10.0"
|
||||
|
||||
"barracuda-api@https://gitlab.com/qlik_gear/barracuda-api-node.git#0.0.8":
|
||||
version "0.0.8"
|
||||
resolved "https://gitlab.com/qlik_gear/barracuda-api-node.git#23d3444f42fd6fd4c56ca5b83b788af93be3b0bf"
|
||||
"barracuda-api@https://gitlab.com/qlik_gear/barracuda-api-node.git#0.0.10":
|
||||
version "0.0.10"
|
||||
resolved "https://gitlab.com/qlik_gear/barracuda-api-node.git#de3fa6ab0a41a4afb8d3cfc35c2c1461cf88896d"
|
||||
dependencies:
|
||||
axios "^0.21.1"
|
||||
|
||||
base64-js@^1.0.2:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
|
||||
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
||||
|
||||
bcrypt-pbkdf@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
|
||||
@@ -234,6 +254,15 @@ buffer-equal-constant-time@1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
|
||||
integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=
|
||||
|
||||
buffer@4.9.2:
|
||||
version "4.9.2"
|
||||
resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.2.tgz#230ead344002988644841ab0244af8c44bbe3ef8"
|
||||
integrity sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==
|
||||
dependencies:
|
||||
base64-js "^1.0.2"
|
||||
ieee754 "^1.1.4"
|
||||
isarray "^1.0.0"
|
||||
|
||||
bull@^3.11.0:
|
||||
version "3.20.1"
|
||||
resolved "https://registry.yarnpkg.com/bull/-/bull-3.20.1.tgz#97c4156f48001565baf3c04b81267a5604f40754"
|
||||
@@ -387,6 +416,11 @@ event-target-shim@^5.0.0:
|
||||
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
|
||||
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
|
||||
|
||||
events@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
|
||||
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=
|
||||
|
||||
extend@~3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
|
||||
@@ -521,6 +555,16 @@ http-signature@~1.2.0:
|
||||
jsprim "^1.2.2"
|
||||
sshpk "^1.7.0"
|
||||
|
||||
ieee754@1.1.13:
|
||||
version "1.1.13"
|
||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
|
||||
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
|
||||
|
||||
ieee754@^1.1.4:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
||||
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
||||
|
||||
inherits@~2.0.3:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||
@@ -612,7 +656,7 @@ is-typedarray@~1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
|
||||
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
|
||||
|
||||
isarray@~1.0.0:
|
||||
isarray@^1.0.0, isarray@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
|
||||
@@ -622,6 +666,11 @@ isstream@~0.1.2:
|
||||
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
|
||||
|
||||
jmespath@0.15.0:
|
||||
version "0.15.0"
|
||||
resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217"
|
||||
integrity sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=
|
||||
|
||||
jsbn@~0.1.0:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
|
||||
@@ -872,6 +921,11 @@ psl@^1.1.28:
|
||||
resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24"
|
||||
integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==
|
||||
|
||||
punycode@1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"
|
||||
integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=
|
||||
|
||||
punycode@^2.1.0, punycode@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
|
||||
@@ -882,6 +936,11 @@ qs@~6.5.2:
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
||||
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
|
||||
|
||||
querystring@0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
|
||||
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
|
||||
|
||||
readable-stream@^2.3.5:
|
||||
version "2.3.7"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
|
||||
@@ -978,6 +1037,11 @@ saslprep@^1.0.0:
|
||||
dependencies:
|
||||
sparse-bitfield "^3.0.3"
|
||||
|
||||
sax@1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a"
|
||||
integrity sha1-e45lYZCyKOgaZq6nSEgNgozS03o=
|
||||
|
||||
sax@>=0.6.0:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
|
||||
@@ -1121,6 +1185,14 @@ uri-js@^4.2.2:
|
||||
dependencies:
|
||||
punycode "^2.1.0"
|
||||
|
||||
url@0.10.3:
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64"
|
||||
integrity sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=
|
||||
dependencies:
|
||||
punycode "1.3.2"
|
||||
querystring "0.2.0"
|
||||
|
||||
util-deprecate@~1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
@@ -1137,12 +1209,17 @@ util.promisify@^1.0.1:
|
||||
has-symbols "^1.0.1"
|
||||
object.getownpropertydescriptors "^2.1.1"
|
||||
|
||||
uuid@3.3.2:
|
||||
version "3.3.2"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
||||
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
|
||||
|
||||
uuid@^3.1.0, uuid@^3.3.2:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||
|
||||
uuid@^8.3.0:
|
||||
uuid@^8.3.0, uuid@^8.3.2:
|
||||
version "8.3.2"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
@@ -1167,6 +1244,14 @@ which-boxed-primitive@^1.0.1:
|
||||
is-string "^1.0.5"
|
||||
is-symbol "^1.0.3"
|
||||
|
||||
xml2js@0.4.19:
|
||||
version "0.4.19"
|
||||
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7"
|
||||
integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==
|
||||
dependencies:
|
||||
sax ">=0.6.0"
|
||||
xmlbuilder "~9.0.1"
|
||||
|
||||
xml2js@^0.4.19:
|
||||
version "0.4.23"
|
||||
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66"
|
||||
@@ -1180,6 +1265,11 @@ xmlbuilder@~11.0.0:
|
||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
|
||||
integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
|
||||
|
||||
xmlbuilder@~9.0.1:
|
||||
version "9.0.7"
|
||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
|
||||
integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=
|
||||
|
||||
"xmldom@>= 0.1.x":
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.5.0.tgz#193cb96b84aa3486127ea6272c4596354cb4962e"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "qmi-cloud-worker",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"scripts": {
|
||||
"start": "node -r esm index.js",
|
||||
"start:dev": "nodemon -r esm index.js",
|
||||
|
||||
@@ -338,7 +338,7 @@ router.post('/:id/updatetagsvms', passport.ensureAuthenticatedAndAdmin, async (r
|
||||
if (!provision) {
|
||||
return res.status(404).json({"msg": "Not found provision with id: "+req.params.id, "success": false});
|
||||
}
|
||||
var result = await azurecli.updateVmsTags(provision._id, tagsEdit);
|
||||
var result = await cli.updateVmsTags(provision._id, tagsEdit);
|
||||
return res.json({"msg": "Tags are being updated", "result": result, "success": true});
|
||||
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,7 +4,7 @@ const db = require('qmi-cloud-common/mongo');
|
||||
const config = require('qmi-cloud-common/config');
|
||||
const passport = require('../passport');
|
||||
const fs = require('fs-extra');
|
||||
const azurecli = require('qmi-cloud-common/azurecli');
|
||||
const cli = require('qmi-cloud-common/cli');
|
||||
const barracuda = require('qmi-cloud-common/barracuda');
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ router.put('/:userId/provisions/:id', passport.ensureAuthenticatedAndIsMe, async
|
||||
"StartupTime": (schedule.isStartupTimeEnable && !schedule.is24x7 && schedule.utcTagStartupTime)? schedule.utcTagStartupTime : false,
|
||||
"ShutdownTime": (!schedule.is24x7 && schedule.utcTagShutdownTime)? schedule.utcTagShutdownTime : false
|
||||
}
|
||||
azurecli.updateVmsTags(provision._id, tagsEdit);
|
||||
cli.updateVmsTags(provision._id, tagsEdit);
|
||||
|
||||
}
|
||||
|
||||
@@ -617,10 +617,10 @@ router.post('/:userId/provisions/:id/deallocatevms', passport.ensureAuthenticate
|
||||
"StartupTime": (schedule.isStartupTimeEnable && !schedule.is24x7 && schedule.utcTagStartupTime)? schedule.utcTagStartupTime : false,
|
||||
"ShutdownTime": (!schedule.is24x7 && schedule.utcTagShutdownTime)? schedule.utcTagShutdownTime : false
|
||||
}
|
||||
azurecli.updateVmsTags(provision._id, tagsEdit);
|
||||
cli.updateVmsTags(provision._id, tagsEdit);
|
||||
}
|
||||
|
||||
azurecli.deallocate(provision._id);
|
||||
cli.deallocate(provision._id);
|
||||
|
||||
return res.json({"statusVms": "Stopping"});
|
||||
|
||||
@@ -673,10 +673,10 @@ router.post('/:userId/provisions/:id/startvms', passport.ensureAuthenticatedAndI
|
||||
"StartupTime": (schedule.isStartupTimeEnable && !schedule.is24x7 && schedule.utcTagStartupTime)? schedule.utcTagStartupTime : false,
|
||||
"ShutdownTime": (!schedule.is24x7 && schedule.utcTagShutdownTime)? schedule.utcTagShutdownTime : false
|
||||
}
|
||||
azurecli.updateVmsTags(provision._id, tagsEdit);
|
||||
cli.updateVmsTags(provision._id, tagsEdit);
|
||||
}
|
||||
|
||||
azurecli.start(provision._id);
|
||||
cli.start(provision._id);
|
||||
|
||||
return res.json({"statusVms": "Starting"});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user