Allow admin tool to look for Bongo updates
This commit is contained in:
@@ -573,6 +573,39 @@ msgapi_NmapChallenge(PyObject *self, PyObject *args)
|
||||
return Py_BuildValue("s", buf);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(GetBuildVersion_doc,
|
||||
"GetBuildVersion() -> (integer, boolean)\n \
|
||||
\n\
|
||||
Returns a tuple containing version number and whether the build is custom.\n\
|
||||
");
|
||||
|
||||
static PyObject *
|
||||
msgapi_GetBuildVersion(PyObject *self, PyObject *args)
|
||||
{
|
||||
int version;
|
||||
BOOL custom;
|
||||
|
||||
MsgGetBuildVersion (&version, &custom);
|
||||
|
||||
return Py_BuildValue("ib", version, custom);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(GetAvailableVersion_doc,
|
||||
"GetBuildVersion() -> integer response\n \
|
||||
\n\
|
||||
Returns the version of the latest software on this branch.\n\
|
||||
");
|
||||
|
||||
static PyObject *
|
||||
msgapi_GetAvailableVersion(PyObject *self, PyObject *args)
|
||||
{
|
||||
int version;
|
||||
|
||||
MsgGetAvailableVersion (&version);
|
||||
|
||||
return Py_BuildValue("i", version);
|
||||
}
|
||||
|
||||
extern PyObject *msgapi_GetConfigProperty(PyObject *, PyObject *);
|
||||
|
||||
PyMethodDef MsgApiMethods[] = {
|
||||
@@ -593,6 +626,8 @@ PyMethodDef MsgApiMethods[] = {
|
||||
{"NmapChallenge", msgapi_NmapChallenge, METH_VARARGS | METH_STATIC, NmapChallenge_doc},
|
||||
{"GetConfigProperty", msgapi_GetConfigProperty, METH_VARARGS | METH_STATIC, GetConfigProperty_doc},
|
||||
{"GetUnprivilegedUser", msgapi_GetUnprivilegedUser, METH_VARARGS | METH_STATIC, GetUnprivilegedUser_doc},
|
||||
{"GetBuildVersion", msgapi_GetBuildVersion, METH_VARARGS | METH_STATIC, GetBuildVersion_doc},
|
||||
{"GetAvailableVersion", msgapi_GetAvailableVersion, METH_VARARGS | METH_STATIC, GetAvailableVersion_doc},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import bongo.dragonfly.BongoUtil
|
||||
from HawkeyeHandler import HawkeyeHandler
|
||||
import bongo.hawkeye.Auth as Auth
|
||||
from bongo.libs import msgapi
|
||||
|
||||
class RootHandler(HawkeyeHandler):
|
||||
def NeedsAuth(self, rp):
|
||||
@@ -39,6 +40,15 @@ class RootHandler(HawkeyeHandler):
|
||||
self.SetVariable("mem", str(round(used, 2)) + "MB / " + str(round(cm, 2)) + "MB")
|
||||
self.SetVariable("breadcrumb", "Desktop")
|
||||
self.SetVariable("dsktab", "selecteditem")
|
||||
(build_ver, build_custom) = msgapi.GetBuildVersion()
|
||||
sw_current = "Current revision: %d" % build_ver
|
||||
if build_custom:
|
||||
sw_current += " (custom build)"
|
||||
sw_available = msgapi.GetAvailableVersion()
|
||||
self.SetVariable("sw_current", sw_current)
|
||||
self.SetVariable("sw_available", sw_available)
|
||||
if (sw_available - build_ver) > 9:
|
||||
self.SetVariable("sw_upgrade", 1)
|
||||
return self.SendTemplate(req, rp, "index.tpl")
|
||||
|
||||
def test_GET(self, req, rp):
|
||||
|
||||
@@ -143,6 +143,9 @@ background-color: #2e3436;
|
||||
color: #eeeeec;
|
||||
padding-left: 4px;
|
||||
}
|
||||
.drow {
|
||||
border-bottom: 1px dotted #2e3436;
|
||||
}
|
||||
.tlist {
|
||||
padding-bottom: 3px;
|
||||
padding-top: 3px;
|
||||
|
||||
@@ -15,13 +15,17 @@
|
||||
</tr>
|
||||
<tr style="height: 28px;">
|
||||
<td class="hrow">Agent Status</td>
|
||||
<td style="text-align: center;">Operation normal.</td>
|
||||
<td class="drow" style="text-align: center;">Operation normal.</td>
|
||||
<td class="hrow" width="16"></td>
|
||||
</tr>
|
||||
<tr style="height: 28px;">
|
||||
<td class="hrow">Bongo Updates</td>
|
||||
<td style="text-align: center;">Critical security update available.</td>
|
||||
<td class="hrow" width="16"><img src="/img/dialog-warning.png" alt="Warning" /></td>
|
||||
<td class="drow" style="text-align: center;">
|
||||
<p>Running version: <span tal:content="sw_current">unknown</span> <br />
|
||||
Latest available: <span tal:content="sw_available">unknown</span></p>
|
||||
<p tal:condition="sw_upgrade">Upgrade to new version recommended.</p>
|
||||
</td>
|
||||
<td class="hrow" width="16"><img src="/img/dialog-warning.png" alt="Warning" tal:condition="sw_upgrade" /></td>
|
||||
</tr>
|
||||
<tr style="height: 28px;">
|
||||
<td class="hrow">Memory Usage</td>
|
||||
@@ -36,4 +40,4 @@
|
||||
</table>
|
||||
|
||||
|
||||
%(include|footer.tpl)s
|
||||
%(include|footer.tpl)s
|
||||
|
||||
Reference in New Issue
Block a user