conga/luci homebase/validate_cluster_add_initi ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2008-02-07 06:13:04
Modified files:
luci/homebase : validate_cluster_add_initial.js luci/site/luci/Extensions: LuciZopeAsync.py
Log message:
Authenticate to the initial node during the first step of adding an existing cluster
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add_initial.js.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeAsync.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
luci/homebase/validate_cluster_add_initial.js +6 -4
@@ -32,7 +32,9 @@ if (form.pagetype.value == 7) { if (confirm('Retrieve cluster information from ' + added_storage[0] + '?')) { - get_cluster_members(); + form.pagetype.value = 1000; + get_cluster_members(form); + form.pagetype.value = 7; } } else if (form.pagetype.value == 6) { if (confirm('Add this cluster?')) {
@@ -62,7 +64,7 @@ return false; } -function get_cluster_members() { +function get_cluster_members(form) { var url = '/luci/cluster?pagetype=1000'; var node_num = 0;
@@ -73,9 +75,9 @@ } if (!node_num) { - alert('No node names were entered'); + alert('No node hostname was entered'); } else { - initiate_async_get(url, cluster_member_callback); + initiate_async_post(form, url, cluster_member_callback); } }
luci/site/luci/Extensions/LuciZopeAsync.py +18 -2
@@ -96,13 +96,21 @@ from LuciClusterInfo import getClusterConfNodes from RicciQueries import getClusterConf - fvars = GetReqVars(request, [ 'QUERY_STRING' ]) + fvars = GetReqVars(request, [ 'QUERY_STRING', '__SYSTEM0' ]) if fvars['QUERY_STRING'] is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GCNA0: No query string was given') write_err_async(request, 'No node names were given') return None + conf_node_pair = fvars['__SYSTEM0'] + if conf_node_pair is not None and len(conf_node_pair) == 2: + conf_node = conf_node_pair[0] + conf_node_passwd = conf_node_pair[1] + else: + conf_node = None + conf_node_passwd = None + try: nodes = fvars['QUERY_STRING'].split('&') node_list = map(lambda x: x[1], filter(lambda x: x[0][:4] == 'node', map(lambda x: x.split('='), nodes)))
@@ -118,7 +126,15 @@ ret = {} for node_host in node_list: try: - rc = RicciCommunicator(node_host) + if node_host == conf_node: + rc = RicciCommunicator(node_host, enforce_trust=False) + rc.trust() + rc.auth(conf_node_passwd) + if not rc.authed(): + errors.append('Authentication to node %s failed' % conf_node) + break + else: + rc = RicciCommunicator(node_host) cluster_name = rc.cluster_info()[0] if not cluster_name: errors.append('%s is not a member of a cluster' \