Add a new API call: sysadm/pkg, "action"="pkg_remove".

This will remove the given packages from the system.
Required arguments:
"pkg_origins" = (single origin string or array of origin strings).
Optional arguments:
"recursive" = "true" or "false" (default: "true"). If true, other packages which depend on this package will also be removed (no broken dependencies).
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "recursive" : "false",
   "action" : "pkg_remove",
   "pkg_origins" : "games/angband"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "name" : "pkg",
   "namespace" : "sysadm",
   "args" : {
      "action" : "pkg_remove",
      "recursive" : "false",
      "pkg_origins" : "games/angband"
   }
}

Response:
-------------------------------
{
  "args": {
    "pkg_remove": {
      "proc_cmd": "pkg delete -y games/angband",
      "proc_id": "sysadm_pkg_remove-{2aa844aa-f6a8-4e8f-ae71-b56af735ccb8}",
      "status": "pending"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Ken Moore
2016-03-28 11:59:42 -04:00
parent 9a0ac8e403
commit 033bea2e7b

View File

@@ -751,12 +751,12 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmPkgRequest(const QJsonValue
//REQUIRED: "pkg_origins"
//OPTIONAL: "repo" (pkg will determine the best repo to use if not supplied)
out->insert("pkg_install", sysadm::PKG::pkg_install(pkgs,repo));
/*}else if(act=="pkg_remove" && !pkgs.isEmpty() ){
}else if(act=="pkg_remove" && !pkgs.isEmpty() ){
//REQUIRED: "pkg_origins"
//OPTIONAL: "recursive"="true" or "false" (default: "true")
bool recursive = true;
if(in_args.toObject().contains("recursive")){ recursive = in_args.toObject().value("recursive").toString()=="false"; }
out->insert("pkg_remove", sysadm::PKG::pkg_remove(pkgs, recursive));*/
if(in_args.toObject().contains("recursive")){ recursive = in_args.toObject().value("recursive").toString()!="false"; }
out->insert("pkg_remove", sysadm::PKG::pkg_remove(pkgs, recursive));
}else if(act=="pkg_lock" && !pkgs.isEmpty() ){
//REQUIRED: "pkg_origins"
out->insert("pkg_lock", sysadm::PKG::pkg_lock(pkgs));