Compare commits

...

2 Commits

Author SHA1 Message Date
Benoit A f7e3888e28 move version to v2 2019-04-24 14:04:46 +02:00
Maxime Lubin f6789bce65 WIP Add hdclient dependency to package.json
Note: version is not fixed yet!
Signed-off-by: Maxime Lubin <maxime.lubin@scality.com>
Signed-off-by: Benoit A <benoit@scality.com>
2019-04-04 14:00:12 +02:00
5 changed files with 44 additions and 1 deletions

View File

@ -12,6 +12,8 @@ const { buildAuthDataAccount } = require('./auth/in_memory/builder');
const validExternalBackends = require('../constants').externalBackends;
const { azureAccountNameRegex, base64Regex } = require('../constants');
const hdclient = require('hdclient');
// whitelist IP, CIDR for health checks
const defaultHealthChecks = { allowFrom: ['127.0.0.1/8', '::1'] };
@ -164,6 +166,25 @@ function azureLocationConstraintAssert(location, locationObj) {
'azureContainerName is an invalid container name');
}
function hdClientLocationConstraintAssert(configSproxyd) {
const sproxydFields = [];
if (configSproxyd.bootstrap !== undefined) {
assert(Array.isArray(configSproxyd.bootstrap)
&& configSproxyd.bootstrap
.every(e => typeof e === 'string'),
'bad config: sproxyd.bootstrap must be an array of strings');
assert(configSproxyd.bootstrap.length > 0,
'bad config: sproxyd bootstrap list is empty');
sproxydFields.push('bootstrap');
}
if (configSproxyd.path !== undefined) {
assert(typeof configSproxyd.path === 'string',
'bad config: sproxyd.path must be a string');
sproxydFields.push('path');
}
return sproxydFields;
}
function locationConstraintAssert(locationConstraints) {
const supportedBackends =
['mem', 'file', 'scality',
@ -279,6 +300,10 @@ function locationConstraintAssert(locationConstraints) {
assert(typeof details.pfsDaemonEndpoint === 'object',
'bad config: pfsDaemonEndpoint is mandatory and must be an object');
}
if (locationConstraints[l].type === 'scality' &&
locationConstraints[l].details.connector.hdclient !== undefined) {
hdClientLocationConstraintAssert(locationConstraints[l].details.connector.hdclient);
}
});
assert(Object.keys(locationConstraints)
.includes('us-east-1'), 'bad locationConfig: must ' +

View File

@ -14,6 +14,8 @@ const { decryptSecret } = arsenal.pensieve.credentialUtils;
const { reshapeExceptionError } = arsenal.errorUtils;
const { replicationBackends } = require('arsenal').constants;
const hdclient = require('hdclient');
function overlayHasVersion(overlay) {
return overlay && overlay.version !== undefined;
}
@ -197,6 +199,19 @@ function patchConfiguration(newConf, log, cb) {
};
}
break;
case 'location-scality-hdclient-v2':
location.type = 'scality';
if (l.details && l.details.bootstrapList) {
location.details = {
supportsVersioning: true,
connector: {
hdclient: {
bootstrap: l.details.bootstrapList,
},
},
};
}
break;
default:
log.info('unknown location type', { locationType:
l.locationType });

View File

@ -39,6 +39,7 @@ function getCapabilities() {
locationTypeSproxyd: true,
locationTypeNFS: true,
locationTypeCephRadosGW: true,
locationTypeHyperdrive: true,
preferredReadLocation: true,
managedLifecycle: true,
managedLifecycleTransition: true,

View File

@ -19,7 +19,7 @@
},
"homepage": "https://github.com/scality/S3#readme",
"dependencies": {
"arsenal": "github:scality/arsenal#dffcbef",
"arsenal": "github:scality/arsenal#9f77d8eb",
"async": "~2.5.0",
"aws-sdk": "2.28.0",
"azure-storage": "^2.1.0",
@ -28,6 +28,7 @@
"commander": "^2.9.0",
"diskusage": "0.2.4",
"google-auto-auth": "^0.9.1",
"hdclient": "scality/hdclient#5145e04e5ed33e85106765b1caa90cd245ef482b",
"http-proxy": "^1.17.0",
"https-proxy-agent": "^2.2.0",
"mongodb": "^2.2.31",

View File

@ -10,6 +10,7 @@ describe('report handler', () => {
assert.strictEqual(c.locationTypeDigitalOcean, true);
assert.strictEqual(c.locationTypeS3Custom, true);
assert.strictEqual(c.locationTypeSproxyd, true);
assert.strictEqual(c.locationTypeHyperdrive, true);
assert.strictEqual(c.preferredReadLocation, true);
assert.strictEqual(c.managedLifecycle, true);
assert.strictEqual(c.secureChannelOptimizedPath, true);