Add a new API call: sysadm/pkg, "action"="pkg_update".

This will have pkg update it's databases if necessary (not typically used).
Optional argument: "force" = "true" or "false" (default: "false"). If true, this will force pkg to completely re-sync all databases with all known repos (may take some time).
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "force" : "true",
   "action" : "pkg_update"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "name" : "pkg",
   "namespace" : "sysadm",
   "args" : {
      "force" : "true",
      "action" : "pkg_update"
   }
}

Response:
-------------------------------
{
  "args": {
    "pkg_update": {
      "proc_cmd": "pkg update -f",
      "proc_id": "sysadm_pkg_update-{8d65bbc5-fefc-4f34-8743-167e61a54c4c}",
      "status": "pending"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Ken Moore
2016-03-28 11:08:44 -04:00
parent 8680d309a5
commit cbd250edda

View File

@@ -752,7 +752,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmPkgRequest(const QJsonValue
}else if(act=="pkg_unlock"){
}else if(act=="pkg_update"){
//OPTIONAL: "force" = ["true"/"false"] (default: "false")
bool force = false;
if(in_args.toObject().contains("force")){ force = in_args.toObject().value("force").toString()=="true"; }
out->insert("pkg_update", sysadm::PKG::pkg_update(force));
}else if(act=="pkg_check_upgrade"){
out->insert("pkg_check_upgrade", sysadm::PKG::pkg_check_upgrade());
}else if(act=="pkg_upgrade"){