From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 13 Jun 2007 15:54:44 -0000 Subject: [Cluster-devel] conga/luci conga_ssl/conga_ssl_lib.cpp site/lu ... Message-ID: <20070613155444.24808.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: EXPERIMENTAL Changes by: rmccabe at sourceware.org 2007-06-13 15:54:42 Modified files: luci/conga_ssl : conga_ssl_lib.cpp luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py LuciSyslog.py RicciQueries.py cluster_adapters.py ricci_communicator.py Log message: Fix a handful of small bugs Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/conga_ssl/conga_ssl_lib.cpp.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.3.2.1&r2=1.3.2.2 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.9&r2=1.1.2.10 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.16&r2=1.1.2.17 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.4&r2=1.11.4.5 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.7&r2=1.1.2.8 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.14&r2=1.255.2.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.25.2.7&r2=1.25.2.8 --- conga/luci/conga_ssl/conga_ssl_lib.cpp 2007/06/01 23:09:57 1.3.2.1 +++ conga/luci/conga_ssl/conga_ssl_lib.cpp 2007/06/13 15:54:41 1.3.2.2 @@ -248,12 +248,13 @@ continue; xml_in += ret; } - int start = ret.length() - 1; - while (start > 0 && ret[start] == '\n' || ret[start] == '\r') + + int start = xml_in.length() - 1; + while (start > 0 && xml_in[start] == '\n' || xml_in[start] == '\r') start--; start += 2; - if ((ret.substr(0, 6) == ""), sizeof("/>") - 1) == "/>") || - ret.substr(start - sizeof(""), sizeof("") - 1) == "") + if ((ret.substr(0, 6) == ""), sizeof("/>") - 1) == "/>") || + xml_in.substr(start - sizeof(""), sizeof("") - 1) == "") { resp = xml_in; break; --- conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/06/08 18:27:00 1.1.2.9 +++ conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/06/13 15:54:42 1.1.2.10 @@ -17,7 +17,7 @@ from conga_constants import CLUSTER_CONFIG, CLUSTER_DELETE, \ CLUSTER_PROCESS, CLUSTER_RESTART, CLUSTER_START, CLUSTER_STOP, \ - FDOM, FDOM_CONFIG, FENCEDEV, NODE, NODE_ACTIVE, \ + FDOM, FENCEDEV, NODE, NODE_ACTIVE, \ NODE_ACTIVE_STR, NODE_DELETE, NODE_FENCE, NODE_INACTIVE, \ NODE_INACTIVE_STR, NODE_JOIN_CLUSTER, NODE_LEAVE_CLUSTER, \ NODE_PROCESS, NODE_REBOOT, NODE_UNKNOWN, NODE_UNKNOWN_STR, \ @@ -888,7 +888,7 @@ fdom_dict = {} fdom_dict['name'] = fdom.getName() fdomurl = '%s?pagetype=%s&clustername=%s&fdomname=%s' \ - % (baseurl, FDOM_CONFIG, clustername, fdom.getName()) + % (baseurl, FDOM, clustername, fdom.getName()) fdom_dict['fdomurl'] = fdomurl fdom_dict_list.append(fdom_dict) else: @@ -1046,7 +1046,7 @@ fdom_dict = {} fdom_dict['name'] = fdom.getName() fdomurl = '%s?pagetype=%s&clustername=%s&fdomname=%s' \ - % (baseurl, FDOM_CONFIG, clustername, fdom.getName()) + % (baseurl, FDOM, clustername, fdom.getName()) fdom_dict['fdomurl'] = fdomurl fdom_dict_list.append(fdom_dict) --- conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/06/08 18:27:00 1.1.2.16 +++ conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/06/13 15:54:42 1.1.2.17 @@ -94,7 +94,7 @@ try: clusterfolder = self.restrictedTraverse(path) clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname) - objpath = str('%s%s' % (path, objname)) + objpath = str('%s/%s' % (path, objname)) flag = self.restrictedTraverse(objpath) flag.manage_addProperty(BATCH_ID, batch_id, 'string') flag.manage_addProperty(TASKTYPE, task, 'string') @@ -153,11 +153,12 @@ luci_log.debug_verbose('NodeBusy3: %s: %r %s' \ % (nodename, e, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.info('NodeBusy4: %s not authenticated' % item[0]) + luci_log.info('%s not authenticated' % item[0]) # The comment above applies here, too. return True - batch_ret = rq.checkBatch(rc, item[1].getProperty(BATCH_ID)) + batch_id = item[1].getProperty(BATCH_ID) + batch_ret = rq.checkBatch(rc, batch_id) finished = batch_ret[0] if finished is True or finished == -1: if finished == -1: --- conga/luci/site/luci/Extensions/LuciSyslog.py 2007/06/08 18:26:15 1.11.4.4 +++ conga/luci/site/luci/Extensions/LuciSyslog.py 2007/06/13 15:54:42 1.11.4.5 @@ -7,9 +7,10 @@ from syslog import openlog, closelog, syslog, \ LOG_DAEMON, LOG_PID, LOG_NDELAY, LOG_INFO, \ - LOG_WARNING, LOG_AUTH, LOG_DEBUG + LOG_WARNING, LOG_DEBUG -from conga_constants import LUCI_DEBUG_MODE, LUCI_DEBUG_VERBOSITY +from conga_constants import LUCI_DEBUG_MODE, LUCI_DEBUG_VERBOSITY, \ + LUCI_DEBUG_NET # Exception class for the LuciSyslog facility class LuciSyslogError(Exception): @@ -61,7 +62,7 @@ self.log_msg(LOG_WARNING, msg) def private(self, msg): - self.log_msg(LOG_AUTH, msg) + self.log_msg(LOG_DEBUG, msg) def debug_verbose(self, msg): if LUCI_DEBUG_MODE is not True or LUCI_DEBUG_VERBOSITY < 2: @@ -69,14 +70,14 @@ self.log_msg(LOG_DEBUG, msg) def debug_net(self, msg): - if LUCI_DEBUG_MODE is not True or LUCI_DEBUG_VERBOSITY < 3: + if LUCI_DEBUG_NET is not True or LUCI_DEBUG_VERBOSITY < 2: return self.log_msg(LOG_DEBUG, msg) def debug_net_priv(self, msg): - if LUCI_DEBUG_MODE is not True or LUCI_DEBUG_VERBOSITY < 3: + if LUCI_DEBUG_NET is not True or LUCI_DEBUG_VERBOSITY < 3: return - self.log_msg(LOG_AUTH, msg) + self.log_msg(LOG_DEBUG, msg) def debug(self, msg): if LUCI_DEBUG_MODE is not True: --- conga/luci/site/luci/Extensions/Attic/RicciQueries.py 2007/06/07 06:41:05 1.1.2.7 +++ conga/luci/site/luci/Extensions/Attic/RicciQueries.py 2007/06/13 15:54:42 1.1.2.8 @@ -297,6 +297,9 @@ return minidom.parseString(''.join(batch)).firstChild def batchAttemptResult(doc): + if not doc: + return (None, None) + try: batch = doc.getElementsByTagName('batch') if not batch or len(batch) < 1: --- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/06/08 18:27:00 1.255.2.14 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/06/13 15:54:42 1.255.2.15 @@ -2835,7 +2835,7 @@ # This returns an empty map, and indicates not busy return busy_map - clusterfolder = getClusterDBObj(cluname) + clusterfolder = getClusterDBObj(self, cluname) if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('ICB6: %s is busy: %d flags' \ @@ -3076,7 +3076,8 @@ % (ricci[0], e, str(e))) if rc is not None: - batch_res = rq.checkBatch(rc, item[1].getProperty(BATCH_ID)) + batch_num = item[1].getProperty(BATCH_ID) + batch_res = rq.checkBatch(rc, batch_num) finished = batch_res[0] err_msg = batch_res[1] @@ -3115,14 +3116,14 @@ part2 = dex except: pass - busy_map['refreshurl'] = '5; url=%s?%s' % (part1, part2) + busy_map['refreshurl'] = '3; url=%s?%s' % (part1, part2) req['specialpagetype'] = '1' else: try: query = req['QUERY_STRING'].replace('&busyfirst=true', '') - busy_map['refreshurl'] = '5; url=%s?%s' % (req['ACTUAL_URL'], query) + busy_map['refreshurl'] = '3; url=%s?%s' % (req['ACTUAL_URL'], query) except: - busy_map['refreshurl'] = '5; url=/luci/cluster?pagetype=3' + busy_map['refreshurl'] = '3; url=/luci/cluster?pagetype=3' return busy_map # These are called from external methods. --- conga/luci/site/luci/Extensions/ricci_communicator.py 2007/06/08 18:26:15 1.25.2.7 +++ conga/luci/site/luci/Extensions/ricci_communicator.py 2007/06/13 15:54:42 1.25.2.8 @@ -375,12 +375,15 @@ def get_ricci_communicator(self, hostname, allowed_systems): if not self.access_to_host_allowed(hostname, allowed_systems): + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('GRC0: access to host %s is not allowed' % hostname) return None try: rc = RicciCommunicator(hostname) if not rc: raise Exception, 'initialization failed' + return rc except Exception, e: luci_log.info('Error creating a ricci connection to %s: %r %s' \ % (hostname, e, str(e)))