From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 18 May 2007 05:23:59 -0000 Subject: [Cluster-devel] conga/luci/site/luci/Extensions LuciClusterAct ... Message-ID: <20070518052359.1068.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-05-18 05:23:55 Modified files: luci/site/luci/Extensions: LuciClusterActions.py LuciClusterInfo.py LuciDB.py LuciZope.py RicciQueries.py cluster_adapters.py homebase_adapters.py ricci_communicator.py system_adapters.py Log message: Better debug log messages. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterActions.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/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.5&r2=1.1.2.6 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.8&r2=1.1.2.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.6&r2=1.1.2.7 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.4&r2=1.1.2.5 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.7&r2=1.255.2.8 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.5&r2=1.50.2.6 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.4&r2=1.25.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/system_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.2.2.3&r2=1.2.2.4 --- conga/luci/site/luci/Extensions/Attic/LuciClusterActions.py 2007/05/15 21:42:21 1.1.2.3 +++ conga/luci/site/luci/Extensions/Attic/LuciClusterActions.py 2007/05/18 05:23:55 1.1.2.4 @@ -22,7 +22,8 @@ raise Exception, 'cluster name from model.getClusterName() is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PCC0: getClusterName: %r' % e) + luci_log.debug_verbose('PCC0: getClusterName: %r %s' \ + % (e, str(e))) errors.append('Unable to determine cluster name') return (False, { 'errors': errors, 'messages': messages }) @@ -43,7 +44,7 @@ raise Exception, 'The new cluster configuration is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PCC2: %r' % e) + luci_log.debug_verbose('PCC2: %r %s' % (e, str(e))) errors.append(repr(e)) return (False, { 'errors': errors, 'messages': messages }) @@ -61,5 +62,6 @@ clustername) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PCC4: set_node_flag: %r' % e) + luci_log.debug_verbose('PCC4: set_node_flag: %r %s' \ + % (e, str(e))) return (True, { 'errors': errors, 'messages': messages, 'batchid': batch_id }) --- conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/05/18 02:36:59 1.1.2.5 +++ conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/05/18 05:23:55 1.1.2.6 @@ -32,7 +32,7 @@ return map(lambda x: str(x.getName()), model.getNodes()) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getnodes0: %r' % e) + luci_log.debug_verbose('getnodes0: %r %s' % (e, str(e))) return [] def getResourceInfo(model, name, res=None): @@ -79,14 +79,14 @@ results.append(vals) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSM0: %r' % e) + luci_log.debug_verbose('GCSM0: %r %s' % (e, str(e))) return None try: nodelist = model.getNodes() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSM1: %r' % e) + luci_log.debug_verbose('GCSM1: %r %s' % (e, str(e))) return None for node in nodelist: @@ -123,7 +123,7 @@ raise Exception, 'doc is None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCS0: error: %r' % e) + luci_log.debug_verbose('GCS0: error: %r %s' % (e, str(e))) doc = None if doc is None and not cluname: @@ -135,7 +135,7 @@ return cinfo except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCS1: %r' % e) + luci_log.debug_verbose('GCS1: %r %s' % (e, str(e))) doc = None if not doc: @@ -161,7 +161,7 @@ return cinfo except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCS1a: unable to get cluster info from DB: %r' % e) + luci_log.debug_verbose('GCS1a: unable to get cluster info from DB: %r %s' % (e, str(e))) return [] results = list() @@ -463,7 +463,7 @@ fdom = model.getFailoverDomainByName(request['fdomname']) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getFdomInfo0: %r' % e) + luci_log.debug_verbose('getFdomInfo0: %r %s' % (e, str(e))) return fhash fhash['name'] = fdom.getName() @@ -589,7 +589,7 @@ req.SESSION.set('model', model) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCI1: unable to get model for cluster %s: %r' % (cluname, e)) + luci_log.debug_verbose('GCI1: unable to get model for cluster %s: %r %s' % (cluname, e, str(e))) return {} else: totem = model.getTotemPtr() @@ -827,7 +827,7 @@ nodename = request['nodename'] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getNodeInfo0: %r' % e) + luci_log.debug_verbose('getNodeInfo0: %r %s' % (e, str(e))) return {} # extract correct node line from cluster status @@ -1168,7 +1168,7 @@ nodename = request.form['nodename'] except: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getFenceInfo2: unable to extract nodename: %r' % e) + luci_log.debug_verbose('getFenceInfo2: unable to extract nodename: %r %s' % (e, str(e))) return {} # Here we need to get fences for a node - just the first two levels @@ -1180,7 +1180,7 @@ node = model.retrieveNodeByName(nodename) except GeneralError, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getFenceInfo3: unable to find node name "%s" in current node list: %r' % (str(nodename), e)) + luci_log.debug_verbose('getFenceInfo3: unable to find node name "%s" in current node list: %r %s' % (str(nodename), e, str(e))) return {} fds = model.getFenceDevices() @@ -1547,7 +1547,7 @@ raise Exception, 'getClusterConf returned None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GMB0: unable to get cluster_conf_node in getModelBuilder: %r' % e) + luci_log.debug_verbose('GMB0: unable to get cluster_conf_node in getModelBuilder: %r %s' % (e, str(e))) return None try: @@ -1557,7 +1557,7 @@ except Exception, e: try: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GMB1: An error occurred while trying to get model for conf "%r": %r' % (cluster_conf_node.toxml(), e)) + luci_log.debug_verbose('GMB1: An error occurred while trying to get model for conf "%s": %r %s' % (cluster_conf_node.toxml(), e, str(e))) except: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GMB1: ModelBuilder failed') @@ -1572,8 +1572,7 @@ rc = getRicciAgent(self, clustername) if not rc: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GMFC0: unable to find a ricci agent for %s' \ - % clustername) + luci_log.debug_verbose('GMFC0: unable to find a ricci agent for %s' % clustername) return None try: @@ -1582,8 +1581,7 @@ raise Exception, 'model is none' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GMFC1: unable to get model builder for %s: %r' \ - % (clustername, e)) + luci_log.debug_verbose('GMFC1: unable to get model builder for %s: %r %s' % (clustername, e, str(e))) return None return model --- conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/05/18 02:36:59 1.1.2.8 +++ conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/05/18 05:23:55 1.1.2.9 @@ -27,8 +27,8 @@ return cluster_node except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getClusterNode0: %s %s: %r' \ - % (nodename, clustername, e)) + luci_log.debug_verbose('getClusterNode0: %s %s: %r %s' \ + % (nodename, clustername, e, str(e))) return None def getStorageNode(self, nodename): @@ -40,7 +40,8 @@ return storage_node except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getStorageNode0: %s: %r' % (nodename, e)) + luci_log.debug_verbose('getStorageNode0: %s: %r %s' \ + % (nodename, e, str(e))) return None def testNodeStatus(node, flag_mask): @@ -51,7 +52,7 @@ return flags & flag_mask != 0 except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('testNodeStatus0: %r' % e) + luci_log.debug_verbose('testNodeStatus0: %r %s' % (e, str(e))) return False def setNodeStatus(node, flag_mask): @@ -65,7 +66,8 @@ node.manage_addProperty('flags', flag_mask, 'int') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('setNodeStatus0: %r' % e) + luci_log.debug_verbose('setNodeStatus0: %r %s' \ + % (e, str(e))) def clearNodeStatus(node, flag_mask): try: @@ -76,7 +78,8 @@ node.manage_changeProperties({ 'flags': flags & ~flag_mask }) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('clearNodeStatus0: %r' % e) + luci_log.debug_verbose('clearNodeStatus0: %r %s' \ + % (e, str(e))) def set_node_flag(self, cluname, agent, batchid, task, desc): path = '%s%s' % (CLUSTER_FOLDER_PATH, cluname) @@ -93,10 +96,10 @@ flag.manage_addProperty(TASKTYPE, task, 'string') flag.manage_addProperty(FLAG_DESC, desc, 'string') except Exception, e: - errmsg = 'SNF0: error creating flag (%s,%s,%s) at %s: %r' \ - % (batch_id, task, desc, objpath, e) + errmsg = 'SNF0: error creating flag (%s,%s,%s) at %s: %s' \ + % (batch_id, task, desc, objpath, str(e)) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose(errmsg) + luci_log.debug_verbose('SNF0: %r %s' % (e, errmsg)) raise Exception, errmsg def noNodeStatusPresent(self, nodefolder, flagname, hostname): @@ -104,8 +107,8 @@ items = nodefolder.objectItems('ManagedSystem') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('NNFP0: error getting flags for %s: %r' \ - % (nodefolder[0], e)) + luci_log.debug('NNFP0: error getting flags for %s: %r %s' \ + % (nodefolder[0], e, str(e))) return None for item in items: @@ -118,7 +121,8 @@ rc = RicciCommunicator(hostname) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.info('NNFP1: ricci error %s: %r' % (hostname, e)) + luci_log.info('NNFP1: ricci error %s: %r %s' \ + % (hostname, e, str(e))) return None if not rc.authed(): @@ -141,8 +145,7 @@ nodefolder.manage_delObjects([item[0]]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.info('NNFP3: manage_delObjects for %s failed: %r' \ - % (item[0], e)) + luci_log.info('NNFP3: manage_delObjects for %s failed: %r %s' % (item[0], e, str(e))) return None return True else: @@ -158,8 +161,8 @@ objs = clusterfolder.objectItems('Folder') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('RNN0: error for %s/%s: %r' \ - % (nodename, clustername, e)) + luci_log.debug_verbose('RNN0: error for %s/%s: %r %s' \ + % (nodename, clustername, e, str(e))) return nodename for obj in objs: @@ -181,7 +184,7 @@ raise Exception, 'node list is empty' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('RCC0: no model builder nodes found for %s: %r' % (clustername, e)) + luci_log.debug_verbose('RCC0: no model builder nodes found for %s: %r %s' % (clustername, e, str(e))) return 'Unable to find cluster nodes for %s' % clustername try: @@ -191,8 +194,8 @@ raise Exception, 'cluster node is none' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('RCC1: cant find cluster node for %s: %r' \ - % (clustername, e)) + luci_log.debug('RCC1: cant find cluster node for %s: %r %s' \ + % (clustername, e, str(e))) return 'Unable to find an entry for %s in the Luci database.' % clustername try: @@ -202,7 +205,7 @@ except Exception, e: # Should we just create them all? Can this even happen? if LUCI_DEBUG_MODE is True: - luci_log.debug('RCC2: error: %r' % e) + luci_log.debug('RCC2: error: %r %s' % (e, str(e))) return 'Unable to find database entries for any nodes in %s' % clustername same_host = lambda x, y: x == y or x[:len(y) + 1] == y + '.' or y[:len(x) + 1] == x + '.' @@ -240,7 +243,8 @@ luci_log.debug_verbose('VCC3: deleted node %s' % i) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VCC4: delObjects: %s: %r' % (i, e)) + luci_log.debug_verbose('VCC4: delObjects: %s: %r %s' \ + % (i, e, str(e))) new_flags = CLUSTER_NODE_NEED_AUTH | CLUSTER_NODE_ADDED for i in new_list: @@ -252,8 +256,8 @@ except Exception, e: messages.append('A new cluster node, "%s," is now a member of cluster "%s,". but it has not been added to the management interface for this cluster as a result of an error creating a database entry for it.' % (i, clustername)) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VCC5: addFolder: %s/%s: %r' \ - % (clustername, i, e)) + luci_log.debug_verbose('VCC5: addFolder: %s/%s: %r %s' \ + % (clustername, i, e, str(e))) return messages @@ -264,8 +268,8 @@ clusterfolder = self.restrictedTraverse(path) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('buildCCF0: no cluster folder at %s: %r' \ - % (path, e)) + luci_log.debug_verbose('buildCCF0: no cluster folder at %s: %r %s' \ + % (path, e, str(e))) return None for key in batch_map.keys(): @@ -286,7 +290,7 @@ flag.manage_addProperty(LAST_STATUS, 0, 'int') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('buildCCF1: error creating flag for %s: %r' % (key, e)) + luci_log.debug_verbose('buildCCF1: error creating flag for %s: %r %s' % (key, e, str(e))) def manageCluster(self, clustername, node_list, cluster_os): clustername = str(clustername) @@ -297,7 +301,7 @@ raise Exception, 'cannot find the cluster entry in the DB' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC0: %s: %r' % (clustername, e)) + luci_log.debug_verbose('MC0: %s: %r %s' % (clustername, e, str(e))) return 'Unable to create cluster %s: the cluster directory is missing.' % clustername try: @@ -317,28 +321,30 @@ raise Exception, 'unable to create the cluster DB entry for %s' % clustername except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC2: %s: %r' % (clustername, e)) - return 'Unable to create cluster %s: %r' % (clustername, e) + luci_log.debug_verbose('MC2: %s: %r %s' % (clustername, e, str(e))) + return 'Unable to create cluster %s: %s' % (clustername, str(e)) try: newCluster.manage_acquiredPermissions([]) newCluster.manage_role('View', ['Access Contents Information', 'View']) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC3: %s: %r' % (clustername, e)) + luci_log.debug_verbose('MC3: %s: %r %s' % (clustername, e, str(e))) try: clusters.manage_delObjects([clustername]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC4: %s: %r' % (clustername, e)) - return 'Unable to set permissions on new cluster: %s: %r' % (clustername, e) + luci_log.debug_verbose('MC4: %s: %r %s' \ + % (clustername, e, str(e))) + return 'Unable to set permissions on new cluster: %s: %s' \ + % (clustername, str(e)) try: newCluster.manage_addProperty('cluster_os', cluster_os, 'string') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC5: %s: %s: %r' \ - % (clustername, cluster_os, e)) + luci_log.debug_verbose('MC5: %s: %s: %r %s' \ + % (clustername, cluster_os, e, str(e))) for i in node_list: host = node_list[i]['host'] @@ -355,14 +361,14 @@ clusters.manage_delObjects([clustername]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC6: %s: %s: %r' \ - % (clustername, host, e)) + luci_log.debug_verbose('MC6: %s: %s: %r %s' \ + % (clustername, host, e, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC7: %s: %s: %r' \ - % (clustername, host, e)) - return 'Unable to create cluster node %s for cluster %s: %r' \ - % (host, clustername, e) + luci_log.debug_verbose('MC7: %s: %s: %r %s' \ + % (clustername, host, e, str(e))) + return 'Unable to create cluster node %s for cluster %s: %s' \ + % (host, clustername, str(e)) try: ssystem = self.restrictedTraverse(STORAGE_FOLDER_PATH) @@ -370,8 +376,9 @@ raise Exception, 'The storage DB entry is missing' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC8: %s: %s: %r' % (clustername, host, e)) - return 'Error adding storage node %s: %r' % (host, e) + luci_log.debug_verbose('MC8: %s: %s: %r %s' \ + % (clustername, host, e, str(e))) + return 'Error adding storage node %s: %s' % (host, str(e)) # Only add storage systems if the cluster and cluster node DB # objects were added successfully. @@ -392,8 +399,8 @@ newSystem.manage_role('View', [ 'Access contents information' , 'View' ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('MC9: %s: %s: %r' \ - % (clustername, host, e)) + luci_log.debug_verbose('MC9: %s: %s: %r %s' \ + % (clustername, host, e, str(e))) def createClusterSystems(self, clustername, node_list): try: @@ -402,7 +409,8 @@ raise Exception, 'cluster %s DB entry is missing' % clustername except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CCS0: %s: %r' % (clustername, e)) + luci_log.debug_verbose('CCS0: %s: %r %s' \ + % (clustername, e, str(e))) return 'No cluster named "%s" is managed by Luci' % clustername for x in node_list: @@ -413,8 +421,8 @@ clusterObj.manage_addFolder(host) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CCS0a: %s: %s: %r' \ - % (clustername, host, e)) + luci_log.debug_verbose('CCS0a: %s: %s: %r %s' \ + % (clustername, host, e, str(e))) try: newSystem = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, host)) @@ -424,10 +432,10 @@ newSystem.manage_role('View', [ 'Access contents information' , 'View' ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CCS1: %s: %s: %r' \ - % (clustername, host, e)) - return 'Unable to create cluster node %s for cluster %s: %r' \ - % (host, clustername, e) + luci_log.debug_verbose('CCS1: %s: %s: %r %s' \ + % (clustername, host, e, str(e))) + return 'Unable to create cluster node %s for cluster %s: %s' \ + % (host, clustername, str(e)) try: ssystem = self.restrictedTraverse(STORAGE_FOLDER_PATH) @@ -436,7 +444,8 @@ except Exception, e: # This shouldn't fail, but if it does, it's harmless right now if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CCS2: %s: %r' % (clustername, host, e)) + luci_log.debug_verbose('CCS2: %s: %r %s' \ + % (clustername, host, e, str(e))) return None # Only add storage systems if the and cluster node DB @@ -459,7 +468,8 @@ newSystem.manage_role('View', [ 'Access contents information' , 'View' ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CCS3: %s: %r' % (clustername, host, e)) + luci_log.debug_verbose('CCS3: %s: %r %s' \ + % (clustername, host, e, str(e))) def delSystem(self, systemName): try: @@ -468,8 +478,9 @@ raise Exception, 'storage DB entry is missing' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delSystem0: %s: %r' % (systemName, e)) - return 'Unable to find storage system %s: %r' % (systemName, e) + luci_log.debug_verbose('delSystem0: %s: %r %s' \ + % (systemName, e, str(e))) + return 'Unable to find storage system %s: %s' % (systemName, str(e)) try: rc = RicciCommunicator(systemName, enforce_trust=False) @@ -480,10 +491,12 @@ ssystem.manage_delObjects([ systemName ]) except Exception, e1: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delSystem1: %s: %r' % (systemName, e1)) + luci_log.debug_verbose('delSystem1: %s: %r %s' \ + % (systemName, e1, str(e1))) return 'Unable to delete the storage system %s' % systemName if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delSystem2: %s: %r' % (systemName, e)) + luci_log.debug_verbose('delSystem2: %s: %r %s' \ + % (systemName, e, str(e))) return # Only unauthenticate if the system isn't a member of @@ -517,9 +530,10 @@ ssystem.manage_delObjects([ systemName ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delSystem3: %s: %r' % (systemName, e)) - return 'Unable to delete storage system %s: %r' \ - % (systemName, e) + luci_log.debug_verbose('delSystem3: %s: %r %s' \ + % (systemName, e, str(e))) + return 'Unable to delete storage system %s: %s' \ + % (systemName, str(e)) def delCluster(self, clustername): try: @@ -528,7 +542,7 @@ raise Exception, 'clusters DB entry is missing' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delCluster0: %r' % e) + luci_log.debug_verbose('delCluster0: %r %s' % (e, str(e))) return 'Unable to find cluster %s' % clustername err = delClusterSystems(self, clustername) @@ -539,7 +553,8 @@ clusters.manage_delObjects([ clustername ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delCluster1: %s %r' % (clustername, e)) + luci_log.debug_verbose('delCluster1: %s %r %s' \ + % (clustername, e, str(e))) return 'Unable to delete cluster %s' % clustername def delClusterSystem(self, cluster, systemName): @@ -552,14 +567,14 @@ rc.unauth() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delClusterSystem0: ricci error for %s: %r' % (systemName, e)) + luci_log.debug_verbose('delClusterSystem0: ricci error for %s: %r %s' % (systemName, e, str(e))) try: cluster.manage_delObjects([ systemName ]) except Exception, e: - err_str = 'Error deleting cluster object %s: %r' % (systemName, e) + err_str = 'Error deleting cluster object %s: %s' % (systemName, str(e)) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delClusterSystem1: %s' % err_str) + luci_log.debug_verbose('delClusterSystem1: %r %s' % (e, err_str)) return err_str def delClusterSystems(self, clustername): @@ -574,12 +589,12 @@ return None except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delCluSystems0: %r' % e) + luci_log.debug_verbose('delCluSystems0: %r %s' % (e, str(e))) return None except Exception, er: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delCluSystems1: error for %s: %r' \ - % (clustername, er)) + luci_log.debug_verbose('delCluSystems1: error for %s: %r %s' \ + % (clustername, er, str(er))) return str(er) error_list = list() @@ -624,7 +639,8 @@ cluster_nodes = self.restrictedTraverse('%s%s/objectItems' % (CLUSTER_FOLDER_PATH, clustername))('Folder') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSy0: %s: %r' % (clustername, e)) + luci_log.debug_verbose('GCSy0: %s: %r %s' \ + % (clustername, e, str(e))) return None if isAdmin(self): @@ -635,7 +651,8 @@ % (CLUSTER_FOLDER_PATH, clustername)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSy1: %s: %r' % (clustername, e)) + luci_log.debug_verbose('GCSy1: %s: %r %s' \ + % (clustername, e, str(e))) return None if cluster_permission_check(self, cluster): @@ -647,7 +664,7 @@ clusters = self.restrictedTraverse('%s/systems/cluster/objectItems' % PLONE_ROOT)('Folder') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GC0: %r' % e) + luci_log.debug_verbose('GC0: %r %s' % (e, str(e))) return None return check_clusters(self, clusters) @@ -657,7 +674,7 @@ storage = self.restrictedTraverse('%s/systems/storage/objectItems' % PLONE_ROOT)('Folder') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GS0: %r' % e) + luci_log.debug_verbose('GS0: %r %s' % (e, str(e))) return None if isAdmin(self): return storage @@ -691,7 +708,7 @@ return None except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GRA0: %r' % e) + luci_log.debug_verbose('GRA0: %r %s' % (e, str(e))) return None try: @@ -712,15 +729,14 @@ except Exception, e: try: if LUCI_DEBUG_MODE is True: - luci_log.debug('GRA3: cluster folder %s for %s is missing: %r' \ - % (path, clustername, e)) + luci_log.debug('GRA3: cluster folder %s for %s is missing: %r %s' % (path, clustername, e, str(e))) if len(clusterfolder.objectItems()) < 1: clusters = self.restrictedTraverse(str(CLUSTER_FOLDER_PATH)) clusters.manage_delObjects([clustername]) except Exception, ein: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GRA4: %r' % ein) + luci_log.debug_verbose('GRA4: %r %s' % (ein, str(ein))) return None cluname = clustername.lower() @@ -774,7 +790,7 @@ setNodeStatus(node[1], CLUSTER_NODE_NEED_AUTH) except Exception, eout: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GRA10: %r' % eout) + luci_log.debug_verbose('GRA10: %r %s' % (eout, str(eout))) if LUCI_DEBUG_MODE is True: luci_log.debug('GRA11: no ricci agent could be found for cluster %s' \ @@ -799,8 +815,8 @@ nodelist = self.restrictedTraverse(cluster_path).objectItems('Folder') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSDB0: %s -> %s: %r' \ - % (clustername, cluster_path, e)) + luci_log.debug_verbose('GCSDB0: %s -> %s: %r %s' \ + % (clustername, cluster_path, e, str(e))) return results if len(nodelist) < 1: @@ -811,7 +827,8 @@ clusters_dir.manage_delObjects([clustername]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSDB0b: %s: %r' % (clustername, e)) + luci_log.debug_verbose('GCSDB0b: %s: %r %s' \ + % (clustername, e, str(e))) else: for node in nodelist: try: @@ -824,6 +841,6 @@ results.append(node_val) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSDB1: %r' % e) + luci_log.debug_verbose('GCSDB1: %r %s' % (e, str(e))) return results --- conga/luci/site/luci/Extensions/Attic/LuciZope.py 2007/05/18 03:30:44 1.1.2.6 +++ conga/luci/site/luci/Extensions/Attic/LuciZope.py 2007/05/18 05:23:55 1.1.2.7 @@ -20,7 +20,7 @@ return os.path.isfile('%sprivkey.pem' % CERTS_DIR_PATH) and os.path.isfile('%scacert.pem' % CERTS_DIR_PATH) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('SIS0: %r' % e) + luci_log.debug_verbose('SIS0: %r %s' % (e, str(e))) return False def strFilter(regex, replaceChar, arg): @@ -121,5 +121,6 @@ request.SESSION.set('model', model) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('Appending model to request failed: %r' % e) + luci_log.debug_verbose('Appending model to request failed: %r %s' \ + % (e, str(e))) return 'An error occurred while storing the cluster model' --- conga/luci/site/luci/Extensions/Attic/RicciQueries.py 2007/05/18 02:36:59 1.1.2.4 +++ conga/luci/site/luci/Extensions/Attic/RicciQueries.py 2007/05/18 05:23:55 1.1.2.5 @@ -5,6 +5,7 @@ # GNU General Public License as published by the # Free Software Foundation. +import xml.dom from xml.dom import minidom from ricci_communicator import RicciCommunicator, extract_module_status from LuciSyslog import get_logger @@ -24,8 +25,8 @@ return (True, 'batch id %s was not found' % batch_id) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('checkBatch1: %s: %r' \ - % (rc.hostname(), e)) + luci_log.debug_verbose('checkBatch1: %s: %r %s' \ + % (rc.hostname(), e, str(e))) return (-1, err_msg) try: @@ -35,8 +36,8 @@ % (rc.hostname(), str(new_err_msg)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('checkBatch2: %s: %r' \ - % (rc.hostname(), e)) + luci_log.debug_verbose('checkBatch2: %s: %r %s' \ + % (rc.hostname(), e, str(e))) return (-1, err_msg) # In progress. @@ -302,7 +303,7 @@ raise Exception, 'no batch tag was found' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('BAR0: %r' % e) + luci_log.debug_verbose('BAR0: %r %s' % (e, str(e))) return (None, None) for i in batch: @@ -330,7 +331,7 @@ cluster_tags = ricci_xml.getElementsByTagName('cluster') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSB0: %r' % e) + luci_log.debug_verbose('GCSB0: %r %s' % (e, str(e))) return None if len(cluster_tags) < 1: @@ -347,7 +348,7 @@ raise Exception, 'element 0 is None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSB3: %r' % e) + luci_log.debug_verbose('GCSB3: %r %s' % (e, str(e))) return None try: @@ -356,7 +357,7 @@ return doc except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSB4: %r' % e) + luci_log.debug_verbose('GCSB4: %r %s' % (e, str(e))) return None @@ -392,8 +393,8 @@ raise Exception, 'no log data is available.' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GNL0: retrieving log data from %s: %r' \ - % (rc.hostname(), e)) + luci_log.debug_verbose('GNL0: retrieving log data from %s: %r %s' \ + % (rc.hostname(), e, str(e))) return None time_now = time() @@ -544,7 +545,7 @@ else: raise Exception, op except Exception, e: - elem.setAttribute('message', 'Unknown operation: %r' % e) + elem.setAttribute('message', 'Unknown operation: %s' % str(e)) doc.appendChild(elem) return doc @@ -592,7 +593,7 @@ return service_tags except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('LS1: %r' % e) + luci_log.debug_verbose('LS1: %r %s' % (e, str(e))) return None def nodeIsVirtual(rc): @@ -630,7 +631,8 @@ raise Exception, 'unexpected attribute name: %s' % name except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('nodeIsVirtual2: error: %r' % e) + luci_log.debug_verbose('nodeIsVirtual2: error: %r %s' \ + % (e, str(e))) if not success: return None @@ -654,28 +656,40 @@ def extractDaemonInfo(bt_node): if not bt_node: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('EDI0: no bt_node') return None + resultlist = list() svc_nodes = bt_node.getElementsByTagName('service') for node in svc_nodes: svchash = {} try: name = node.getAttribute('name') if not name: - raise - except: + raise Exception, 'No name' + except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('EDI1: no service name: %r %s' \ + % (e, str(e))) name = '[unknown]' svchash['name'] = name try: svc_enabled = node.getAttribute('enabled') - except: + except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('EDI2: no enabled: %r %s' \ + % (e, str(e))) svc_enabled = '[unknown]' svchash['enabled'] = svc_enabled try: running = node.getAttribute('running') - except: + except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('EDI3: no running: %r %s' \ + % (e, str(e))) running = '[unknown]' svchash['running'] = running resultlist.append(svchash) @@ -706,8 +720,8 @@ raise Exception, 'unknown error' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCC0: connecting to %s: %r' \ - % (system_info, e)) + luci_log.debug_verbose('GCC0: connecting to %s: %r %s' \ + % (system_info, e, str(e))) return None # end workaround @@ -715,8 +729,8 @@ ret = rc.process_batch(batch) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCC1: process_batch error for %s: %r' \ - % (system_info, e)) + luci_log.debug_verbose('GCC1: process_batch error for %s: %r %s' \ + % (system_info, e, str(e))) return None if not ret: @@ -725,7 +739,7 @@ cur = ret while len(cur.childNodes) > 0: for i in cur.childNodes: - if i.nodeType == ELEMENT_NODE: + if i.nodeType == xml.dom.Node.ELEMENT_NODE: if i.nodeName == 'var' and i.getAttribute('name') == 'cluster.conf': return i.childNodes[1].cloneNode(True) else: --- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/05/18 02:36:59 1.255.2.7 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/05/18 05:23:55 1.255.2.8 @@ -7,7 +7,6 @@ from xml.dom import minidom -from ClusterModel.ModelBuilder import ModelBuilder from ClusterModel.FailoverDomain import FailoverDomain from ClusterModel.FailoverDomainNode import FailoverDomainNode from ClusterModel.RefObject import RefObject @@ -66,7 +65,8 @@ clustername = str(request.form['clustername']) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PNC00: missing cluster name: %r' % e) + luci_log.debug_verbose('PNC00: missing cluster name: %r %s' \ + % (e, str(e))) clustername = None if clustername is None: @@ -118,7 +118,8 @@ errors.append('Unable to connect to %s: %s' \ % (cur_host, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PCN1: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('PCN1: %s: %r %s' \ + % (cur_host, e, str(e))) continue prev_auth = rc.authed() @@ -139,7 +140,8 @@ errors.append('Error authenticating to %s: %s' \ % (cur_host, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PCN2: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('PCN2: %s: %r %s' \ + % (cur_host, e, str(e))) continue cur_cluster_info = rc.cluster_info() @@ -158,7 +160,8 @@ del cur_system['trusted'] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PCN3: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('PCN3: %s: %r %s' \ + % (cur_host, e, str(e))) errors.append('%s reports it is a member of cluster "%s"' \ % (cur_host, cur_cluster_name)) @@ -182,7 +185,8 @@ del cur_system['trusted'] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PCN5: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('PCN5: %s: %r %s' \ + % (cur_host, e, str(e))) errors.append('The cluster software version on %s (%s) does not match the software on the other cluster nodes (%s)' % (cur_host, cur_host_os, cluster_os)) if LUCI_DEBUG_MODE is True: @@ -300,8 +304,8 @@ batch_id_map[i] = resultNode.getAttribute('batch_id') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateCreateCluster0: %s: %r' \ - % (i, e)) + luci_log.debug_verbose('validateCreateCluster0: %s: %r %s' \ + % (i, e, str(e))) errors.append('An error occurred while attempting to add cluster node "%s"' % i) if len(batch_id_map) == 0: request.SESSION.set('create_cluster', add_cluster) @@ -359,7 +363,8 @@ raise Exception, 'cluster DB object is missing' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN1: %s: %r' % (clustername, e)) + luci_log.debug_verbose('VACN1: %s: %r %s' \ + % (clustername, e, str(e))) return (False, { 'errors': [ 'The database object for %s is missing' % clustername ] }) try: @@ -368,7 +373,8 @@ raise Exception, 'cluster os is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN2: %s: %r' % (clustername, e)) + luci_log.debug_verbose('VACN2: %s: %r %s' \ + % (clustername, e, str(e))) cluster_os = None if cluster_os is None: @@ -377,7 +383,8 @@ cluster_os = resolveOSType(cluster_ricci.os()) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN3: %s: %r' % (clustername, e)) + luci_log.debug_verbose('VACN3: %s: %r %s' \ + % (clustername, e, str(e))) cluster_os = None if cluster_os is None: @@ -429,7 +436,8 @@ errors.append('Unable to connect to %s: %s' \ % (cur_host, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN4: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VACN4: %s: %r %s' \ + % (cur_host, e, str(e))) continue prev_auth = rc.authed() @@ -450,7 +458,8 @@ errors.append('Error authenticating to %s: %s' \ % (cur_host, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN5: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VACN5: %s: %r %s' \ + % (cur_host, e, str(e))) continue cur_cluster_info = rc.cluster_info() @@ -469,7 +478,8 @@ del cur_system['trusted'] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN6: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VACN6: %s: %r %s' \ + % (cur_host, e, str(e))) errors.append('%s reports it is already a member of cluster "%s"' % (cur_host, cur_cluster_name)) if LUCI_DEBUG_MODE is True: @@ -488,7 +498,8 @@ del cur_system['trusted'] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN8: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VACN8: %s: %r %s' \ + % (cur_host, e, str(e))) errors.append('The cluster software version on %s (%s) does not match the software on the other cluster nodes (%s)' % (cur_host, cur_host_os, cluster_os)) if LUCI_DEBUG_MODE is True: @@ -508,7 +519,8 @@ incomplete = True errors.append('Unable to contact a ricci agent for %s' % clustername) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN10: %s: %r' % (clustername, e)) + luci_log.debug_verbose('VACN10: %s: %r %s' \ + % (clustername, e, str(e))) if incomplete or len(errors) > 0: request.SESSION.set('add_node', add_cluster) @@ -535,7 +547,7 @@ errors.append('Unable to build the cluster model for %s' \ % clustername) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN11: %r' % e) + luci_log.debug_verbose('VACN11: %r %s' % (e, str(e))) if incomplete or len(errors) > 0: request.SESSION.set('add_node', add_cluster) @@ -568,11 +580,13 @@ del cur_system['trusted'] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN12: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VACN12: %s: %r %s' \ + % (cur_host, e, str(e))) errors.append('Unable to initiate cluster join for node "%s"' % cur_host) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN13: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VACN13: %s: %r %s' \ + % (cur_host, e, str(e))) continue next_node_id += 1 @@ -621,7 +635,7 @@ errors.append('Unable to update the cluster node list for %s' \ % clustername) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN15: %r' % e) + luci_log.debug_verbose('VACN15: %r %s' % (e, str(e))) if incomplete or len(errors) > 0: request.SESSION.set('add_node', add_cluster) @@ -654,7 +668,7 @@ errors.append('Unable to connect to the ricci agent on %s: %s' \ % (cur_host, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.info('VACN17: Unable to connect to the ricci daemon on host %s: %r' % (clunode['host'], e)) + luci_log.info('VACN17: Unable to connect to the ricci daemon on host %s: %r %s' % (clunode['host'], e, str(e))) if success: try: @@ -664,7 +678,8 @@ clunode['errors'] = True success = False if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN18: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VACN18: %s: %r %s' \ + % (cur_host, e, str(e))) if not success: incomplete = True @@ -689,8 +704,9 @@ raise KeyError, 'form_xml must not be blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA0: no form_xml: %r' % e) - return (False, {'errors': ['No resource data was supplied for this service']}) + luci_log.debug_verbose('vSA0: no form_xml: %r %s' \ + % (e, str(e))) + return (False, { 'errors': [ 'No resource data was supplied for this service' ]}) try: model = request.SESSION.get('model') @@ -698,8 +714,8 @@ raise Exception, 'model is None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA0a: %r' % e) - return (False, {'errors': [ 'The cluster model is missing from the session object' ]}) + luci_log.debug_verbose('vSA0a: %r %s' % (e, str(e))) + return (False, { 'errors': [ 'The cluster model is missing from the session object' ]}) try: doc = minidom.parseString(form_xml) @@ -708,11 +724,11 @@ raise except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA1: error: %r' % e) - return (False, {'errors': ['The resource data submitted for this service is not properly formed']}) + luci_log.debug_verbose('vSA1: error: %r %s' % (e, str(e))) + return (False, { 'errors': [ 'The resource data submitted for this service is not properly formed' ]}) form_hash = {} - form_hash['toplevel'] = {'form': None, 'kids': [] } + form_hash['toplevel'] = { 'form': None, 'kids': [] } for i in forms: form_id = i.getAttribute('id') form_parent = i.getAttribute('parent') @@ -741,7 +757,8 @@ dummy_form[str(i.getAttribute('name'))] = str(i.getAttribute('value')) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA2: parsing XML: %r' % e) + luci_log.debug_verbose('vSA2: parsing XML: %r %s' \ + % (e, str(e))) try: res_type = dummy_form['type'].strip() @@ -749,16 +766,17 @@ raise Exception, 'no resource type' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA3: %r' % e) - return (False, {'errors': [ 'No resource type was specified' ]}) + luci_log.debug_verbose('vSA3: %r %s' % (e, str(e))) + return (False, { 'errors': [ 'No resource type was specified' ]}) try: if res_type == 'ip': dummy_form['resourceName'] = dummy_form['ip_address'] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA3a: type is ip but no addr: %r' % e) - return (False, {'errors': [ 'No IP address was given' ]}) + luci_log.debug_verbose('vSA3a: type is ip but no addr: %r %s' \ + % (e, str(e))) + return (False, { 'errors': [ 'No IP address was given' ]}) try: if dummy_form.has_key('immutable'): @@ -770,10 +788,11 @@ except Exception, e: resObj = None if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA4: type %s: %r' % (res_type, e)) + luci_log.debug_verbose('vSA4: type %s: %r %s' \ + % (res_type, e, str(e))) if resObj is None: - return (False, {'errors': [ 'An error occurred while adding %s' % res_type ]}) + return (False, { 'errors': [ 'An error occurred while adding %s' % res_type ]}) form_hash[form_id]['obj'] = resObj if len(errors) > 0: @@ -802,8 +821,9 @@ service_name = request.form['svc_name'].strip() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA5: no service name: %r' % e) - return (False, {'errors': [ 'No service name was given' ]}) + luci_log.debug_verbose('vSA5: no service name: %r %s' \ + % (e, str(e))) + return (False, { 'errors': [ 'No service name was given' ]}) autostart = '1' try: @@ -812,7 +832,8 @@ except Exception, e: autostart = None if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA5a: error getting autostart: %r' % e) + luci_log.debug_verbose('vSA5a: error getting autostart: %r %s' \ + % (e, str(e))) exclusive = '0' try: @@ -827,13 +848,13 @@ cur_service = model.retrieveServiceByName(service_name) except GeneralError, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA5b: no service named %s found: %r' \ - % (service_name, e)) + luci_log.debug_verbose('vSA5b: no service named %s found: %r %s' \ + % (service_name, e, str(e))) cur_service = None except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA5c: no service named %s found: %r' \ - % (service_name, e)) + luci_log.debug_verbose('vSA5c: no service named %s found: %r %s' \ + % (service_name, e, str(e))) cur_service = None try: @@ -850,7 +871,8 @@ return (False, {'errors': [ 'An unknown action was specified' ]}) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vSA5: no action type: %r' % e) + luci_log.debug_verbose('vSA5: no action type: %r %s' \ + % (e, str(e))) def buildSvcTree(parent, child_id_list): for i in child_id_list: @@ -860,7 +882,7 @@ raise Exception, 'No object for %s' % i except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('bST0: %r' % e) + luci_log.debug_verbose('bST0: %r %s' % (e, str(e))) continue parent.addChild(child) if 'kids' in form_hash[i]: @@ -892,7 +914,8 @@ raise Exception, 'model string for %s is blank' % clustername except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vAS6a: exportModelAsString: %r' % e) + luci_log.debug_verbose('vAS6a: exportModelAsString: %r %s' \ + % (e, str(e))) return (False, {'errors': [ 'An error occurred while adding this service' ]}) rc = getRicciAgent(self, clustername) @@ -915,7 +938,8 @@ raise Exception, 'unable to save the new cluster configuration' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vAS9: %r' % e) + luci_log.debug_verbose('vAS9: %r %s' \ + % (e, str(e))) return 'An error occurred while propagating the new cluster.conf: %s' % str(e) try: @@ -925,7 +949,8 @@ set_node_flag(self, clustername, ragent, str(batch_number), SERVICE_ADD, 'Creating service "%s"' % service_name) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vAS10: failed to set flags: %r' % e) + luci_log.debug_verbose('vAS10: failed to set flags: %r %s' \ + % (e, str(e))) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \ @@ -945,7 +970,7 @@ model = request.SESSION.get('model') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VRA1: no model: %r' % e) + luci_log.debug_verbose('VRA1: no model: %r %s' % (e, str(e))) return None errors = list() @@ -963,7 +988,7 @@ if len(errors) > 0: errors.append('An error occurred while adding this resource') if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('resource error: %r' % e) + luci_log.debug_verbose('resource error: %r %s' % (e, str(e))) return (False, {'errors': errors}) @@ -1020,7 +1045,8 @@ model.mcast_address = addr_str except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('Error updating mcast properties: %r' % e) + luci_log.debug('Error updating mcast properties: %r %s' \ + % (e, str(e))) errors.append('Unable to update cluster multicast properties') if len(errors) > 0: @@ -1227,7 +1253,7 @@ cp.setConfigVersion(str(version_num)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('unable to update general properties: %r' % e) + luci_log.debug_verbose('unable to update general properties: %r %s' % (e, str(e))) errors.append('Unable to update the cluster configuration') try: @@ -1359,7 +1385,7 @@ fd.setPostFailDelay(str(post_fail_delay)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('Unable to update fence daemon properties: %r' % e) + luci_log.debug_verbose('Unable to update fence daemon properties: %r %s' % (e, str(e))) errors.append('An error occurred while attempting to update fence daemon properties') if len(errors) > 0: @@ -1429,7 +1455,7 @@ raise Exception, 'no config type' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VCC2a: %r' % e) + luci_log.debug_verbose('VCC2a: %r %s' % (e, str(e))) return (False, {'errors': [ 'No configuration type was submitted' ]}) if not configFormValidators.has_key(request.form['configtype']): @@ -1466,7 +1492,7 @@ raise Exception, 'conf_str is none' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VCC4: export model as string failed: %r' % e) + luci_log.debug_verbose('VCC4: export model as string failed: %r %s' % (e, str(e))) errors.append('Unable to store the new cluster configuration') try: @@ -1475,7 +1501,8 @@ raise Exception, 'cluster name from model.getClusterName() is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VCC5: error: getClusterName: %r' % e) + luci_log.debug_verbose('VCC5: error: getClusterName: %r %s' \ + % (e, str(e))) errors.append('Unable to determine cluster name from model') if len(errors) > 0: @@ -1548,7 +1575,7 @@ model = None except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('LECM2: no model: %r' % e) + luci_log.debug_verbose('LECM2: no model: %r %s' % (e, str(e))) model = None return model @@ -1578,7 +1605,8 @@ raise Exception, 'conf_str is none' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VFE: export model as string failed: %r' % e) + luci_log.debug_verbose('VFE: export model as string failed: %r %s' \ + % (e, str(e))) errors.append('Unable to store the new cluster configuration') request.RESPONSE.redirect('%s?pagetype=%s&clustername=%s&fencename=%s&busyfirst=true' % (request['URL'], FENCEDEV, model.getClusterName(), ret_obj)) @@ -1641,7 +1669,7 @@ raise Exception, 'conf_str is none' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VFE: export model as string failed: %r' % e) + luci_log.debug_verbose('VFE: export model as string failed: %r %s' % (e, str(e))) errors.append('Unable to store the new cluster configuration') try: @@ -1650,7 +1678,8 @@ raise Exception, 'cluster name from model.getClusterName() is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VFA: error: getClusterName: %r' % e) + luci_log.debug_verbose('VFA: error: getClusterName: %r %s' \ + % (e, str(e))) errors.append('Unable to determine cluster name from model') if not rc: @@ -1689,14 +1718,14 @@ raise KeyError, 'form_xml must not be blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC0: no form_xml: %r' % e) + luci_log.debug_verbose('vNFC0: no form_xml: %r %s' % (e, str(e))) return (False, {'errors': ['No fence data was supplied']}) try: fence_level = int(request.form['fence_level'].strip()) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC1: no fence level: %r' % e) + luci_log.debug_verbose('vNFC1: no fence level: %r %s' % (e, str(e))) return (False, {'errors': ['No fence level was supplied']}) try: @@ -1705,7 +1734,7 @@ raise Exception, 'nodename is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC2: no nodename: %r' % e) + luci_log.debug_verbose('vNFC2: no nodename: %r %s' % (e, str(e))) return (False, {'errors': ['No node name was given']}) try: @@ -1714,7 +1743,7 @@ raise Exception, 'clustername is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC3: no clustername: %r' % e) + luci_log.debug_verbose('vNFC3: no clustername: %r %s' % (e, str(e))) return (False, {'errors': ['No cluster name was given']}) try: @@ -1737,14 +1766,14 @@ doc = minidom.parseString(form_xml) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC5: error: %r' % e) + luci_log.debug_verbose('vNFC5: error: %r %s' % (e, str(e))) return (False, {'errors': ['The fence data submitted is not properly formed']}) try: node = model.retrieveNodeByName(nodename) except GeneralError, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC6: unable to find node name %s in current node list: %r' % (str(nodename), e)) + luci_log.debug_verbose('vNFC6: unable to find node name %s in current node list: %r %s' % (str(nodename), e, str(e))) return (False, {'errors': ['Unable to find the cluster node %s in the node list' % str(nodename) ]}) fence_level_num = int(fence_level) @@ -1774,7 +1803,8 @@ node.getChildren()[0].removeChild(delete_target) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC6a: %s: %r' % (method_id, e)) + luci_log.debug_verbose('vNFC6a: %s: %r %s' \ + % (method_id, e, str(e))) return (False, {'errors': ['An error occurred while deleting fence method %s' % method_id ]}) else: return (True, {'messages': ['No changes were made'] }) @@ -1795,7 +1825,8 @@ input_type = str(i.getAttribute('type')) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC7: input type: %r' % e) + luci_log.debug_verbose('vNFC7: input type: %r %s' \ + % (e, str(e))) continue if not input_type or input_type == 'button': @@ -1805,12 +1836,13 @@ dummy_form[str(i.getAttribute('name'))] = str(i.getAttribute('value')) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC8: parsing XML: %r' % e) + luci_log.debug_verbose('vNFC8: parsing XML: %r %s' \ + % (e, str(e))) if len(dummy_form) < 1: continue - if 'fence_instance' in dummy_form: + if dummy_form.has_key('fence_instance'): try: parent = dummy_form['parent_fencedev'] except: @@ -1838,7 +1870,7 @@ fence_form, instance_list = form_hash[i] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC11: %r' % e) + luci_log.debug_verbose('vNFC11: %r %s' % (e, str(e))) continue try: @@ -1847,7 +1879,7 @@ raise Exception, 'fence type is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC12: %s: %r' % (i, e)) + luci_log.debug_verbose('vNFC12: %s: %r %s' % (i, e, str(e))) fence_type = None if 'existing_device' in fence_form: @@ -1947,7 +1979,8 @@ luci_log.debug_verbose('vNFC16: exported "%s"' % conf) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC17: exportModelAsString failed: %r' % e) + luci_log.debug_verbose('vNFC17: exportModelAsString failed: %r %s' \ + % (e, str(e))) return (False, {'errors': [ 'An error occurred while constructing the new cluster configuration' ]}) rc = getRicciAgent(self, clustername) @@ -1967,7 +2000,8 @@ set_node_flag(self, clustername, ragent, str(batch_number), FENCEDEV_NODE_CONFIG, "Updating fence configuration for node \'%s\'" % nodename) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vNFC20: failed to set flags: %r' % e) + luci_log.debug_verbose('vNFC20: failed to set flags: %r %s' \ + % (e, str(e))) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&nodename=%s&busyfirst=true' % (request['URL'], NODE, clustername, nodename)) @@ -2064,7 +2098,7 @@ raise Exception, 'conf_str is none' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VFE: export model as string failed: %r' % e) + luci_log.debug_verbose('VFE: export model as string failed: %r %s' % (e, str(e))) errors.append('Unable to store the new cluster configuration') try: @@ -2073,7 +2107,8 @@ raise Exception, 'cluster name from model.getClusterName() is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VFA: error: getClusterName: %r' % e) + luci_log.debug_verbose('VFA: error: getClusterName: %r %s' \ + % (e, str(e))) errors.append('Unable to determine cluster name from model') if not rc: @@ -2130,7 +2165,7 @@ except Exception, e: errors.append('Unable to determine the current node name') if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VDP1: no nodename: %r' % e) + luci_log.debug_verbose('VDP1: no nodename: %r %s' % (e, str(e))) try: clustername = form['clustername'].strip() @@ -2139,7 +2174,7 @@ except Exception, e: errors.append('Unable to determine the current cluster name') if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VDP2: no clustername: %r' % e) + luci_log.debug_verbose('VDP2: no clustername: %r %s' % (e, str(e))) disable_list = list() enable_list = list() @@ -2170,7 +2205,8 @@ raise Exception, 'rc is None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VDP5: RC %s: %r' % (nodename_resolved, e)) + luci_log.debug_verbose('VDP5: RC %s: %r %s' \ + % (nodename_resolved, e, str(e))) errors.append('Unable to connect to the ricci agent on %s to update cluster daemon properties' % nodename_resolved) return (False, {'errors': errors}) @@ -2206,7 +2242,8 @@ raise Exception, 'no model' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateFdom0: no model: %r' % e) + luci_log.debug_verbose('validateFdom0: no model: %r %s' \ + % (e, str(e))) return (False, {'errors': [ 'Unable to retrieve cluster information' ]}) prioritized = False @@ -2244,7 +2281,8 @@ except Exception, e: errors.append('No name was given for this failover domain') if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateFdom0: %r' % e) + luci_log.debug_verbose('validateFdom0: %r %s' \ + % (e, str(e))) oldname = None try: @@ -2310,7 +2348,7 @@ conf = str(model.exportModelAsString()) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateFdom2: %r' % e) + luci_log.debug_verbose('validateFdom2: %r %s' % (e, str(e))) errors.append('Unable to update the cluster configuration') if len(errors) > 0: @@ -2336,7 +2374,8 @@ set_node_flag(self, clustername, ragent, str(batch_number), FDOM_ADD, 'Creating failover domain "%s"' % name) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateFdom5: failed to set flags: %r' % e) + luci_log.debug_verbose('validateFdom5: failed to set flags: %r %s' \ + % (e, str(e))) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&fdomname=%s&busyfirst=true' \ @@ -2353,7 +2392,8 @@ raise Exception, 'blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateVM0: no vm name: %r' % e) + luci_log.debug_verbose('validateVM0: no vm name: %r %s' \ + % (e, str(e))) errors.append('No virtual machine name was given') try: @@ -2362,7 +2402,8 @@ raise Exception, 'blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateVM1: no vm path: %r' % e) + luci_log.debug_verbose('validateVM1: no vm path: %r %s' \ + % (e, str(e))) errors.append('No path to the virtual machine configuration file was given') autostart = 1 @@ -2466,7 +2507,7 @@ raise Exception, 'model is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateVM2: %r' % e) + luci_log.debug_verbose('validateVM2: %r %s' % (e, str(e))) errors.append('Unable to update the cluster model') try: @@ -2475,7 +2516,7 @@ raise Exception, 'cluster name from model.getClusterName() is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateVM3: %r' % e) + luci_log.debug_verbose('validateVM3: %r %s' % (e, str(e))) errors.append('Unable to determine the cluster name') if len(errors) > 0: @@ -2502,7 +2543,8 @@ set_node_flag(self, clustername, rc.hostname(), str(batch_number), VM_CONFIG, "Configuring virtual machine service \'%s\'" % vm_name) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateVM6: failed to set flags: %r' % e) + luci_log.debug_verbose('validateVM6: failed to set flags: %r %s' \ + % (e, str(e))) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \ @@ -2533,7 +2575,7 @@ pagetype = int(request.form['pagetype']) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VP0: error: %r' % e) + luci_log.debug_verbose('VP0: error: %r %s' % (e, str(e))) return None if not pagetype in formValidators: @@ -3390,7 +3432,7 @@ raise Exception, 'cannot find database object at %s' % path except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('NLO: node_leave_cluster err: %r' % e) + luci_log.debug('NLO: node_leave_cluster err: %r %s' % (e, str(e))) return None objname = '%s____flag' % nodename_resolved @@ -3418,7 +3460,8 @@ set_node_flag(self, clustername, rc.hostname(), str(batch_number), NODE_LEAVE_CLUSTER, 'Node "%s" leaving cluster "%s"' % (nodename_resolved, clustername)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('NL4: failed to set flags: %r' % e) + luci_log.debug_verbose('NL4: failed to set flags: %r %s' \ + % (e, str(e))) return True def nodeJoin(self, rc, clustername, nodename_resolved): @@ -3432,7 +3475,8 @@ set_node_flag(self, clustername, rc.hostname(), str(batch_number), NODE_JOIN_CLUSTER, 'Node "%s" joining cluster "%s"' % (nodename_resolved, clustername)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('NJ1: failed to set flags: %r' % e) + luci_log.debug_verbose('NJ1: failed to set flags: %r %s' \ + % (e, str(e))) return True def clusterStart(self, model): @@ -3453,8 +3497,8 @@ rc = RicciCommunicator(nodename_resolved) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CStart: RC %s: %r' \ - % (nodename_resolved, e)) + luci_log.debug_verbose('CStart: RC %s: %r %s' \ + % (nodename_resolved, e, str(e))) errors += 1 continue if nodeJoin(self, rc, clustername, nodename_resolved) is None: @@ -3482,8 +3526,8 @@ rc = RicciCommunicator(nodename_resolved) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CStop0: [%d] RC %s: %r' \ - % (delete is True, str(nodename_resolved), e)) + luci_log.debug_verbose('CStop0: [%d] RC %s: %r %s' \ + % (delete is True, str(nodename_resolved), e, str(e))) errors += 1 continue @@ -3531,8 +3575,8 @@ delCluster(self, clustername) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('clusterDelete1: %s: %r' \ - % (clustername, e)) + luci_log.debug_verbose('clusterDelete1: %s: %r %s' \ + % (clustername, e, str(e))) try: clusterfolder = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername)) @@ -3541,8 +3585,8 @@ clusters.manage_delObjects([clustername]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('clusterDelete2: %s %r' \ - % (clustername, e)) + luci_log.debug_verbose('clusterDelete2: %s %r %s' \ + % (clustername, e, str(e))) return CLUSTERLIST else: if LUCI_DEBUG_MODE is True: @@ -3560,7 +3604,8 @@ set_node_flag(self, clustername, rc.hostname(), str(batch_number), NODE_REBOOT, 'Node "%s" is being rebooted' % nodename_resolved) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('FNR1: failed to set flags: %r' % e) + luci_log.debug_verbose('FNR1: failed to set flags: %r %s' \ + % (e, str(e))) return True def forceNodeFence(self, clustername, nodename, nodename_resolved): @@ -3572,8 +3617,7 @@ raise Exception, 'no cluster folder at %s' % path except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('FNF0: The cluster folder %s could not be found: %r' \ - % (clustername, e)) + luci_log.debug('FNF0: The cluster folder %s could not be found: %r %s' % (clustername, e, str(e))) return None try: @@ -3582,8 +3626,8 @@ raise Exception, 'no cluster nodes' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('FNF1: No cluster nodes for %s were found: %r' \ - % (clustername, e)) + luci_log.debug('FNF1: No cluster nodes for %s were found: %r %s' \ + % (clustername, e, str(e))) return None found_one = False @@ -3597,8 +3641,8 @@ raise Exception, 'rc is None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('FNF2: ricci error for host %s: %r' \ - % (node[0], e)) + luci_log.debug('FNF2: ricci error for host %s: %r %s' \ + % (node[0], e, str(e))) continue if not rc.authed(): @@ -3631,7 +3675,8 @@ set_node_flag(self, clustername, rc.hostname(), str(batch_number), NODE_FENCE, 'Node "%s" is being fenced' % nodename_resolved) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('FNF4: failed to set flags: %r' % e) + luci_log.debug_verbose('FNF4: failed to set flags: %r %s' \ + % (e, str(e))) return True def nodeDelete(self, rc, model, clustername, nodename, nodename_resolved, delete_cluster=False): @@ -3652,8 +3697,7 @@ raise Exception, 'no cluster folder at %s' % path except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ND0: node delete error for cluster %s: %r' \ - % (clustername, e)) + luci_log.debug_verbose('ND0: node delete error for cluster %s: %r %s' % (clustername, e, str(e))) return None try: @@ -3662,8 +3706,7 @@ raise Exception, 'no cluster nodes in DB' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ND1: node delete error for cluster %s: %r' \ - % (clustername, e)) + luci_log.debug_verbose('ND1: node delete error for cluster %s: %r %s' % (clustername, e, str(e))) for node in nodes: if node[1].getId().find(nodename) != (-1): @@ -3678,7 +3721,8 @@ raise Exception, 'ND1a: rc2 is None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.info('ND2: ricci %s error: %r' % (node[0], e)) + luci_log.info('ND2: ricci %s error: %r %s' \ + % (node[0], e, str(e))) continue if not rc2.authed(): @@ -3724,7 +3768,8 @@ set_node_flag(self, clustername, rc.hostname(), str(batch_number), CLUSTER_DELETE, 'Deleting cluster "%s": Deleting node "%s"' % (clustername, nodename_resolved)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ND5a: failed to set flags: %r' % e) + luci_log.debug_verbose('ND5a: failed to set flags: %r %s' \ + % (e, str(e))) else: delete_target = None nodelist = model.getNodes() @@ -3747,8 +3792,8 @@ model.deleteNode(delete_target) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ND6a: deleteNode %s failed: %r' \ - % (delete_target.getName(), e)) + luci_log.debug_verbose('ND6a: deleteNode %s failed: %r %s' \ + % (delete_target.getName(), e, str(e))) try: model.setModified(True) @@ -3757,7 +3802,8 @@ raise Exception, 'model string is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ND7: exportModelAsString: %r' % e) + luci_log.debug_verbose('ND7: exportModelAsString: %r %s' \ + % (e, str(e))) return None # propagate the new cluster.conf via the second node @@ -3774,8 +3820,8 @@ clusterfolder.manage_delObjects([nodename_resolved]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ND9: error deleting %s at %s: %r' \ - % (nodename_resolved, path, e)) + luci_log.debug_verbose('ND9: error deleting %s at %s: %r %s' \ + % (nodename_resolved, path, e, str(e))) if delete_cluster: return True @@ -3784,7 +3830,8 @@ set_node_flag(self, clustername, rc2.hostname(), str(batch_number), NODE_DELETE, "Deleting node \'%s\'" % nodename_resolved) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ND10: failed to set flags: %r' % e) + luci_log.debug_verbose('ND10: failed to set flags: %r %s' \ + % (e, str(e))) return True def nodeTaskProcess(self, model, request): @@ -3830,13 +3877,13 @@ raise Exception, 'rc is None' except RicciError, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('NTP3: ricci error from %s: %r' \ - % (nodename_resolved, e)) + luci_log.debug('NTP3: ricci error from %s: %r %s' \ + % (nodename_resolved, e, str(e))) return (False, {'errors': [ 'Unable to connect to the ricci agent on %s' % nodename_resolved ]}) except: if LUCI_DEBUG_MODE is True: - luci_log.debug('NTP4: ricci error from %s: %r' \ - % (nodename_resolved, e)) + luci_log.debug('NTP4: ricci error from %s: %r %s' \ + % (nodename_resolved, e, str(e))) return (False, {'errors': [ 'Unable to connect to the ricci agent on %s' % nodename_resolved ]}) cluinfo = rc.cluster_info() @@ -3957,13 +4004,13 @@ rc = RicciCommunicator(nodename_resolved) except RicciError, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GNL2: ricci error %s: %r' \ - % (nodename_resolved, e)) + luci_log.debug_verbose('GNL2: ricci error %s: %r %s' \ + % (nodename_resolved, e, str(e))) return 'Ricci error while getting logs for %s' % nodename_resolved except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GNL3: unexpected exception for %s: %r' \ - % (nodename_resolved, e)) + luci_log.debug_verbose('GNL3: unexpected exception for %s: %r %s' \ + % (nodename_resolved, e, str(e))) return 'Ricci error while getting logs for %s' % nodename_resolved if not rc.authed(): @@ -3972,7 +4019,8 @@ setNodeStatus(snode, CLUSTER_NODE_NEED_AUTH) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GNL4: %s: %r' % (nodename_resolved, e)) + luci_log.debug_verbose('GNL4: %s: %r %s' \ + % (nodename_resolved, e, str(e))) if clustername: try: @@ -3980,8 +4028,8 @@ setNodeStatus(cnode, CLUSTER_NODE_NEED_AUTH) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GNL5: %s: %r' \ - % (nodename_resolved, e)) + luci_log.debug_verbose('GNL5: %s: %r %s' \ + % (nodename_resolved, e, str(e))) return 'Luci is not authenticated to node %s. Please reauthenticate first' % nodename return rq.getNodeLogs(rc) @@ -4015,7 +4063,7 @@ raise Exception, 'clusterfolder is None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ICB1: cluster %s [%s] folder missing: %r -- returning empty map' % (cluname, path, e)) + luci_log.debug_verbose('ICB1: cluster %s [%s] folder missing: %r %s -- returning empty map' % (cluname, path, e, str(e))) return busy_map except: if LUCI_DEBUG_MODE is True: @@ -4030,7 +4078,7 @@ return busy_map except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug('ICB4: An error occurred while looking for cluster %s flags at path %s: %r' % (cluname, path, e)) + luci_log.debug('ICB4: An error occurred while looking for cluster %s flags at path %s: %r %s' % (cluname, path, e, str(e))) return busy_map except: if LUCI_DEBUG_MODE is True: @@ -4087,7 +4135,8 @@ except Exception, e: rc = None if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ICB7: RC: %s: %r' % (cluname, e)) + luci_log.debug_verbose('ICB7: RC: %s: %r %s' \ + % (cluname, e, str(e))) batch_id = None if rc is not None: @@ -4098,7 +4147,7 @@ % (batch_id, item[0])) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ICB8B: failed to get batch_id from %s: %r' % (item[0], e)) + luci_log.debug_verbose('ICB8B: failed to get batch_id from %s: %r %s' % (item[0], e, str(e))) if batch_id is not None: try: @@ -4118,7 +4167,7 @@ luci_log.debug_verbose('ICB9: batch_xml for cluster is None') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ICB9A: error getting batch_xml from rc.batch_report: %r' % e) + luci_log.debug_verbose('ICB9A: error getting batch_xml from rc.batch_report: %r %s' % (e, str(e))) # No contact with ricci (-1000) creation_status = RICCI_CONNECT_FAILURE # set to avoid next if statement @@ -4220,8 +4269,8 @@ clusterfolder.manage_delObjects([item[0]]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ICB14: delObjects: %s: %r' \ - % (item[0], e)) + luci_log.debug_verbose('ICB14: delObjects: %s: %r %s' \ + % (item[0], e, str(e))) nodereports.append(node_report) continue @@ -4238,8 +4287,8 @@ clusterfolder.manage_delObjects([item[0]]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.info('ICB15: Unable to delete %s: %r' \ - % (item[0], e)) + luci_log.info('ICB15: Unable to delete %s: %r %s' \ + % (item[0], e, str(e))) continue else: busy_map['busy'] = 'true' @@ -4254,7 +4303,7 @@ item[1].manage_addProperty(LAST_STATUS, creation_status, 'int') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ICB16: last_status err: %s %d: %r' % (item[0], creation_status, e)) + luci_log.debug_verbose('ICB16: last_status err: %s %d: %r %s' % (item[0], creation_status, e, str(e))) continue else: node_report = {} @@ -4269,8 +4318,8 @@ finished = -1 err_msg = '' if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('ICB15: ricci error: %s: %r' \ - % (ricci[0], e)) + luci_log.debug_verbose('ICB15: ricci error: %s: %r %s' \ + % (ricci[0], e, str(e))) if rc is not None: batch_res = rq.checkBatch(rc, item[1].getProperty(BATCH_ID)) @@ -4293,8 +4342,8 @@ clusterfolder.manage_delObjects([item[0]]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.info('ICB16: Unable to delete %s: %r' \ - % (item[0], e)) + luci_log.info('ICB16: Unable to delete %s: %r %s' \ + % (item[0], e, str(e))) else: node_report = {} busy_map['busy'] = 'true' @@ -4348,7 +4397,8 @@ model = request.SESSION.get('model') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delService0: no model: %r' % e) + luci_log.debug_verbose('delService0: no model: %r %s' \ + % (e, str(e))) return (False, {'errors': [ errstr ] }) name = None @@ -4391,14 +4441,15 @@ raise Exception, 'unable to determine the hostname of the ricci agent' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delService4: %s: %r' % (errstr, e)) + luci_log.debug_verbose('delService4: %s: %r %s' \ + % (errstr, e, str(e))) return (False, {'errors': [ '%s: unable to find a Ricci agent for this cluster' % errstr ]}) try: model.deleteService(name) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delService5: Unable to find a service named %s for cluster %s: %r' % (name, clustername, e)) + luci_log.debug_verbose('delService5: Unable to find a service named %s for cluster %s: %r %s' % (name, clustername, e, str(e))) return (False, {'errors': [ '%s: error removing service "%s."' % (errstr, name) ]}) try: @@ -4408,7 +4459,7 @@ raise Exception, 'model string is blank' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delService6: exportModelAsString failed: %r' % e) + luci_log.debug_verbose('delService6: exportModelAsString failed: %r %s' % (e, str(e))) return (False, {'errors': [ '%s: error removing service "%s."' % (errstr, name) ]}) batch_number, result = rq.setClusterConf(rc, str(conf)) @@ -4421,7 +4472,8 @@ set_node_flag(self, clustername, ragent, str(batch_number), SERVICE_DELETE, 'Removing service "%s"' % name) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delService8: failed to set flags: %r' % e) + luci_log.debug_verbose('delService8: failed to set flags: %r %s' \ + % (e, str(e))) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \ @@ -4434,7 +4486,8 @@ model = request.SESSION.get('model') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delResource0: no model: %r' % e) + luci_log.debug_verbose('delResource0: no model: %r %s' \ + % (e, str(e))) return errstr name = None @@ -4471,7 +4524,8 @@ raise Exception, 'unable to determine the hostname of the ricci agent' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delResource3: %s: %r' % (errstr, e)) + luci_log.debug_verbose('delResource3: %s: %r %s' \ + % (errstr, e, str(e))) return '%s: could not determine the ricci agent hostname' % errstr resPtr = model.getResourcesPtr() @@ -4509,7 +4563,8 @@ set_node_flag(self, clustername, ragent, str(batch_number), RESOURCE_REMOVE, 'Removing resource "%s"' % request['resourcename']) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delResource7: failed to set flags: %r' % e) + luci_log.debug_verbose('delResource7: failed to set flags: %r %s' \ + % (e, str(e))) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \ @@ -4532,7 +4587,7 @@ model.getResourcesPtr().addChild(res) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('addResource2: %r' % e) + luci_log.debug_verbose('addResource2: %r %s' % (e, str(e))) return 'Unable to add the new resource' try: @@ -4542,7 +4597,8 @@ raise Exception, 'model string for %s is blank' % clustername except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('addResource3: exportModelAsString: %r' % e) + luci_log.debug_verbose('addResource3: exportModelAsString: %r %s' \ + % (e, str(e))) return 'An error occurred while adding this resource' try: @@ -4559,7 +4615,7 @@ raise Exception, 'unable to save the new cluster configuration' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('addResource6: %r' % e) + luci_log.debug_verbose('addResource6: %r %s' % (e, str(e))) return 'An error occurred while propagating the new cluster.conf: %s' % str(e) try: @@ -4576,7 +4632,8 @@ set_node_flag(self, clustername, ragent, str(batch_number), action_type, action_str) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('addResource7: failed to set flags: %r' % e) + luci_log.debug_verbose('addResource7: failed to set flags: %r %s' \ + % (e, str(e))) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' --- conga/luci/site/luci/Extensions/homebase_adapters.py 2007/05/18 02:36:59 1.50.2.5 +++ conga/luci/site/luci/Extensions/homebase_adapters.py 2007/05/18 05:23:55 1.50.2.6 @@ -77,7 +77,7 @@ raise Exception, 'user %s does not exist' % userId except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VDU0: %s: %r' % (userId, e)) + luci_log.debug_verbose('VDU0: %s: %r %s' % (userId, e, str(e))) return (False, {'errors': [ 'No such user: "%s"' % userId ] }) for i in getClusters(self): @@ -85,7 +85,8 @@ i[1].manage_delLocalRoles([ userId ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VDU1: %s %s: %r' % (userId, i[0], e)) + luci_log.debug_verbose('VDU1: %s %s: %r %s' \ + % (userId, i[0], e, str(e))) errors.append('Error deleting roles from cluster "%s" for user "%s"' \ % (i[0], userId)) @@ -94,14 +95,16 @@ i[1].manage_delLocalRoles([ userId ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VDU2: %s: %r' % (userId, i[0], e)) + luci_log.debug_verbose('VDU2: %s: %r %s' \ + % (userId, i[0], e, str(e))) errors.append('Error deleting roles from storage system "%s" for user "%s"' % (i[0], userId)) try: self.acl_users.userFolderDelUsers([ userId ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VDU3: %s %r' % (userId, e)) + luci_log.debug_verbose('VDU3: %s %r %s' \ + % (userId, e, str(e))) errors.append('Unable to delete user "%s"' % userId) return (False, {'errors': errors }) @@ -133,7 +136,7 @@ self.portal_registration.addMember(user, passwd, properties = { 'username': user, 'password': passwd, 'confirm': passwd, 'roles': [ 'Member' ], 'domains': [], 'email': '%s at conga.example.com' % user }) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VAU0: %s: %r' % (user, e)) + luci_log.debug_verbose('VAU0: %s: %r %s' % (user, e, str(e))) return (False, { 'errors': [ 'Unable to add new user "%s"' % user ] }) if not self.portal_membership.getMemberById(user): @@ -160,7 +163,7 @@ cur_host = sysData[0] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vACI0: %r' % e) + luci_log.debug_verbose('vACI0: %r %s' % (e, str(e))) return (False, { 'errors': [ 'You must provide the address of at least one node in the cluster you wish to add.' ]}) cur_entry = { 'host': cur_host } @@ -212,7 +215,7 @@ cur_entry['fp'] = cur_fp[1] except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vACI2: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('vACI2: %s: %r %s' % (cur_host, e, str(e))) request.SESSION.set('add_cluster_initial', cur_entry) return (False, { 'errors': [ 'Unable to establish a connection to the ricci agent on %s: %s' % (cur_host, str(e)) ] }) @@ -231,7 +234,8 @@ rc.trust() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vACI3: %s %r' % (cur_host, e)) + luci_log.debug_verbose('vACI3: %s %r %s' \ + % (cur_host, e, str(e))) request.SESSION.set('add_cluster_initial', cur_entry) return (False, { 'errors': [ 'Unable to establish trust for host %s' % (cur_host, str(e)) ] }) elif check_certs: @@ -260,7 +264,7 @@ cur_entry['trusted'] = rc.trusted() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vACI4: %s %r' % (cur_host, e)) + luci_log.debug_verbose('vACI4: %s %r %s' % (cur_host, e, str(e))) request.SESSION.set('add_cluster_initial', cur_entry) return (False, { 'errors': [ 'Unable to connect to the ricci agent on %s' % cur_host ] }) @@ -272,7 +276,8 @@ raise Exception, 'authentication failed' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vACI5: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('vACI5: %s: %r %s' \ + % (cur_host, e, str(e))) request.SESSION.set('add_cluster_initial', cur_entry) return (False, { 'errors': [ 'Unable to authenticate to the ricci agent on "%s"' % cur_host ] }) @@ -280,10 +285,15 @@ try: cluster_info = rc.cluster_info() - except: + except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('vACI5aa: %s: %r %s' % (cur_host, e, str(e))) cluster_info = None if not cluster_info or not cluster_info[0]: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('vACI5a0: no cluster info') + if not prev_auth: try: rc.unauth() @@ -298,26 +308,11 @@ cluster_name = cluster_info[0] - cluster_os = resolveOSType(rc.os()) - if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('vACI5a: cluster os is %s (%s)' \ - % (cluster_os, rc.os())) - - try: - cluster_conf = getClusterConf(rc) - except: - cluster_conf = None - - if cluster_conf: - try: - node_list = getClusterConfNodes(cluster_conf) - except: - node_list = None - # Make sure a cluster with this name is not already managed before # going any further. try: - dummy = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, cluster_name)) + dummy = self.restrictedTraverse('%s%s' \ + % (CLUSTER_FOLDER_PATH, cluster_name)) if not dummy: raise Exception, 'no existing cluster' errors.append('A cluster named "%s" is already managed.') @@ -330,6 +325,28 @@ except: pass + cluster_os = resolveOSType(rc.os()) + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('vACI5a: cluster os is %s (%s)' \ + % (cluster_os, rc.os())) + + try: + cluster_conf = getClusterConf(rc) + except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('vACI5a1: no cluster.conf: %r %s' \ + % (e, str(e))) + cluster_conf = None + + if cluster_conf: + try: + node_list = getClusterConfNodes(cluster_conf) + except Exception, e: + if LUCI_DEBUG_MODE is True: + luci_log.debug_verbose('vACI5b: no node list: %r %s' \ + % (e, str(e))) + node_list = None + if not cluster_conf or not node_list or len(node_list) < 1: if not prev_auth: try: @@ -340,24 +357,28 @@ same_node_passwds = False try: - same_node_passwds = 'allSameCheckBox' in request.form + same_node_passwds = request.form.has_key('allSameCheckBox') except: same_node_passwds = False - add_cluster = { 'name': cluster_name, - 'nodes': {}, - 'cluster_os':cluster_os, - 'pass': 0, - 'identical_passwds': same_node_passwds, - 'check_certs': check_certs } + add_cluster = { + 'name': cluster_name, + 'nodes': {}, + 'cluster_os': cluster_os, + 'pass': 0, + 'identical_passwds': same_node_passwds, + 'check_certs': check_certs + } for i in node_list: cur_node = { 'host': i } - if same_node_passwds: + if same_node_passwds is True: cur_node['passwd'] = cur_pass add_cluster['nodes'][i] = cur_node + request.SESSION.set('add_cluster', add_cluster) - request.response.redirect('/luci/homebase/index_html?pagetype=%s' % HOMEBASE_ADD_CLUSTER) + request.response.redirect('/luci/homebase/index_html?pagetype=%s' \ + % HOMEBASE_ADD_CLUSTER) def parseHostForm(request, check_certs): errors = list() @@ -368,7 +389,8 @@ num_storage = int(request.form['numStorage'].strip()) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PHF1: numStorage field missing: %r' % e) + luci_log.debug_verbose('PHF1: numStorage field missing: %r %s' \ + % (e, str(e))) errors.append('The number of systems entered could not be determined.') trust_shown = False @@ -453,7 +475,8 @@ pass errors.append('Unable to retrieve the SSL fingerprint for node %s: %s' % (cur_host, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PHF2: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('PHF2: %s: %r %s' \ + % (cur_host, e, str(e))) else: try: rc = RicciCommunicator(cur_host, enforce_trust=False) @@ -480,7 +503,8 @@ pass errors.append('Unable to add the key for node %s to the trusted keys list.' % cur_host) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('PHF3: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('PHF3: %s: %r %s' \ + % (cur_host, e, str(e))) system_list[cur_host] = cur_system i += 1 @@ -548,7 +572,8 @@ incomplete = True cur_system['errors'] = True if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VAC2: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VAC2: %s: %r %s' \ + % (cur_host, e, str(e))) continue try: @@ -561,7 +586,8 @@ incomplete = True cur_system['errors'] = True if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VAC3: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VAC3: %s: %r %s' \ + % (cur_host, e, str(e))) continue cluster_info = rc.cluster_info() @@ -585,7 +611,8 @@ rc.unauth() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VAC4: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VAC4: %s: %r %s' \ + % (cur_host, e, str(e))) errors.append(err_msg) if LUCI_DEBUG_MODE is True: @@ -605,7 +632,8 @@ rc.unauth() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VAC6: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('VAC6: %s: %r %s' \ + % (cur_host, e, str(e))) err_msg = 'Node %s reports its cluster version is %s and we expect %s' \ % (cur_host, cur_os, cluster_os) @@ -688,7 +716,7 @@ request.SESSION.set('add_systems', add_systems) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateSA2: %r' % e) + luci_log.debug_verbose('validateSA2: %r %s' % (e, str(e))) return_code = False else: try: @@ -718,7 +746,8 @@ user_id = user.getUserId() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VP1: no user "%s": %r' % (username, e)) + luci_log.debug_verbose('VP1: no user "%s": %r %s' \ + % (username, e, str(e))) errors.append('An invalid user "%s" was given' % username) if len(errors) > 0: @@ -739,7 +768,8 @@ messages.append('Removed permission for user "%s" for cluster "%s"' % (user_id, i[0])) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VP2: %s %s: %r' % (user_id, i[0], e)) + luci_log.debug_verbose('VP2: %s %s: %r %s' \ + % (user_id, i[0], e, str(e))) errors.append('Failed to remove permission for user "%s" for cluster "%s"' % (user_id, i[0])) else: for i in clusters: @@ -752,7 +782,8 @@ messages.append('Added permission for user "%s" for cluster "%s"' % (user_id, i[0])) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VP3: %s %s %r' % (user_id, i[0], e)) + luci_log.debug_verbose('VP3: %s %s %r %s' \ + % (user_id, i[0], e, str(e))) errors.append('Failed to add permission for user "%s" for cluster "%s"' % (user_id, i[0])) else: try: @@ -768,7 +799,8 @@ messages.append('Removed permission for user "%s" for cluster "%s"' % (user_id, i[0])) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VP4: %s %s %r' % (user_id, i[0], e)) + luci_log.debug_verbose('VP4: %s %s %r %s' \ + % (user_id, i[0], e, str(e))) errors.append('Failed to remove permission for user "%s" for cluster "%s"' % (user_id, i[0])) @@ -849,7 +881,8 @@ raise Exception, 'connection failed' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateAuth0: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('validateAuth0: %s: %r %s' \ + % (cur_host, e, str(e))) errors.append('Unable to communicate with the ricci agent on %s: %s' \ % (cur_host, str(e))) incomplete = True @@ -878,7 +911,8 @@ except Exception, e: errors.append('Unable to authenticate to %s: %s' % (cur_host, str(e))) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateAuth1: %s: %r' % (cur_host, e)) + luci_log.debug_verbose('validateAuth1: %s: %r %s' \ + % (cur_host, e, str(e))) incomplete = True cur_system['error'] = True @@ -893,7 +927,8 @@ request.SESSION.set('auth_systems', system_list) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('validateAuthenticate2: %r' % e) + luci_log.debug_verbose('validateAuthenticate2: %r' \ + % (e, str(e))) else: try: request.SESSION.delete('auth_systems') @@ -1150,7 +1185,7 @@ i = rc.authed() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CS3 %s: %r' % (host, e)) + luci_log.debug_verbose('CS3 %s: %r %s' % (host, e, str(e))) return 'Unable to authenticate to the ricci agent on %s' % host if i is not True: @@ -1168,7 +1203,7 @@ ssystem = self.restrictedTraverse(STORAGE_FOLDER_PATH) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CS5 %s: %r' % (host, e)) + luci_log.debug_verbose('CS5 %s: %r %s' % (host, e, str(e))) return 'Unable to create storage system %s: %s' % host try: @@ -1176,7 +1211,7 @@ newSystem = self.restrictedTraverse('%s%s' % (STORAGE_FOLDER_PATH, host)) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CS6 %s: %r' % (host, e)) + luci_log.debug_verbose('CS6 %s: %r %s' % (host, e, str(e))) return 'Unable to create DB entry for storage system %s' % host try: @@ -1184,7 +1219,7 @@ newSystem.manage_role('View', ['Access contents information', 'View']) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('CS7 %s: %r' % (host, e)) + luci_log.debug_verbose('CS7 %s: %r %s' % (host, e, str(e))) return 'Unable to set permissions on storage system %s' % host return None @@ -1203,7 +1238,8 @@ user = members[0].getUserName() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getDefaultUser0: %r' % e) + luci_log.debug_verbose('getDefaultUser0: %r %s' \ + % (e, str(e))) user = None if not user: @@ -1222,7 +1258,7 @@ members.sort() except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getUserPerms0: %r' % e) + luci_log.debug_verbose('getUserPerms0: %r %s' % (e, str(e))) return {} for i in members: @@ -1237,7 +1273,8 @@ storage = self.restrictedTraverse('%s/systems/storage/objectItems' % PLONE_ROOT)('Folder') except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getUserPerms1: user %s: %r' % (userName, e)) + luci_log.debug_verbose('getUserPerms1: user %s: %r %s' \ + % (userName, e, str(e))) continue for c in clusters: @@ -1245,18 +1282,16 @@ perms[userName]['cluster'][c[0]] = i.has_role('View', c[1]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getUserPerms2: user %s, obj %s: %r' \ - % (userName, c[0], e)) + luci_log.debug_verbose('getUserPerms2: user %s, obj %s: %r %s' % (userName, c[0], e, str(e))) for s in storage: try: perms[userName]['storage'][s[0]] = i.has_role('View', s[1]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('getUserPerms2: user %s, obj %s: %r' \ - % (userName, s[0], e)) + luci_log.debug_verbose('getUserPerms2: user %s, obj %s: %r %s' % (userName, s[0], e, str(e))) return perms def getClusterConfNodes(conf_dom): - cluster_nodes = conf_dom.getElementsByTagName('clusternodes') - return (lambda x: str(x.getAttribute('name')), cluster_nodes) + cluster_nodes = conf_dom.getElementsByTagName('clusternode') + return map(lambda x: str(x.getAttribute('name')), cluster_nodes) --- conga/luci/site/luci/Extensions/ricci_communicator.py 2007/05/15 21:42:21 1.25.2.4 +++ conga/luci/site/luci/Extensions/ricci_communicator.py 2007/05/18 05:23:55 1.25.2.5 @@ -439,8 +439,8 @@ luci_log.debug_verbose('RC:BS1: Returning (%d, %d) for batch_status("%s")' % (last, total, batch_xml.toxml())) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('RC:BS2: error %r: (last, total)' % \ - (e, last, total)) + luci_log.debug_verbose('RC:BS2: error %r %s: (last, total)' \ + % (e, str(e), last, total)) return (last, total) # extract error_code from module's response --- conga/luci/site/luci/Extensions/system_adapters.py 2007/05/15 21:42:21 1.2.2.3 +++ conga/luci/site/luci/Extensions/system_adapters.py 2007/05/18 05:23:55 1.2.2.4 @@ -20,7 +20,7 @@ raise Exception, 'None' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GSSL0: %s: %r' % (hostname, e)) + luci_log.debug_verbose('GSSL0: %s: %r %s' % (hostname, e, str(e))) return [] service_list = list_services(rc) @@ -84,7 +84,7 @@ raise Exception, 'unknown error' except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VSU0: %s: %r' % (hostname, e)) + luci_log.debug_verbose('VSU0: %s: %r %s' % (hostname, e, str(e))) return (False, {'errors': [ 'Unable to connect to the ricci agent on %s: %s' % (hostname, str(e)) ]}) sys_svc_list = list() @@ -97,7 +97,7 @@ sys_svc_list.append(svc_name) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VSU1: %s: %r' % (hostname, e)) + luci_log.debug_verbose('VSU1: %s: %r %s' % (hostname, e, str(e))) return (False, {'errors': [ 'Unable to retrieve the list of services from %s' % hostname ]}) try: @@ -148,7 +148,7 @@ ret = svc_manage(rc, hostname, servicename, op) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VMS0: %r' % e) + luci_log.debug_verbose('VMS0: %r %s' % (e, str(e))) result.setAttribute('message', str(e)) ret.appendChild(result) else: