Add new iocage API call to destroy jails.

This uses the `force` switch to bypass interaction.

REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "destroyjail",
   "jail" : "test"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "destroyjail",
      "jail" : "test"
   },
   "name" : "iocage",
   "id" : "fooid",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "destroyjail": {
      "success": {
        "Destroying": " 3030c554-d05e-11e5-8209-d05099728dbf"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Brandon Schneider
2016-02-10 19:56:43 -06:00
parent 4eaa321034
commit e2cede4fa0
3 changed files with 43 additions and 0 deletions

View File

@@ -471,6 +471,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIocageRequest(const QJsonVal
bool ok = false;
if(keys.contains("action")){
QString act = JsonValueToString(in_args.toObject().value("action"));
if(act=="destroyjail"){
ok = true;
out->insert("destroyjail", sysadm::Iocage::destroyJail(in_args.toObject()));
}
if(act=="createjail"){
ok = true;
out->insert("createjail", sysadm::Iocage::createJail(in_args.toObject()));