From 7ec3c6b1c5cb6d012389fcd29cf5b2eefbb3bd83 Mon Sep 17 00:00:00 2001 From: Manuel Romero Date: Mon, 19 Sep 2022 12:49:31 +0200 Subject: [PATCH] fixed cli conditions --- qmi-cloud-cli/jobs/destroy5.js | 6 +++--- qmi-cloud-cli/jobs/stop5.js | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qmi-cloud-cli/jobs/destroy5.js b/qmi-cloud-cli/jobs/destroy5.js index 45ed5b2..6a06e77 100644 --- a/qmi-cloud-cli/jobs/destroy5.js +++ b/qmi-cloud-cli/jobs/destroy5.js @@ -70,12 +70,12 @@ async function init(type) { var filter = { "isDestroyed":false, "isDeleted": false, - "$or": [ {"runForever":{ "$exists": false }}, {"runForever": false}], + "$and": [{ "$or": [ {"runForever":{ "$exists": false }}, {"runForever": false}]}], "statusVms": "Stopped", - "$or": [ + "$and": [{"$or": [ { "options": {"$exists": true}, "options.vm1": { "$exists": true } }, { "vmImage": {"$exists": true}, "vmImage.vm1": { "$exists": true } }, - ] + ]}] }; if ( type === "warning" ) { filter.pendingNextAction = {$ne: "destroy"}; diff --git a/qmi-cloud-cli/jobs/stop5.js b/qmi-cloud-cli/jobs/stop5.js index 4cc9240..e123315 100644 --- a/qmi-cloud-cli/jobs/stop5.js +++ b/qmi-cloud-cli/jobs/stop5.js @@ -61,13 +61,14 @@ async function init(type) { var filter = { "isDestroyed": false, "isDeleted": false, - "$or": [ {"runForever":{ "$exists": false }}, {"runForever": false}], + "$and": [{ "$or": [ {"runForever":{ "$exists": false }}, {"runForever": false}]}], "statusVms": "Running", - "$or": [ + "$and": [{"$or": [ { "options": {"$exists": true}, "options.vm1": { "$exists": true } }, { "vmImage": {"$exists": true}, "vmImage.vm1": { "$exists": true } }, - ] + ]}] }; + if ( type === "warning" ) { filter.pendingNextAction = { $ne: "stopVms" }; cb = doSendEmailWarning;