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 validExternalBackends = require('../constants').externalBackends;
const { azureAccountNameRegex, base64Regex } = require('../constants'); const { azureAccountNameRegex, base64Regex } = require('../constants');
const hdclient = require('hdclient');
// whitelist IP, CIDR for health checks // whitelist IP, CIDR for health checks
const defaultHealthChecks = { allowFrom: ['127.0.0.1/8', '::1'] }; const defaultHealthChecks = { allowFrom: ['127.0.0.1/8', '::1'] };
@ -164,6 +166,25 @@ function azureLocationConstraintAssert(location, locationObj) {
'azureContainerName is an invalid container name'); '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) { function locationConstraintAssert(locationConstraints) {
const supportedBackends = const supportedBackends =
['mem', 'file', 'scality', ['mem', 'file', 'scality',
@ -279,6 +300,10 @@ function locationConstraintAssert(locationConstraints) {
assert(typeof details.pfsDaemonEndpoint === 'object', assert(typeof details.pfsDaemonEndpoint === 'object',
'bad config: pfsDaemonEndpoint is mandatory and must be an 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) assert(Object.keys(locationConstraints)
.includes('us-east-1'), 'bad locationConfig: must ' + .includes('us-east-1'), 'bad locationConfig: must ' +

View File

@ -14,6 +14,8 @@ const { decryptSecret } = arsenal.pensieve.credentialUtils;
const { reshapeExceptionError } = arsenal.errorUtils; const { reshapeExceptionError } = arsenal.errorUtils;
const { replicationBackends } = require('arsenal').constants; const { replicationBackends } = require('arsenal').constants;
const hdclient = require('hdclient');
function overlayHasVersion(overlay) { function overlayHasVersion(overlay) {
return overlay && overlay.version !== undefined; return overlay && overlay.version !== undefined;
} }
@ -197,6 +199,19 @@ function patchConfiguration(newConf, log, cb) {
}; };
} }
break; 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: default:
log.info('unknown location type', { locationType: log.info('unknown location type', { locationType:
l.locationType }); l.locationType });

View File

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

View File

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

View File

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