Author: justi9
Date: 2007-10-15 16:57:52 -0400 (Mon, 15 Oct 2007)
New Revision: 1077
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Adds server profiles to the demo model.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-15 20:57:02 UTC (rev 1076)
+++ mgmt/cumin/python/cumin/model.py 2007-10-15 20:57:52 UTC (rev 1077)
@@ -7,6 +7,7 @@
self.cluster = ModelClass(self, "cluster")
self.server = ModelClass(self, "server")
+ self.server_profile = ModelClass(self, "server_profile")
self.config_property = ModelClass(self, "config_property")
self.server_group = ModelClass(self, "server_group")
self.server_group_type = ModelClass(self, "server_group_type")
@@ -21,6 +22,14 @@
assoc.add_endpoint(self.server, "cluster", "0..1")
assoc.add_endpoint(self.cluster, "server", "0..n")
+ assoc = ModelAssociation(self, "server_profile_to_servers")
+ assoc.add_endpoint(self.server, "server_profile", "0..1")
+ assoc.add_endpoint(self.server_profile, "server", "0..n")
+
+ assoc = ModelAssociation(self, "server_profile_to_config_properties")
+ assoc.add_endpoint(self.config_property, "server_profile",
"0..1")
+ assoc.add_endpoint(self.server_profile, "config_property",
"0..n")
+
assoc = ModelAssociation(self, "cluster_to_virtual_hosts")
assoc.add_endpoint(self.virtual_host, "cluster", "0..1")
assoc.add_endpoint(self.cluster, "virtual_host", "0..n")
@@ -94,6 +103,12 @@
def get_servers(self):
return self.get_index(self.server).values()
+ def get_server_profile(self, id):
+ return self.get_index(self.server_profile).get(id)
+
+ def get_server_profiles(self):
+ return self.get_index(self.server_profile).values()
+
def get_server_group(self, id):
return self.get_index(self.server_group).get(id)
@@ -158,6 +173,12 @@
writer.write("</server>")
+class ServerProfile(ModelObject):
+ def __init__(self, model):
+ super(ServerProfile, self).__init__(model, model.server_profile)
+
+ self.name = None
+
class ConfigProperty(ModelObject):
def __init__(self, model):
super(ConfigProperty, self).__init__(model, model.config_property)