Skip to contentSkip to conversation

conga/luci cluster/form-macros homebase/form-m ...

Cluster-devel [email protected] 1 participant 1 message May 18, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: EXPERIMENTAL
Changes by: rmccabe at sourceware.org 2007-05-18 02:37:00

Modified files:
luci/cluster : form-macros
luci/homebase : form-macros validate_cluster_add.js luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py
LuciSyslog.py LuciZopePerm.py RicciQueries.py StorageReport.py cluster_adapters.py homebase_adapters.py
luci/storage : form-chooser validate_html
luci/test : CGA_0200_Create_cluster.py
Added files:
luci/site/luci/Extensions: LuciZopeExternal.py

Log message:
More cleanup and refactor.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.198.2.1&r2=1.198.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.56&r2=1.56.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.8&r2=1.8.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.4&r2=1.1.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.7&r2=1.1.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciSyslog.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.11.4.2&r2=1.11.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopePerm.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.3&r2=1.1.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.23.2.3&r2=1.23.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.6&r2=1.255.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.50.2.4&r2=1.50.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-chooser.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.5&r2=1.5.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/validate_html.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.2&r2=1.2.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0200_Create_cluster.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.6&r2=1.6.2.1

luci/cluster/form-macros +3 -3
@@ -229,7 +229,7 @@
 					<div class="systemsTableTop">
 						<strong>Cluster Name</strong>
 						<input class="hbInputSys" type="text"
-							id="clusterName" name="clusterName"
+							id="clustername" name="clustername"
 							tal:attributes="value add_cluster/name | nothing" />
 					</div>
 				</td></tr>
@@ -3647,13 +3647,13 @@
 	<form name="add_node" action="" method="post"
 		tal:define="
 			global add_cluster request/SESSION/add_node | nothing;
-			global cur_cluster_name add_cluster/name | request/clustername | request/form/clusterName | nothing">
+			global cur_cluster_name add_cluster/name | request/clustername | request/form/clustername | nothing">
 
 		<h2>Add a node to <span tal:replace="cur_cluster_name | string:this cluster" /></h2>
 
 		<input type="hidden" name="addnode" value="1" />
 
-		<input type="hidden" name="clusterName"
+		<input type="hidden" name="clustername"
 			tal:attributes="value cur_cluster_name | string:[unknown]" />
 
 		<input name="pagetype" type="hidden"
luci/homebase/form-macros +1 -1
@@ -790,7 +790,7 @@
 						<strong class="cluster_name">Cluster Name:
 							<span tal:replace="add_cluster/name | string:[unknown]" />
 						</strong>
-						<input type="hidden" id="clusterName" name="clusterName"
+						<input type="hidden" id="clustername" name="clustername"
 							tal:attributes="value add_cluster/name | nothing" />
 					</div>
 				</td></tr>
luci/homebase/validate_cluster_add.js +11 -11
@@ -4,22 +4,22 @@
 	if (!form)
 		return (-1);
 
-	var clusterName = form.clusterName;
-	if (!clusterName || str_is_blank(clusterName.value)) {
+	var clustername = form.clustername;
+	if (!clustername || str_is_blank(clustername.value)) {
 		errors.push('No cluster name was given.');
-		set_form_err(form.clusterName);
+		set_form_err(form.clustername);
 	} else {
-		clusterName = clusterName.value;
-		if (clusterName.length > 15) {
+		clustername = clustername.value;
+		if (clustername.length > 15) {
 			errors.push('A cluster\'s name must be less than 16 characters long.');
-			set_form_err(form.clusterName);
+			set_form_err(form.clustername);
 		} else {
-			var invalid_chars = str_is_valid(clusterName, '/[0-9A-Za-z_. -]/g');
+			var invalid_chars = str_is_valid(clustername, '/[0-9A-Za-z_. -]/g');
 			if (invalid_chars) {
 				errors.push('The cluster name you gave contains the following invalid characters: "' + invalid_chars + '".');
-				set_form_err(form.clusterName);
+				set_form_err(form.clustername);
 			} else
-				clr_form_err(form.clusterName);
+				clr_form_err(form.clustername);
 		}
 	}
 
@@ -38,9 +38,9 @@
 	if (!view_certs || !view_certs.checked) {
 		var confirm_str = '';
 		if (form.addnode)
-			confirm_str = 'Add ' + (added_storage.length > 1 ? 'these nodes' : 'this node') + ' to the \"' + clusterName + '\" cluster?';
+			confirm_str = 'Add ' + (added_storage.length > 1 ? 'these nodes' : 'this node') + ' to the \"' + clustername + '\" cluster?';
 		else
-			confirm_str = 'Add the cluster \"' + clusterName + '\" to the Luci management interface?';
+			confirm_str = 'Add the cluster \"' + clustername + '\" to the Luci management interface?';
 
 		if (confirm(confirm_str))
 			form.submit();
luci/site/luci/Extensions/Attic/LuciClusterInfo.py +4 -4
@@ -222,7 +222,7 @@
 			raise KeyError, 'is blank'
 	except:
 		try:
-			cluname = req.form['clusterName']
+			cluname = req.form['clustername']
 			if not cluname:
 				raise KeyError, 'is blank'
 		except:
@@ -351,7 +351,7 @@
 			raise KeyError, 'is blank'
 	except KeyError, e:
 		try:
-			cluname = req.form['clusterName']
+			cluname = req.form['clustername']
 			if not cluname:
 				raise
 		except:
@@ -574,7 +574,7 @@
 			cluname = req.form['clustername']
 		except:
 			try:
-				cluname = req.form['clusterName']
+				cluname = req.form['clustername']
 			except:
 				if LUCI_DEBUG_MODE is True:
 					luci_log.debug_verbose('GCI0: unable to determine cluster name')
@@ -972,7 +972,7 @@
 			raise KeyError, 'clustername is blank'
 		except:
 			try:
-				clustername = req.form['clusterName']
+				clustername = req.form['clustername']
 			except:
 				try:
 					clustername = model.getClusterName()
luci/site/luci/Extensions/Attic/LuciDB.py +65 -65

340 lines not on this page · raw message

luci/site/luci/Extensions/LuciSyslog.py +1 -3
@@ -97,8 +97,6 @@
 		except:
 			pass
 
-luci_logc = None
 def get_logger():
-	if luci_logc is None or luci_logc.initialized() is False:
-		luci_logc = LuciSyslog()
+	luci_logc = LuciSyslog()
 	return luci_logc
luci/site/luci/Extensions/Attic/LuciZopePerm.py +0 -7
@@ -23,13 +23,6 @@
 		pass
 	return False
 
-def userIsAdmin(self, userId):
-	try:
-		return self.portal_membership.getMemberById(userId).has_role('Owner', self.restrictedTraverse(PLONE_ROOT))
-	except Exception, e:
-		pass
-	return False
-
 # In case we want to give access to non-admin users in the future
 
 def havePermCreateCluster(self):
luci/site/luci/Extensions/Attic/RicciQueries.py +23 -55

90 lines not on this page · raw message

luci/site/luci/Extensions/StorageReport.py +1 -23
@@ -245,11 +245,7 @@
         return 'Luci internal error. Please file bug report.'
     return 'should never come here'
 
-def get_storage_report(ricci_comm,
-                       session):
-    #print 'get_storage_report()'
-    #print ricci_comm, session
-
+def get_storage_report(ricci_comm, session):
     if ricci_comm is None:
         return None
 
@@ -262,19 +258,9 @@
     if session[SESSION_STORAGE_XML_REPORT].has_key(storagename):
         tmp_report = session[SESSION_STORAGE_XML_REPORT][storagename]
         if tmp_report is not None:
-            print 'using cached storage_xml_report'
             return StorageReport(tmp_report)
 
 
-    # retrieve storage report using ricci
-    print 'retrieving new storage_xml_report'
-
-    #print ricci_comm.authenticated()
-    #print ricci_comm.cluster_info()
-    print ricci_comm.hostname()
-    print ricci_comm.os()
-
-
     # request
     doc = minidom.Document()
     batch = doc.createElement('batch')
@@ -354,8 +340,6 @@
     return StorageReport(xml_report)
 
 
-
-
 def get_content_data(self, storage_report, mapper_id, bd_path, content_id):
     bd_data = get_bd_data(self, storage_report, mapper_id, bd_path)
     for cont in bd_data['contents']:
@@ -363,8 +347,6 @@
             return cont
     return None
 
-
-
 def get_bd_data(self, storage_report, mapper_id, path):
     if storage_report is None or mapper_id is None:
         return None
@@ -383,8 +365,6 @@
         return mapper['snapshot_template']
     return None
 
-
-
 def get_mappers_data(self, storage_report):
     ret_dir = {}
     # mappers
@@ -420,8 +400,6 @@
 
     return ret_dir
 
-
-
 def get_mapper_data(self, storage_report, mapper_id):
     if self is None or storage_report is None or mapper_id is None:
         return None
luci/site/luci/Extensions/cluster_adapters.py +41 -41

242 lines not on this page · raw message

luci/site/luci/Extensions/homebase_adapters.py +1 -1
@@ -496,7 +496,7 @@
 		pass
 
 	try:
-		cluster_name = request.form['clusterName'].strip()
+		cluster_name = request.form['clustername'].strip()
 	except:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('VAC0: no cluster name')
luci/storage/form-chooser +2 -2
@@ -7,9 +7,9 @@
   <metal:choose-form metal:define-macro="main-form">
     
     <span tal:omit-tag=""
-          tal:define="global preferred_size_units python:here.set_persistant_var('preferred_size_units', 'GB')"/>
+          tal:define="global preferred_size_units python:here.set_persistent_var('preferred_size_units', 'GB')"/>
     <span tal:omit-tag=""
-          tal:define="global preferred_path_display python:here.set_persistant_var('preferred_path_display', 'path')"/>
+          tal:define="global preferred_path_display python:here.set_persistent_var('preferred_path_display', 'path')"/>
     
 <!--
     <span tal:omit-tag="" tal:condition="python: storage_report == None and storagename != None">
luci/storage/validate_html +1 -1
@@ -13,7 +13,7 @@
       tal:define="global action_type request/action_type|nothing"/>
 
 <span tal:omit-tag=""
-      tal:define="global preferred_size_units python:here.set_persistant_var('preferred_size_units', 'GB')"/>
+      tal:define="global preferred_size_units python:here.set_persistent_var('preferred_size_units', 'GB')"/>
 
 
 <span tal:omit-tag=""
luci/test/CGA_0200_Create_cluster.py +1 -1
@@ -58,7 +58,7 @@
 
         # Create the new "testCluster" cluster
         sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
-        sel.type("clusterName", "testCluster")
+        sel.type("clustername", "testCluster")
         self.logger.debug('Create cluster: testCluster')
 
         # Add the nodes to the cluster