mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 18:20:23 +00:00
Add a "updaterunning" status to the sysadm/update check for updates, and also setup sysadm/update to emit dispatcher events about the update process.
This commit is contained in:
@@ -29,6 +29,7 @@ QJsonObject Dispatcher::CreateDispatcherEventNotification(QString ID, QJsonObjec
|
||||
|
||||
//Now parse the notification based on the dispatch ID or current command
|
||||
//NOTE: There might be a random string on the end of the ID (to accomodate similar process calls)
|
||||
// == sysadm/iohyve ==
|
||||
if(ID.startsWith("sysadm_iohyve")){
|
||||
namesp = "sysadm"; name="iohyve";
|
||||
//Now perform additional cmd/system based filtering
|
||||
@@ -36,7 +37,12 @@ QJsonObject Dispatcher::CreateDispatcherEventNotification(QString ID, QJsonObjec
|
||||
//Do some parsing of the log
|
||||
parseIohyveFetchOutput(cLog,&args);
|
||||
}
|
||||
|
||||
|
||||
// == sysadm/update ==
|
||||
}else if(ID.startsWith("sysadm_update")){
|
||||
namesp = "sysadm"; name="update";
|
||||
//No special parsing here: the pc-updatemanager output should be available as-is
|
||||
args.insert("update_log",cLog);
|
||||
}
|
||||
|
||||
//Now assemble the output as needed
|
||||
|
||||
@@ -21,7 +21,13 @@ QJsonObject Update::checkUpdates() {
|
||||
retObject.insert("status","rebootrequired");
|
||||
return retObject;
|
||||
}
|
||||
|
||||
if(QFile::exists("/tmp/.updateInProgress")){
|
||||
//See if the process is actually running
|
||||
if( 0==General::RunCommand("pgrep -F /tmp/.updateInProgress") ){
|
||||
retObject.insert("status","updaterunning");
|
||||
return retObject;
|
||||
}
|
||||
}
|
||||
QStringList output = General::RunCommand("pc-updatemanager check").split("\n");
|
||||
QString nameval;
|
||||
int pnum=1;
|
||||
@@ -148,7 +154,7 @@ QJsonObject Update::startUpdate(QJsonObject jsin) {
|
||||
QString ID = QUuid::createUuid().toString();
|
||||
|
||||
// Queue the update action
|
||||
DISPATCHER->queueProcess(ID, "pc-updatemanager " + flags);
|
||||
DISPATCHER->queueProcess("sysadm_update_runupdates::"+ID, "pc-updatemanager " + flags);
|
||||
|
||||
// Return some details to user that the action was queued
|
||||
retObject.insert("command", "pc-updatemanger " + flags);
|
||||
|
||||
Reference in New Issue
Block a user