Skip to content

Commit eb33199

Browse files
Merge pull request #5968 from nimrod-becker/backport_to_5_3
Backport to 5.3: Fixing deletion of OBCs
2 parents 25cd79b + 029f4d8 commit eb33199

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/server/bg_services/buckets_reclaimer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const system_store = require('../system_services/system_store').get_instance();
77
const system_utils = require('../utils/system_utils');
88
const P = require('../../util/promise');
99
const auth_server = require('../common_services/auth_server');
10+
const _ = require('lodash');
1011

1112
class BucketsReclaimer {
1213

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

22+
const support_account = _.find(system_store.data.accounts, account => account.is_support);
2123
const deleting_buckets = this._get_deleting_buckets();
2224
if (!deleting_buckets || !deleting_buckets.length) {
2325
dbg.log0('no buckets in "deleting" state. nothing to do');
@@ -36,6 +38,7 @@ class BucketsReclaimer {
3638
}, {
3739
auth_token: auth_server.make_auth_token({
3840
system_id: system_store.data.systems[0]._id,
41+
account_id: support_account._id,
3942
role: 'admin'
4043
})
4144
});
@@ -44,6 +47,7 @@ class BucketsReclaimer {
4447
await this.client.bucket.delete_bucket({ name: bucket.name, internal_call: true }, {
4548
auth_token: auth_server.make_auth_token({
4649
system_id: system_store.data.systems[0]._id,
50+
account_id: support_account._id,
4751
role: 'admin'
4852
})
4953
});
@@ -72,6 +76,9 @@ class BucketsReclaimer {
7276
const system = system_store.data.systems[0];
7377
if (!system || system_utils.system_in_maintenance(system._id)) return false;
7478

79+
const support_account = _.find(system_store.data.accounts, account => account.is_support);
80+
if (!support_account) return false;
81+
7582
return true;
7683
}
7784

0 commit comments

Comments
 (0)