Skip to content

Commit ce8d230

Browse files
Merge branch 'w/9.2/bugfix/CLDSRV-850' into w/9.3/bugfix/CLDSRV-850
2 parents fae1475 + 81944ba commit ce8d230

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

lib/Config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ class Config extends EventEmitter {
18801880

18811881
if (config.capabilities) {
18821882
if (config.capabilities.locationTypes) {
1883-
config.capabilities.locationTypes = new Set(config.capabilities.locationTypes);
1883+
this.supportedLocationTypes = new Set(config.capabilities.locationTypes);
18841884
}
18851885
this.capabilities = config.capabilities;
18861886
}

lib/utilities/reportHandler.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ function getCapabilities(cfg = config) {
6666
caps.lifecycleRules &&= cfg.supportedLifecycleRules;
6767

6868
// Map locationTypes entries to the respective "legacy" capability flags
69-
if (caps.locationTypes) {
70-
caps.locationTypeAzure &&= caps.locationTypes.has('location-azure-v1');
71-
caps.locationTypeGCP &&= caps.locationTypes.has('location-gcp-v1');
72-
caps.locationTypeDigitalOcean &&= caps.locationTypes.has('location-do-spaces-v1');
73-
caps.locationTypeSproxyd &&= caps.locationTypes.has('location-scality-sproxyd-v1');
74-
caps.locationTypeNFS &&= caps.locationTypes.has('location-nfs-mount-v1');
75-
caps.locationTypeCephRadosGW &&= caps.locationTypes.has('location-ceph-radosgw-s3-v1');
76-
caps.locationTypeHyperdriveV2 &&= caps.locationTypes.has('location-scality-hdclient-v2');
77-
caps.locationTypeLocal &&= caps.locationTypes.has('location-file-v1');
69+
if (cfg.supportedLocationTypes) {
70+
caps.locationTypeAzure &&= cfg.supportedLocationTypes.has('location-azure-v1');
71+
caps.locationTypeGCP &&= cfg.supportedLocationTypes.has('location-gcp-v1');
72+
caps.locationTypeDigitalOcean &&= cfg.supportedLocationTypes.has('location-do-spaces-v1');
73+
caps.locationTypeSproxyd &&= cfg.supportedLocationTypes.has('location-scality-sproxyd-v1');
74+
caps.locationTypeNFS &&= cfg.supportedLocationTypes.has('location-nfs-mount-v1');
75+
caps.locationTypeCephRadosGW &&= cfg.supportedLocationTypes.has('location-ceph-radosgw-s3-v1');
76+
caps.locationTypeHyperdriveV2 &&= cfg.supportedLocationTypes.has('location-scality-hdclient-v2');
77+
caps.locationTypeLocal &&= cfg.supportedLocationTypes.has('location-file-v1');
7878
}
7979

8080
return caps;

tests/unit/utils/reportHandler.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ describe('reportHandler.getCapabilities', () => {
214214
});
215215

216216
it('should update locationTypes capabilities based on locationTypes map', () => {
217+
const locationTypes = [
218+
'location-gcp-v1',
219+
'location-scality-sproxyd-v1',
220+
'location-ceph-radosgw-s3-v1',
221+
'location-file-v1',
222+
'location-scality-artesca-s3-v1',
223+
];
217224
const cfg = {
218225
capabilities: {
219226
locationTypeAzure: true,
@@ -225,15 +232,10 @@ describe('reportHandler.getCapabilities', () => {
225232
locationTypeCephRadosGW: true,
226233
locationTypeHyperdriveV2: true,
227234
locationTypeLocal: true,
228-
locationTypes: new Set([
229-
'location-gcp-v1',
230-
'location-scality-sproxyd-v1',
231-
'location-ceph-radosgw-s3-v1',
232-
'location-file-v1',
233-
'location-scality-artesca-s3-v1',
234-
]),
235+
locationTypes,
235236
},
236237
supportedLifecycleRules: ['Expiration'],
238+
supportedLocationTypes: new Set(locationTypes),
237239
};
238240
const caps = getCapabilities(cfg);
239241

@@ -250,6 +252,7 @@ describe('reportHandler.getCapabilities', () => {
250252

251253
it('should handle multiple consistency checks together', () => {
252254
process.env.LOCAL_VOLUME_CAPABILITY = '0';
255+
const locationTypes = ['location-azure-v1'];
253256
const cfg = {
254257
capabilities: {
255258
locationTypeLocal: true,
@@ -258,9 +261,10 @@ describe('reportHandler.getCapabilities', () => {
258261
managedLifecycleTransition: true,
259262
locationTypeAzure: true,
260263
locationTypeGCP: true,
261-
locationTypes: new Set(['location-azure-v1']),
264+
locationTypes,
262265
},
263266
supportedLifecycleRules: ['Expiration'], // Missing Transition
267+
supportedLocationTypes: new Set(locationTypes),
264268
};
265269
const caps = getCapabilities(cfg);
266270

0 commit comments

Comments
 (0)