From af437b25d97455f673a3eedbaf09a327f45d3325 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Sat, 26 May 2007 16:04:11 +0000 Subject: [PATCH] Correctly detect failure to work out the current version of bongo available --- src/libs/python/bongo/msgapi.c | 8 +++++--- src/www/bongo/hawkeye/RootView.py | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libs/python/bongo/msgapi.c b/src/libs/python/bongo/msgapi.c index 63745cd..b2d053a 100644 --- a/src/libs/python/bongo/msgapi.c +++ b/src/libs/python/bongo/msgapi.c @@ -601,9 +601,11 @@ msgapi_GetAvailableVersion(PyObject *self, PyObject *args) { int version; - MsgGetAvailableVersion (&version); - - return Py_BuildValue("i", version); + if (MsgGetAvailableVersion (&version)) { + return Py_BuildValue("i", version); + } else { + return Py_BuildValue("i", 0); + } } extern PyObject *msgapi_GetConfigProperty(PyObject *, PyObject *); diff --git a/src/www/bongo/hawkeye/RootView.py b/src/www/bongo/hawkeye/RootView.py index a4f1710..049b1e6 100644 --- a/src/www/bongo/hawkeye/RootView.py +++ b/src/www/bongo/hawkeye/RootView.py @@ -61,9 +61,11 @@ class RootHandler(HawkeyeHandler): 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) + if sw_available == 0: + sw_available = "Unknown (no network, or DNS failure)" + self.SetVariable("sw_available", sw_available) # send the template return self.SendTemplate(req, rp, "index.tpl")