From 033bea2e7b63dc29b4b153459f11ff88f32b94b7 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 28 Mar 2016 11:59:42 -0400 Subject: [PATCH] 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" } --- src/server/WebBackend.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/WebBackend.cpp b/src/server/WebBackend.cpp index 57943af..753cf50 100644 --- a/src/server/WebBackend.cpp +++ b/src/server/WebBackend.cpp @@ -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));