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;