[API CHANGE] Add a new API call for sysadm/update: action="applyupdate".

This takes no other inputs, and returns the following:
{
"applyupdate" : {
  "result" : "rebooting to apply updates"
  }
}
This commit is contained in:
Ken Moore
2017-11-17 15:58:37 -05:00
parent 2157dbb6c2
commit c5bf944017
3 changed files with 11 additions and 0 deletions

View File

@@ -650,6 +650,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmUpdateRequest(const QJsonVal
ok = true;
out->insert("stopupdate", sysadm::Update::stopUpdate() );
}else if(act=="applyupdate"){
ok = true;
out->insert("applyupdate", sysadm::Update::applyUpdates() );
}else if(act=="listsettings"){
ok = true;
out->insert("listsettings", sysadm::Update::readSettings() );

View File

@@ -267,6 +267,12 @@ QJsonObject Update::stopUpdate() {
return ret;
}
QJsonObject Update::applyUpdates(){
QJsonObject ret;
QProcess::startDetached("pc-updatemanager startupdate");
ret.insert("result","rebooting to complete updates");
return ret;
}
//SETTINGS OPTIONS
QJsonObject Update::readSettings(){
QJsonObject ret;

View File

@@ -25,6 +25,7 @@ public:
//Start/stop update routine
static QJsonObject startUpdate(QJsonObject);
static QJsonObject stopUpdate();
static QJsonObject applyUpdates();
//Read/write update settings
static QJsonObject readSettings();
static QJsonObject writeSettings(QJsonObject);