Skip to contentSkip to conversation

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

Cluster-devel [email protected] 1 participant 1 message Jan 23, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2008-01-23 04:34:24

Modified files:
luci/cluster : form-macros
luci/homebase : validate_cluster_add_initial.js luci/plone-custom: clusterportlet.css luci/site/luci/Extensions: LuciClusterActions.py
LuciValidation.py ResourceHandler.py RicciQueries.py cluster_adapters.py homebase_adapters.py
luci/site/luci/var: Data.fs
Added files:
luci/plone-custom: clusterbanner.png

Log message:
sync some odds and ends

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.219&r2=1.220
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add_initial.js.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/clusterbanner.png.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/clusterportlet.css.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterActions.py.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ResourceHandler.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.279&r2=1.280
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&r1=1.27&r2=1.28

luci/cluster/form-macros +18 -16
@@ -1071,13 +1071,12 @@
 		set_page_title('Luci ??? cluster ??? Add a new cluster node');
 	</script>
 
-	<script type="text/javascript"
-		src="/luci/homebase/homebase_common.js">
+	<script type="text/javascript" src="/luci/homebase/homebase_common.js">
 	</script>
-
-	<script type="text/javascript"
-		src="/luci/homebase/validate_cluster_add.js">
+	<script type="text/javascript" src="/luci/homebase/validate_cluster_add.js">
 	</script>
+	<script type="text/javascript" src="conga_ajax.js"></script>
+	<script type="text/javascript" src="update_hostinfo.js"></script>
 
 	<form name="add_node" action="" method="post"
 		tal:define="
@@ -1194,17 +1193,10 @@
 									name python: '__SYSTEM%d:Passwd' % cur_sysnum" />
 						</tal:block>
 					</td>
-					<td tal:condition="add_cluster" class="systemsTable">
-						<img
-							tal:attributes="
-								src python: 'trusted' in sys and 'lock-ok.png' or ('fp' in sys and 'lock-closed.png' or 'lock-open.png');
-								title sys/fp | string:no key fingerprint available" />
-						<input type="hidden"
-							tal:condition="exists: sys/fp"
-							tal:attributes="
-								id python: '__SYSTEM%dFingerprint' % cur_sysnum;
-								name python: '__SYSTEM%dFingerprint' % cur_sysnum;
-								value sys/fp | nothing" />
+					<td class="systemsTable">
+						<img tal:attributes="
+							src python: sys and sys.has_key('trusted') and 'lock-ok.png' or (sys and sys.has_key('fp') and 'lock-closed.png' or 'lock-open.png');
+							title sys/fp | string:no key fingerprint available" />
 					</td>
 					<td tal:condition="add_cluster" class="systemsTable">
 						<input type="checkbox" tal:attributes="
@@ -1239,6 +1231,10 @@
 							id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" />
 					</td>
 					<td class="systemsTable">
+						<img src="lock-open.png" id="__SYSTEM0Fingerprint"
+							title="no key fingerprint available" />
+					</td>
+					<td class="systemsTable">
 						<img src="delete-row.png" class="deleteRow"
 							title="delete this row"
 							onclick="delete_element_id('__SYSTEM_ROW_0')" />
@@ -1251,6 +1247,12 @@
 		<input name="numStorage" id="numStorage" type="hidden"
 			tal:attributes="value cur_sysnum" />
 
+		<div class="hbSubmit">
+			<input type="button" name="View SSL cert fingerprints"
+				value="View SSL cert fingerprints"
+				onclick="get_system_info('retmsgsdiv', 'errmsgsdiv', 1)" />
+		</div>
+
 		<div class="hbSubmit" id="hbSubmit">
 			<input type="button" name="Submit" value="Submit"
 				onClick="validateForm(this.form)" />
luci/homebase/validate_cluster_add_initial.js +0 -4
@@ -92,14 +92,12 @@
 	if (ret_status !== true) {
 		/* A communication error occurred. */
 		alert(obj);
-		form_elem.submit();
 		return;
 	}
 
 	var err = get_ricci_response_status(obj.responseXML);
 	if (err !== null && err.length > 0) {
 		alert(err.join('\n'));
-		form_elem.submit();
 		return;
 	}
 
@@ -107,7 +105,6 @@
 		obj = obj.responseXML.getElementsByTagName('dict')[0];
 	} catch (e) {
 		alert('Received a malformed response from the luci server.');
-		form_elem.submit();
 		return;
 	}
 
@@ -115,7 +112,6 @@
 	var query_host_elem = document.getElementById('__SYSTEM0:Addr');
 	if (!query_host_elem || str_is_blank(query_host_elem.value)) {
 		alert('No node was entered.');
-		form_elem.submit();
 		return;
 	}
 	query_host = query_host_elem.value;

/cvs/cluster/conga/luci/plone-custom/clusterbanner.png,v --> standard output revision 1.1
Binary files /cvs/cluster/conga/luci/plone-custom/clusterbanner.png and - differ
co: output error: Broken pipe
co aborted

luci/plone-custom/clusterportlet.css +1 -1
@@ -173,7 +173,7 @@
 .cluConfigTreeLevel5 { margin-left: 0.75em; }
 
 #main-portal-logo {
-    background: url(./clusterbanner.png) no-repeat;
+    background: url(clusterbanner.png) no-repeat;
     border: 0;
     margin: 0.75em 0em 0.75em 1.5em;
     padding: 0;
luci/site/luci/Extensions/LuciClusterActions.py +13 -42

73 lines not on this page · raw message

luci/site/luci/Extensions/LuciValidation.py +2 -1
@@ -473,10 +473,11 @@
 			luci_log.debug_verbose('VRA0: type is blank')
 		return (False, { 'errors': [ 'No resource type was given']})
 
+	res = None
 	try:
 		res = create_resource(res_type, request.form, model)
 	except Exception, e:
-		return (False, { 'errors': e } )
+		return (False, { 'errors': e[0] } )
 
 	resname = ''
 	try:
luci/site/luci/Extensions/ResourceHandler.py +13 -6
@@ -756,6 +756,7 @@
 }
 
 def create_resource(res_type, form, model):
+	errors = list()
 	if not resource_table.has_key(res_type):
 		raise Exception, [ 'Unknown resource type: "%s"' % res_type ]
 
@@ -785,14 +786,20 @@
 	else:
 		rname = form['ip_address'].strip()
 
+	if not form.has_key('edit'):
+		try:
+			dummy = getResourceForEdit(model, rname)
+			if dummy:
+				errors.append('A resource named "%s" already exists.' % rname)
+		except:
+			pass
+
+	if len(errors) > 0:
+		raise Exception, errors
+
 	errors = resource_table[res_type][0](res, rname, form, model)
-	try:
-		dummy = getResourceForEdit(model, rname)
-		if dummy:
-			errors.append('A resource named "%s" already exists.' % rname)
-	except:
-		pass
 
 	if len(errors) > 0:
 		raise Exception, errors
+
 	return res
luci/site/luci/Extensions/RicciQueries.py +35 -28

135 lines not on this page · raw message

luci/site/luci/Extensions/cluster_adapters.py +17 -10
@@ -83,6 +83,8 @@
 	except:
 		shared_storage = False
 
+	reboot_nodes = request.form.has_key('reboot_nodes')
+
 	same_node_passwds = False
 	try:
 		same_node_passwds = request.form.has_key('allSameCheckBox')
@@ -95,7 +97,8 @@
 		'download_pkgs': download_pkgs,
 		'cluster_os': cluster_os,
 		'identical_passwds': same_node_passwds,
-		'check_certs': check_certs
+		'check_certs': check_certs,
+		'reboot_nodes': reboot_nodes
 	}
 
 	system_list, incomplete, errors, messages = parseHostForm(request, check_certs)
@@ -277,7 +280,7 @@
 	ret = send_batch_to_hosts(node_list, 10, rq.create_cluster, 
 			add_cluster['cluster_os'], clustername, clustername,
 			node_list, True, True, add_cluster['shared_storage'], False,
-			add_cluster['download_pkgs'], lockservers)
+			add_cluster['download_pkgs'], lockservers, add_cluster['reboot_nodes'])
 
 	batch_id_map = {}
 	for i in ret.iterkeys():
@@ -320,6 +323,8 @@
 	except:
 		download_pkgs = 1
 
+	reboot_nodes = request.form.has_key('reboot_nodes')
+
 	cluster_os = None
 	try:
 		cluster_os = request.form['cluster_os'].strip()
@@ -394,7 +399,8 @@
 		'download_pkgs': download_pkgs,
 		'cluster_os': cluster_os,
 		'identical_passwds': same_node_passwds,
-		'check_certs': check_certs
+		'check_certs': check_certs,
+		'reboot_nodes': reboot_nodes
 	}
 
 	system_list, incomplete, errors, messages = parseHostForm(request, check_certs)
@@ -549,7 +555,8 @@
 								shared_storage,
 								False,
 								download_pkgs,
-								model.GULM_ptr is not None)
+								model.GULM_ptr is not None,
+								reboot_nodes)
 				if not batch_node:
 					raise Exception, 'batch is blank'
 				system_list[x]['batch'] = batch_node
@@ -1419,18 +1426,18 @@
 		return {}
 
 	fvars = GetReqVars(request,
-				[ 'resourcename', 'type', 'value', 'clustername', 'URL' ])
+				[ 'resourcename', 'type', 'ip_address', 'clustername', 'URL' ])
 
 	baseurl = fvars['URL'] or LUCI_CLUSTER_BASE_URL
 
-	name = fvars['resourcename']
-	if name is None:
-		if fvars['type'] == 'ip':
-			name = fvars['value']
+	if fvars['type'] == 'ip':
+		name = fvars['ip_address']
+	else:
+		name = fvars['resourcename']
 
 	if name is None:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GRI1: missing res name')
+			luci_log.debug_verbose('GRI1: missing res name: %s' % str(request.form.items()))
 		return {}
 
 	from LuciClusterInfo import getResourceInfo as gri
luci/site/luci/Extensions/homebase_adapters.py +3 -13
@@ -240,10 +240,6 @@
 				request.SESSION.set('add_cluster_initial', cur_entry)
 				luci_log.info('SECURITY: %s' % errmsg)
 				return (False, { 'errors': [ errmsg ] })
-#			if trust_shown is True and cur_host_trusted is False:
-#				errmsg = 'You must elect to trust "%s" or abort the addition of the cluster to Luci.' % cur_host
-#				request.SESSION.set('add_cluster_initial', cur_entry)
-#				return (False, { 'errors': [ errmsg ] })
 			rc.trust()
 		except Exception, e:
 			if LUCI_DEBUG_MODE is True:
@@ -496,15 +492,9 @@
 				if not rc:
 					raise Exception, 'rc is None'
 
-				if not rc.trusted() and (trust_shown is True and cur_set_trust is False):
-					incomplete = True
-					cur_system['error'] = True
-					errors.append('You must either trust "%s" or remove it.' % cur_host)
-				else:
-					# The user doesn't care. Trust the system.
-					rc.trust()
-					cur_system['trusted'] = True
-					cur_system['prev_auth'] = rc.authed()
+				rc.trust()
+				cur_system['trusted'] = True
+				cur_system['prev_auth'] = rc.authed()
 			except Exception, e:
 				incomplete = True
 				cur_system['error'] = True

Binary files /cvs/cluster/conga/luci/site/luci/var/Data.fs 2007/06/27 08:14:13 1.27 and /cvs/cluster/conga/luci/site/luci/var/Data.fs 2008/01/23 04:34:10 1.28 differ
rcsdiff: /cvs/cluster/conga/luci/site/luci/var/Data.fs: diff failed