Skip to content

Commit b34f502

Browse files
Remove dmf and azure_archive location types
Issue: CLDSRV-624
1 parent ec582e5 commit b34f502

8 files changed

Lines changed: 85 additions & 278 deletions

File tree

constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const constants = {
130130
},
131131
},
132132
/* eslint-disable camelcase */
133-
externalBackends: { aws_s3: true, azure: true, gcp: true, pfs: true, dmf: true, azure_archive: true, tlp: true },
133+
externalBackends: { aws_s3: true, azure: true, gcp: true, pfs: true, tlp: true },
134134
// some of the available data backends (if called directly rather
135135
// than through the multiple backend gateway) need a key provided
136136
// as a string as first parameter of the get/delete methods.

lib/Config.js

Lines changed: 10 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -300,103 +300,9 @@ function hdClientLocationConstraintAssert(configHd) {
300300
return hdclientFields;
301301
}
302302

303-
function azureArchiveLocationConstraintAssert(locationObj) {
304-
const checkedFields = [
305-
'azureContainerName',
306-
'azureStorageEndpoint',
307-
];
308-
if (Object.keys(locationObj.details).length === 0 ||
309-
!checkedFields.every(field => field in locationObj.details)) {
310-
return;
311-
}
312-
const {
313-
azureContainerName,
314-
azureStorageEndpoint,
315-
} = locationObj.details;
316-
const stringFields = [
317-
azureContainerName,
318-
azureStorageEndpoint,
319-
];
320-
stringFields.forEach(field => {
321-
assert(typeof field === 'string',
322-
`bad config: ${field} must be a string`);
323-
});
324-
325-
let hasAuthMethod = false;
326-
if (locationObj.details.sasToken !== undefined) {
327-
assert(typeof locationObj.details.sasToken === 'string',
328-
`bad config: ${locationObj.details.sasToken} must be a string`);
329-
hasAuthMethod = true;
330-
}
331-
332-
if (locationObj.details.azureStorageAccountName !== undefined &&
333-
locationObj.details.azureStorageAccessKey !== undefined) {
334-
assert(typeof locationObj.details.azureStorageAccountName === 'string',
335-
`bad config: ${locationObj.details.azureStorageAccountName} must be a string`);
336-
assert(typeof locationObj.details.azureStorageAccessKey === 'string',
337-
`bad config: ${locationObj.details.azureStorageAccessKey} must be a string`);
338-
assert(!hasAuthMethod, 'Multiple authentication methods are not allowed');
339-
hasAuthMethod = true;
340-
}
341-
342-
if (locationObj.details.tenantId !== undefined &&
343-
locationObj.details.clientId !== undefined &&
344-
locationObj.details.clientKey !== undefined) {
345-
assert(typeof locationObj.details.tenantId === 'string',
346-
`bad config: ${locationObj.details.tenantId} must be a string`);
347-
assert(typeof locationObj.details.clientId === 'string',
348-
`bad config: ${locationObj.details.clientId} must be a string`);
349-
assert(typeof locationObj.details.clientKey === 'string',
350-
`bad config: ${locationObj.details.clientKey} must be a string`);
351-
assert(!hasAuthMethod, 'Multiple authentication methods are not allowed');
352-
hasAuthMethod = true;
353-
}
354-
assert(hasAuthMethod, 'Missing authentication method');
355-
}
356-
357-
function dmfLocationConstraintAssert(locationObj) {
358-
const checkedFields = [
359-
'endpoint',
360-
'username',
361-
'password',
362-
'repoId',
363-
'nsId',
364-
];
365-
if (Object.keys(locationObj.details).length === 0 ||
366-
!checkedFields.every(field => field in locationObj.details)) {
367-
return;
368-
}
369-
const {
370-
endpoint,
371-
username,
372-
password,
373-
repoId,
374-
nsId,
375-
} = locationObj.details;
376-
const stringFields = [
377-
endpoint,
378-
username,
379-
password,
380-
nsId,
381-
];
382-
stringFields.forEach(field => {
383-
assert(typeof field === 'string',
384-
`bad config: ${field} must be a string`);
385-
});
386-
assert.strictEqual(Array.isArray(repoId), true);
387-
repoId.forEach(rId => {
388-
assert(typeof rId === 'string',
389-
`bad config: ${rId} must be a string`);
390-
});
391-
assert(repoId.every(
392-
r => typeof r === 'string'),
393-
'bad config: each repoId must be a string',
394-
);
395-
}
396-
397303
function locationConstraintAssert(locationConstraints) {
398304
const supportedBackends = [
399-
'mem', 'file', 'scality', 'mongodb', 'dmf', 'azure_archive', 'tlp',
305+
'mem', 'file', 'scality', 'mongodb', 'tlp',
400306
].concat(Object.keys(validExternalBackends));
401307
assert(typeof locationConstraints === 'object',
402308
'bad config: locationConstraints must be an object');
@@ -467,6 +373,15 @@ function locationConstraintAssert(locationConstraints) {
467373
assert(typeof details.credentials.secretKey === 'string',
468374
'bad config: credentials must include secretKey as string');
469375
}
376+
377+
if (locationConstraints[l].type === 'tlp') {
378+
// should have no detail
379+
assert(Object.keys(locationConstraints[l].details).length === 0);
380+
381+
// should be a cold location
382+
assert(locationConstraints[l].isCold === true);
383+
}
384+
470385
if (process.env.CI_CEPH === 'true') {
471386
// eslint-disable-next-line no-param-reassign
472387
locationConstraints[l].details.https = false;
@@ -505,15 +420,6 @@ function locationConstraintAssert(locationConstraints) {
505420
if (locationConstraints[l].type === 'gcp') {
506421
gcpLocationConstraintAssert(l, locationConstraints[l]);
507422
}
508-
if (locationConstraints[l].type === 'dmf') {
509-
dmfLocationConstraintAssert(locationConstraints[l]);
510-
}
511-
if (locationConstraints[l].type === 'azure_archive') {
512-
azureArchiveLocationConstraintAssert(locationConstraints[l]);
513-
}
514-
if (locationConstraints[l].type === 'tlp') {
515-
assert(Object.keys(locationConstraints[l].details).length === 0);
516-
}
517423
if (locationConstraints[l].type === 'pfs') {
518424
assert(typeof details.pfsDaemonEndpoint === 'object',
519425
'bad config: pfsDaemonEndpoint is mandatory and must be an object');
@@ -2009,6 +1915,5 @@ module.exports = {
20091915
bucketNotifAssert,
20101916
azureGetStorageAccountName,
20111917
azureGetLocationCredentials,
2012-
azureArchiveLocationConstraintAssert,
20131918
parseSupportedLifecycleRules,
20141919
};

locationConfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@
9696
"details": {}
9797
},
9898
"location-dmf-v1": {
99-
"type": "dmf",
99+
"type": "tlp",
100100
"objectId": "location-dmf-v1",
101101
"legacyAwsBehavior": false,
102102
"isCold": true,
103103
"details": {}
104104
},
105105
"location-azure-archive-v1": {
106-
"type": "azure_archive",
106+
"type": "tlp",
107107
"objectId": "location-azure-archive-v1",
108108
"legacyAwsBehavior": false,
109109
"isCold": true,

tests/locationConfig/locationConfigCeph.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
"isTransient": true
259259
},
260260
"location-dmf-v1": {
261-
"type": "dmf",
261+
"type": "tlp",
262262
"objectId": "location-dmf-v1",
263263
"legacyAwsBehavior": false,
264264
"isCold": true,

tests/locationConfig/locationConfigLegacy.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
"isTransient": true
181181
},
182182
"location-dmf-v1": {
183-
"type": "dmf",
183+
"type": "tlp",
184184
"objectId": "location-dmf-v1",
185185
"legacyAwsBehavior": false,
186186
"isCold": true,

tests/locationConfig/locationConfigTests.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,10 @@
269269
"isTransient": true
270270
},
271271
"location-dmf-v1": {
272-
"type": "dmf",
272+
"type": "tlp",
273273
"objectId": "location-dmf-v1",
274274
"legacyAwsBehavior": false,
275275
"isCold": true,
276-
"details": {
277-
"endpoint": "10.0.0.200:24000",
278-
"repoId": ["repo1"],
279-
"username": "username",
280-
"password": "password",
281-
"nsId": "nsId"
282-
}
276+
"details": {}
283277
}
284278
}

0 commit comments

Comments
 (0)