Compare commits

...

4 Commits

Author SHA1 Message Date
Bennett Buchanan a3bfe1cd4c update legacy location file 2018-04-06 11:11:22 -07:00
Bennett Buchanan 0bb1bd6e97 change objectReplicationMD.js 2018-04-06 11:09:36 -07:00
Bennett Buchanan c137f57e3e change getReplicationInfo.js 2018-04-06 10:28:15 -07:00
Bennett Buchanan a6c0da3e36 Test commit 2018-04-06 10:16:07 -07:00
4 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,5 @@
const s3config = require('../../../Config').config; const s3config = require('../../../Config').config;
const constants = require('../../../../constants');
function _getBackend(objectMD, site) { function _getBackend(objectMD, site) {
const backends = objectMD ? objectMD.replicationInfo.backends : []; const backends = objectMD ? objectMD.replicationInfo.backends : [];
@ -35,7 +36,7 @@ function _getReplicationInfo(rule, replicationConfig, content, operationType,
const storageClasses = _getStorageClasses(rule); const storageClasses = _getStorageClasses(rule);
storageClasses.forEach(storageClass => { storageClasses.forEach(storageClass => {
const location = s3config.locationConstraints[storageClass]; const location = s3config.locationConstraints[storageClass];
if (location && ['aws_s3', 'azure'].includes(location.type)) { if (location && constants.replicationBackends[location.type]) {
storageTypes.push(location.type); storageTypes.push(location.type);
} }
backends.push(_getBackend(objectMD, storageClass)); backends.push(_getBackend(objectMD, storageClass));

View File

@ -103,5 +103,16 @@
"bucketMatch": false, "bucketMatch": false,
"azureContainerName": "s3test" "azureContainerName": "s3test"
} }
},
"gcpbackend": {
"type": "gcp",
"legacyAwsBehavior": true,
"details": {
"gcpEndpoint": "storage.googleapis.com",
"bucketName": "zenko-gcp-bucket",
"mpuBucketName": "zenko-gcp-mpu",
"bucketMatch": true,
"credentialsProfile": "google"
}
} }
} }

View File

@ -68,6 +68,7 @@ describe('getObjMetadataAndDelete function for multiObjectDelete', () => {
}); });
}); });
it('should successfully get object metadata and then ' + it('should successfully get object metadata and then ' +
'delete metadata and data', done => { 'delete metadata and data', done => {
getObjMetadataAndDelete(authInfo, 'foo', request, bucketName, bucket, getObjMetadataAndDelete(authInfo, 'foo', request, bucketName, bucket,

View File

@ -474,10 +474,12 @@ describe('Replication object MD without bucket replication config', () => {
['awsbackend', ['awsbackend',
'azurebackend', 'azurebackend',
'gcpbackend',
'awsbackend,azurebackend'].forEach(backend => { 'awsbackend,azurebackend'].forEach(backend => {
const storageTypeMap = { const storageTypeMap = {
'awsbackend': 'aws_s3', 'awsbackend': 'aws_s3',
'azurebackend': 'azure', 'azurebackend': 'azure',
'gcpbackend': 'gcp',
'awsbackend,azurebackend': 'aws_s3,azure', 'awsbackend,azurebackend': 'aws_s3,azure',
}; };
const storageType = storageTypeMap[backend]; const storageType = storageTypeMap[backend];