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:
Ken Moore
2016-03-21 13:08:13 -04:00
parent 638f0eb390
commit cf8cf0d429
2 changed files with 15 additions and 3 deletions

View File

@@ -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

View File

@@ -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);