1
0
Fork 0

Make /Target/CleanedServers writable.

This commit is contained in:
Max Neunhoeffer 2016-06-13 11:43:12 +02:00
parent 8dd9ce47a0
commit b348514d36
1 changed files with 16 additions and 4 deletions

View File

@ -1002,10 +1002,11 @@ actions.defineHttp({
/// ///
/// @ RESTDESCRIPTION sets the number of coordinators and DBServers desired, /// @ RESTDESCRIPTION sets the number of coordinators and DBServers desired,
/// which are stored in `/Target` in the agency. A body of the form /// which are stored in `/Target` in the agency. A body of the form
/// { "numberOfCoordinators": 12, "numberOfDBServers": 12 } /// { "numberOfCoordinators": 12, "numberOfDBServers": 12,
/// "cleanedServers": [] }
/// must be supplied. Either one of the values can be left out and will /// must be supplied. Either one of the values can be left out and will
/// then not be changed. Either value can be `null` to indicate that the /// then not be changed. Either numeric value can be `null` to indicate
/// cluster cannot be scaled. /// that the cluster cannot be scaled.
/// ///
/// @ RESTRETURNCODES /// @ RESTRETURNCODES
/// ///
@ -1063,7 +1064,7 @@ actions.defineHttp({
{numberOfCoordinators: nrCoordinators, {numberOfCoordinators: nrCoordinators,
numberOfDBServers: nrDBServers, numberOfDBServers: nrDBServers,
cleanedServers}); cleanedServers});
} else { } else { // PUT
var body = actions.getJsonBody(req, res); var body = actions.getJsonBody(req, res);
if (body === undefined) { if (body === undefined) {
return; return;
@ -1096,6 +1097,17 @@ actions.defineHttp({
catch (e2) { catch (e2) {
ok = false; ok = false;
} }
try {
if (body.hasOwnProperty("cleanedServers") &&
typeof body.cleanedServers === "object" &&
Array.isArray(body.cleanedServers)) {
ArangoAgency.set("Target/CleanedServers",
body.cleanedServers);
}
}
catch (e3) {
ok = false;
}
if (!ok) { if (!ok) {
actions.resultError(req, res, actions.HTTP_SERVICE_UNAVAILABLE, actions.resultError(req, res, actions.HTTP_SERVICE_UNAVAILABLE,
"Cannot write to agency."); "Cannot write to agency.");