Skip to content

Commit

Permalink
Merge pull request #5968 from nimrod-becker/backport_to_5_3
Browse files Browse the repository at this point in the history
Backport to 5.3: Fixing deletion of OBCs
  • Loading branch information
nimrod-becker authored Mar 30, 2020
2 parents 25cd79b + 029f4d8 commit eb33199
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/server/bg_services/buckets_reclaimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const system_store = require('../system_services/system_store').get_instance();
const system_utils = require('../utils/system_utils');
const P = require('../../util/promise');
const auth_server = require('../common_services/auth_server');
const _ = require('lodash');

class BucketsReclaimer {

Expand All @@ -18,6 +19,7 @@ class BucketsReclaimer {
async run_batch() {
if (!this._can_run()) return;

const support_account = _.find(system_store.data.accounts, account => account.is_support);
const deleting_buckets = this._get_deleting_buckets();
if (!deleting_buckets || !deleting_buckets.length) {
dbg.log0('no buckets in "deleting" state. nothing to do');
Expand All @@ -36,6 +38,7 @@ class BucketsReclaimer {
}, {
auth_token: auth_server.make_auth_token({
system_id: system_store.data.systems[0]._id,
account_id: support_account._id,
role: 'admin'
})
});
Expand All @@ -44,6 +47,7 @@ class BucketsReclaimer {
await this.client.bucket.delete_bucket({ name: bucket.name, internal_call: true }, {
auth_token: auth_server.make_auth_token({
system_id: system_store.data.systems[0]._id,
account_id: support_account._id,
role: 'admin'
})
});
Expand Down Expand Up @@ -72,6 +76,9 @@ class BucketsReclaimer {
const system = system_store.data.systems[0];
if (!system || system_utils.system_in_maintenance(system._id)) return false;

const support_account = _.find(system_store.data.accounts, account => account.is_support);
if (!support_account) return false;

return true;
}

Expand Down

0 comments on commit eb33199

Please sign in to comment.