Add new API call for listing available branches to update to

REST Request:
-------------------------------
PUT /sysadm/update
{
   "action" : "listbranches"
}

REST Response:
-------------------------------
{
    "args": {
        "listbranches": {
            "10.1-RELEASE": "available",
            "10.2-RELEASE": "active",
            "11.0-CURRENTJAN2016": "available"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "listbranches"
   },
   "namespace" : "sysadm",
   "name" : "update",
   "id" : "fooid"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "listbranches": {
      "10.1-RELEASE": "available",
      "10.2-RELEASE": "active",
      "11.0-CURRENTJAN2016": "available"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Kris Moore
2016-01-25 14:21:37 -05:00
parent 6eec1c9148
commit 98087f0faa
3 changed files with 80 additions and 46 deletions

View File

@@ -297,9 +297,11 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmUpdateRequest(const QJsonVal
QString act = JsonValueToString(in_args.toObject().value("action"));
if(act=="checkupdates"){
ok = true;
qDebug() << " - Starting update check";
out->insert("checkupdates", sysadm::Update::checkUpdates());
qDebug() << " - Finished update check";
}
if(act=="listbranches"){
ok = true;
out->insert("listbranches", sysadm::Update::listBranches());
}
} //end of "action" key usage