[luci] Avoid traceback in the case that no service status is available for the selected service/vm
by Ryan McCabe
commit 46ac4cad33846bd7265e028a879020ea3fe7a10a
Author: Ryan McCabe <rmccabe(a)redhat.com>
Date: Thu May 19 13:01:42 2011 -0400
Avoid traceback in the case that no service status is available for the selected service/vm
luci/templates/service.html | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/luci/templates/service.html b/luci/templates/service.html
index 118e381..9b9b62a 100644
--- a/luci/templates/service.html
+++ b/luci/templates/service.html
@@ -43,6 +43,8 @@
</tr>
</thead>
<tbody>
+ <!--! TODO: Avoid following nasty hack !-->
+ ${setattr(tmpl_context, 'current_service_status', '')}
<!--! List all the services. -->
<py:if test="cluster_data">
<tr py:for="(i, service_data) in enumerate(cluster_data.getServices())"
@@ -66,7 +68,9 @@
py:with="msg = _('Running on %s') % cluster_status.services[entity_name].nodename">
<span title="${msg}">${msg}</span>
<!--! TODO: Avoid following nasty hack !-->
- <py:if test="name == entity_name">${setattr(tmpl_context, 'current_service_status', msg)}</py:if>
+ <py:if test="name == entity_name">
+ ${setattr(tmpl_context, 'current_service_status', msg)}
+ </py:if>
</td>
</py:when>
<!--! 2) Service is not running. -->
@@ -83,7 +87,9 @@
py:with="msg = cluster_status.services[entity_name].failed == 'true' and _('Failed') or _('Disabled')">
<span title="${msg}">${msg}</span>
<!--! TODO: Avoid following nasty hack !-->
- <py:if test="name == entity_name">${setattr(tmpl_context, 'current_service_status', msg)}</py:if>
+ <py:if test="name == entity_name">
+ ${setattr(tmpl_context, 'current_service_status', msg)}
+ </py:if>
</td>
</py:when>
<py:otherwise>
13 years