Author: justi9
Date: 2007-10-16 14:49:44 -0400 (Tue, 16 Oct 2007)
New Revision: 1094
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Adds a status field to the server listing in server profiles.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 17:50:35 UTC (rev 1093)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 18:49:44 UTC (rev 1094)
@@ -114,6 +114,7 @@
self.add_parameter(self.param)
self.source = Parameter(app, "source")
+ self.source.set_default("local")
self.add_parameter(self.source)
self.profile = RadioInput(app, "profile", self)
@@ -196,10 +197,14 @@
self.add_child(self.tabs)
self.tabs.add_tab(self.ServerVirtualHostTab(app, "vhosts"))
- self.tabs.add_tab(self.ServerConfigTab(app, "config"))
+ self.config = self.ServerConfigTab(app, "config")
+ self.tabs.add_tab(self.config)
self.tabs.add_tab(self.ServerStatsTab(app, "stats"))
self.tabs.add_tab(self.ServerLogTab(app, "log"))
+ def show_config(self, session):
+ return self.tabs.show_mode(session, self.config)
+
def render_title(self, session, server):
return "Server '%s'" % server.name
@@ -245,9 +250,7 @@
return sorted_by(server.config_property_items())
def maybe_highlight(self, value, comparedto):
- print type(value), type(comparedto)
-
- if value != comparedto:
+ if str(value) != str(comparedto):
value = "<span class=\"ServerConfigTab
diff\">%s</span>" \
% value
@@ -491,3 +494,22 @@
def get_items(self, session, profile):
return sorted_by(profile.server_items())
+
+ def render_item_config_href(self, session, server):
+ branch = session.branch()
+ frame = self.page().show_server(branch, server)
+ frame.show_view(branch).show_config(branch)
+ return branch.marshal()
+
+ def render_item_config_status(self, session, server):
+ diffs = 0
+
+ for prop in server.get_server_profile().config_property_items():
+ for iprop in server.config_property_items():
+ if iprop.name == prop.name:
+ if iprop.value != prop.value:
+ diffs += 1
+
+ return "%i difference(s)" % diffs
+
+
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-16 17:50:35 UTC (rev 1093)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-16 18:49:44 UTC (rev 1094)
@@ -252,3 +252,24 @@
<td>{item_value}</td>
<td><a class="action"
href="">Edit</a></td>
</tr>
+
+[ProfileServerTab.html]
+<ul class="actions">
+ <li><a href="">Apply Profile Configuration to
Servers</a></li>
+</ul>
+
+<table class="mobjects">
+ <tr>
+ <th>Server</th>
+ <th>Configuration Status</th>
+ <th></th>
+ </tr>
+
+ {items}
+</table>
+
+[ProfileServerTab.item_html]
+<tr>
+ <td>{item_link}</td>
+ <td><a
href="{item_config_href}">{item_config_status}</a></td>
+</tr>