mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
API Change: Add a simple "pkg_autoremove" action for the sysadm/pkg subsystem (no additional inputs). This will queue up the pkg autoremove action which prunes all orphaned packages on the systems.
This commit is contained in:
@@ -797,6 +797,8 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmPkgRequest(const QJsonValue
|
||||
out->insert("pkg_upgrade", sysadm::PKG::pkg_upgrade());
|
||||
}else if(act=="pkg_audit"){
|
||||
out->insert("pkg_audit", sysadm::PKG::pkg_audit());
|
||||
}else if(act=="pkg_autoremove"){
|
||||
out->insert("pkg_autoremove", sysadm::PKG::pkg_autoremove());
|
||||
}else{
|
||||
//unknown action
|
||||
return RestOutputStruct::BADREQUEST;
|
||||
|
||||
@@ -440,3 +440,17 @@ QJsonObject PKG::pkg_audit(){
|
||||
obj.insert("proc_id",ID);
|
||||
return obj;
|
||||
}
|
||||
|
||||
QJsonObject PKG::pkg_autoremove(){
|
||||
//Generate the command to run
|
||||
QString cmd = "pkg autoremove -y";
|
||||
//Now kick off the dispatcher process (within the pkg queue - since only one pkg process can run at a time)
|
||||
QString ID = "sysadm_pkg_autoremove-"+QUuid::createUuid().toString(); //create a random tag for the process
|
||||
DISPATCHER->queueProcess(Dispatcher::PKG_QUEUE, ID, cmd);
|
||||
//Now return the info about the process
|
||||
QJsonObject obj;
|
||||
obj.insert("status", "pending");
|
||||
obj.insert("proc_cmd",cmd);
|
||||
obj.insert("proc_id",ID);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -36,9 +36,10 @@ public:
|
||||
static QJsonObject pkg_check_upgrade(); //Check for updates to pkgs
|
||||
static QJsonObject pkg_upgrade(); //upgrade all pkgs (use sysadm/updates if possible instead)
|
||||
static QJsonObject pkg_audit(); //List details of vulnerable packages
|
||||
static QJsonObject pkg_autoremove(); //Autoremove orphaned packages
|
||||
|
||||
};
|
||||
|
||||
} //end of sysadm namespace
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user