From 2047491544b5272d20ea1694eef7e4804cfc8286 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 17 Feb 2017 11:49:14 -0500 Subject: [PATCH] API CHANGE: Re-enable the sysadm/iocage "activatepool" API call: Description: This will activate a specific ZFS pool so iocage can use it. Required arguments: "pool" = "name of ZFS pool to activate" ------------------ REST Request (example): ------------------------------- PUT /sysadm/iocage { "action" : "activatepool", "pool" : "tank1" } WebSocket Request: ------------------------------- { "name" : "iocage", "args" : { "pool" : "tank1", "action" : "activatepool" }, "id" : "fooid", "namespace" : "sysadm" } Response: ------------------------------- { "args": { "activatepool": { "success": "pool tank1 activated." } }, "id": "fooid", "name": "response", "namespace": "sysadm" } --- src/server/WebBackend.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/WebBackend.cpp b/src/server/WebBackend.cpp index 53cc975..49dd4d6 100644 --- a/src/server/WebBackend.cpp +++ b/src/server/WebBackend.cpp @@ -647,6 +647,9 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIocageRequest(const QJsonVal bool ok = false; if(keys.contains("action")){ QString act = JsonValueToString(in_args.toObject().value("action")); + QJsonObject retObj; + if(act=="activatepool"){ retObj = sysadm::Iocage::activatePool(in_args.toObject()); } + /*if(act=="execjail"){ ok = true; out->insert("execjail", sysadm::Iocage::execJail(in_args.toObject())); @@ -691,10 +694,6 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIocageRequest(const QJsonVal ok = true; out->insert("deactivatepool", sysadm::Iocage::deactivatePool(in_args.toObject())); } - else if(act=="activatepool"){ - ok = true; - out->insert("activatepool", sysadm::Iocage::activatePool(in_args.toObject())); - } else if(act=="stopjail"){ ok = true; out->insert("stopjail", sysadm::Iocage::stopJail(in_args.toObject())); @@ -719,11 +718,12 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIocageRequest(const QJsonVal ok = true; out->insert("listjails", sysadm::Iocage::listReleases()); }*/ - + ok = !retObj.keys().isEmpty(); + if(ok){ out->insert(act,retObj); } } //end of "action" key usage //If nothing done - return the proper code - if(!ok){ + if(!ok ){ return RestOutputStruct::BADREQUEST; } }else{ // if(in_args.isArray()){