From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 18 May 2007 02:37:05 -0000 Subject: [Cluster-devel] conga/luci cluster/form-macros homebase/form-m ... Message-ID: <20070518023705.22484.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 02:37:00 Modified files: luci/cluster : form-macros luci/homebase : form-macros validate_cluster_add.js luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py LuciSyslog.py LuciZopePerm.py RicciQueries.py StorageReport.py cluster_adapters.py homebase_adapters.py luci/storage : form-chooser validate_html luci/test : CGA_0200_Create_cluster.py Added files: luci/site/luci/Extensions: LuciZopeExternal.py Log message: More cleanup and refactor. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.198.2.1&r2=1.198.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.56&r2=1.56.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.8&r2=1.8.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=NONE&r2=1.1.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.4&r2=1.1.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.7&r2=1.1.2.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciSyslog.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.11.4.2&r2=1.11.4.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopePerm.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.1&r2=1.1.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.3&r2=1.1.2.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.23.2.3&r2=1.23.2.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.6&r2=1.255.2.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.50.2.4&r2=1.50.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-chooser.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.5&r2=1.5.8.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/validate_html.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.2&r2=1.2.8.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0200_Create_cluster.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.6&r2=1.6.2.1 --- conga/luci/cluster/form-macros 2007/05/03 20:16:37 1.198.2.1 +++ conga/luci/cluster/form-macros 2007/05/18 02:36:59 1.198.2.2 @@ -229,7 +229,7 @@
Cluster Name
@@ -3647,13 +3647,13 @@
+ global cur_cluster_name add_cluster/name | request/clustername | request/form/clustername | nothing">

Add a node to

- Cluster Name: - --- conga/luci/homebase/validate_cluster_add.js 2007/02/09 18:30:44 1.8 +++ conga/luci/homebase/validate_cluster_add.js 2007/05/18 02:36:59 1.8.2.1 @@ -4,22 +4,22 @@ if (!form) return (-1); - var clusterName = form.clusterName; - if (!clusterName || str_is_blank(clusterName.value)) { + var clustername = form.clustername; + if (!clustername || str_is_blank(clustername.value)) { errors.push('No cluster name was given.'); - set_form_err(form.clusterName); + set_form_err(form.clustername); } else { - clusterName = clusterName.value; - if (clusterName.length > 15) { + clustername = clustername.value; + if (clustername.length > 15) { errors.push('A cluster\'s name must be less than 16 characters long.'); - set_form_err(form.clusterName); + set_form_err(form.clustername); } else { - var invalid_chars = str_is_valid(clusterName, '/[0-9A-Za-z_. -]/g'); + var invalid_chars = str_is_valid(clustername, '/[0-9A-Za-z_. -]/g'); if (invalid_chars) { errors.push('The cluster name you gave contains the following invalid characters: "' + invalid_chars + '".'); - set_form_err(form.clusterName); + set_form_err(form.clustername); } else - clr_form_err(form.clusterName); + clr_form_err(form.clustername); } } @@ -38,9 +38,9 @@ if (!view_certs || !view_certs.checked) { var confirm_str = ''; if (form.addnode) - confirm_str = 'Add ' + (added_storage.length > 1 ? 'these nodes' : 'this node') + ' to the \"' + clusterName + '\" cluster?'; + confirm_str = 'Add ' + (added_storage.length > 1 ? 'these nodes' : 'this node') + ' to the \"' + clustername + '\" cluster?'; else - confirm_str = 'Add the cluster \"' + clusterName + '\" to the Luci management interface?'; + confirm_str = 'Add the cluster \"' + clustername + '\" to the Luci management interface?'; if (confirm(confirm_str)) form.submit(); --- conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/05/16 21:27:21 1.1.2.4 +++ conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/05/18 02:36:59 1.1.2.5 @@ -222,7 +222,7 @@ raise KeyError, 'is blank' except: try: - cluname = req.form['clusterName'] + cluname = req.form['clustername'] if not cluname: raise KeyError, 'is blank' except: @@ -351,7 +351,7 @@ raise KeyError, 'is blank' except KeyError, e: try: - cluname = req.form['clusterName'] + cluname = req.form['clustername'] if not cluname: raise except: @@ -574,7 +574,7 @@ cluname = req.form['clustername'] except: try: - cluname = req.form['clusterName'] + cluname = req.form['clustername'] except: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GCI0: unable to determine cluster name') @@ -972,7 +972,7 @@ raise KeyError, 'clustername is blank' except: try: - clustername = req.form['clusterName'] + clustername = req.form['clustername'] except: try: clustername = model.getClusterName() --- conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/05/16 21:27:21 1.1.2.7 +++ conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/05/18 02:36:59 1.1.2.8 @@ -6,7 +6,7 @@ # Free Software Foundation. from AccessControl import getSecurityManager -import RicciQuery as rq +import RicciQueries as rq from ricci_communicator import RicciCommunicator from LuciZopePerm import isAdmin from LuciSyslog import get_logger @@ -174,26 +174,26 @@ % (nodename, clustername)) return nodename -def resolveClusterChanges(self, clusterName, model): +def resolveClusterChanges(self, clustername, model): try: mb_nodes = model.getNodes() if not mb_nodes or not len(mb_nodes): 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)) - return 'Unable to find cluster nodes for %s' % clusterName + luci_log.debug_verbose('RCC0: no model builder nodes found for %s: %r' % (clustername, e)) + return 'Unable to find cluster nodes for %s' % clustername try: cluster_node = self.restrictedTraverse('%s/systems/cluster/%s' \ - % (PLONE_ROOT, clusterName)) + % (PLONE_ROOT, clustername)) if not cluster_node: 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)) - return 'Unable to find an entry for %s in the Luci database.' % clusterName + % (clustername, e)) + return 'Unable to find an entry for %s in the Luci database.' % clustername try: db_nodes = map(lambda x: x[0], cluster_node.objectItems('Folder')) @@ -203,7 +203,7 @@ # Should we just create them all? Can this even happen? if LUCI_DEBUG_MODE is True: luci_log.debug('RCC2: error: %r' % e) - return 'Unable to find database entries for any nodes in %s' % clusterName + 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 + '.' @@ -235,7 +235,7 @@ # new_node = cluster_node.restrictedTraverse(i) # #setNodeStatus(self, new_node, CLUSTER_NODE_NOT_MEMBER) cluster_node.delObjects([i]) - messages.append('Node "%s" is no longer in a member of cluster "%s." It has been deleted from the management interface for this cluster.' % (i, clusterName)) + messages.append('Node "%s" is no longer in a member of cluster "%s." It has been deleted from the management interface for this cluster.' % (i, clustername)) if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('VCC3: deleted node %s' % i) except Exception, e: @@ -248,17 +248,17 @@ cluster_node.manage_addFolder(i) new_node = cluster_node.restrictedTraverse(i) setNodeStatus(self, new_node, new_flags) - messages.append('A new cluster node, "%s," is now a member of cluster "%s." It has been added to the management interface for this cluster, but you must authenticate to it in order for it to be fully functional.' % (i, clusterName)) + messages.append('A new cluster node, "%s," is now a member of cluster "%s." It has been added to the management interface for this cluster, but you must authenticate to it in order for it to be fully functional.' % (i, clustername)) 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)) + 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)) + % (clustername, i, e)) return messages -def buildClusterCreateFlags(self, batch_map, clusterName): - path = '%s%s' % (CLUSTER_FOLDER_PATH, clusterName) +def buildClusterCreateFlags(self, batch_map, clustername): + path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername) try: clusterfolder = self.restrictedTraverse(path) @@ -282,14 +282,14 @@ flag.manage_addProperty(BATCH_ID, batch_id, 'string') flag.manage_addProperty(TASKTYPE, CLUSTER_ADD, 'string') - flag.manage_addProperty(FLAG_DESC, 'Creating node "%s" for cluster "%s"' % (key, clusterName), 'string') + flag.manage_addProperty(FLAG_DESC, 'Creating node "%s" for cluster "%s"' % (key, clustername), 'string') 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)) -def manageCluster(self, clusterName, node_list, cluster_os): - clusterName = str(clusterName) +def manageCluster(self, clustername, node_list, cluster_os): + clustername = str(clustername) try: clusters = self.restrictedTraverse(CLUSTER_FOLDER_PATH) @@ -297,72 +297,72 @@ 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)) - return 'Unable to create cluster %s: the cluster directory is missing.' % clusterName + luci_log.debug_verbose('MC0: %s: %r' % (clustername, e)) + return 'Unable to create cluster %s: the cluster directory is missing.' % clustername try: - newCluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clusterName)) + newCluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername)) if newCluster: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('MC1: cluster %s: already exists' \ - % clusterName) - return 'A cluster named %s is already managed by Luci' % clusterName + % clustername) + return 'A cluster named %s is already managed by Luci' % clustername except: pass try: - clusters.manage_addFolder(clusterName) - newCluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clusterName)) + clusters.manage_addFolder(clustername) + newCluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername)) if not newCluster: - raise Exception, 'unable to create the cluster DB entry for %s' % clusterName + 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' % (clustername, e)) + return 'Unable to create cluster %s: %r' % (clustername, 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' % (clustername, e)) try: - clusters.manage_delObjects([clusterName]) + 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' % (clustername, e)) + return 'Unable to set permissions on new cluster: %s: %r' % (clustername, 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)) + % (clustername, cluster_os, e)) for i in node_list: host = node_list[i]['host'] try: newCluster.manage_addFolder(host) - newSystem = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, clusterName, host)) + newSystem = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, host)) if not newSystem: raise Exception, 'unable to create cluster system DB entry for node %s' % host newSystem.manage_acquiredPermissions([]) newSystem.manage_role('View', [ 'Access contents information' , 'View' ]) except Exception, e: try: - clusters.manage_delObjects([clusterName]) + clusters.manage_delObjects([clustername]) except Exception, e: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('MC6: %s: %s: %r' \ - % (clusterName, host, e)) + % (clustername, host, e)) if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('MC7: %s: %s: %r' \ - % (clusterName, host, e)) + % (clustername, host, e)) return 'Unable to create cluster node %s for cluster %s: %r' \ - % (host, clusterName, e) + % (host, clustername, e) try: ssystem = self.restrictedTraverse(STORAGE_FOLDER_PATH) @@ -370,7 +370,7 @@ 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)) + luci_log.debug_verbose('MC8: %s: %s: %r' % (clustername, host, e)) return 'Error adding storage node %s: %r' % (host, e) # Only add storage systems if the cluster and cluster node DB @@ -393,17 +393,17 @@ except Exception, e: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('MC9: %s: %s: %r' \ - % (clusterName, host, e)) + % (clustername, host, e)) -def createClusterSystems(self, clusterName, node_list): +def createClusterSystems(self, clustername, node_list): try: - clusterObj = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clusterName)) + clusterObj = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername)) if not clusterObj: - raise Exception, 'cluster %s DB entry is missing' % clusterName + 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)) - return 'No cluster named "%s" is managed by Luci' % clusterName + luci_log.debug_verbose('CCS0: %s: %r' % (clustername, e)) + return 'No cluster named "%s" is managed by Luci' % clustername for x in node_list: i = node_list[x] @@ -414,10 +414,10 @@ except Exception, e: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('CCS0a: %s: %s: %r' \ - % (clusterName, host, e)) + % (clustername, host, e)) try: - newSystem = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, clusterName, host)) + newSystem = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, host)) if not newSystem: raise Exception, 'cluster node DB entry for %s disappeared from under us' % host newSystem.manage_acquiredPermissions([]) @@ -425,9 +425,9 @@ except Exception, e: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('CCS1: %s: %s: %r' \ - % (clusterName, host, e)) + % (clustername, host, e)) return 'Unable to create cluster node %s for cluster %s: %r' \ - % (host, clusterName, e) + % (host, clustername, e) try: ssystem = self.restrictedTraverse(STORAGE_FOLDER_PATH) @@ -436,7 +436,7 @@ 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' % (clustername, host, e)) return None # Only add storage systems if the and cluster node DB @@ -459,7 +459,7 @@ 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' % (clustername, host, e)) def delSystem(self, systemName): try: @@ -521,7 +521,7 @@ return 'Unable to delete storage system %s: %r' \ % (systemName, e) -def delCluster(self, clusterName): +def delCluster(self, clustername): try: clusters = self.restrictedTraverse(CLUSTER_FOLDER_PATH) if not clusters: @@ -529,18 +529,18 @@ except Exception, e: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('delCluster0: %r' % e) - return 'Unable to find cluster %s' % clusterName + return 'Unable to find cluster %s' % clustername - err = delClusterSystems(self, clusterName) + err = delClusterSystems(self, clustername) if err: return err try: - clusters.manage_delObjects([ clusterName ]) + clusters.manage_delObjects([ clustername ]) except Exception, e: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('delCluster1: %s %r' % (clusterName, e)) - return 'Unable to delete cluster %s' % clusterName + luci_log.debug_verbose('delCluster1: %s %r' % (clustername, e)) + return 'Unable to delete cluster %s' % clustername def delClusterSystem(self, cluster, systemName): try: @@ -562,14 +562,14 @@ luci_log.debug_verbose('delClusterSystem1: %s' % err_str) return err_str -def delClusterSystems(self, clusterName): +def delClusterSystems(self, clustername): try: - cluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clusterName)) + cluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername)) if not cluster: raise Exception, 'cluster DB entry is missing' try: - csystems = getClusterSystems(self, clusterName) + csystems = getClusterSystems(self, clustername) if not csystems or len(csystems) < 1: return None except Exception, e: @@ -579,7 +579,7 @@ except Exception, er: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('delCluSystems1: error for %s: %r' \ - % (clusterName, er)) + % (clustername, er)) return str(er) error_list = list() @@ -619,12 +619,12 @@ ret[2] = need_auth_hash return ret -def getClusterSystems(self, clusterName): +def getClusterSystems(self, clustername): try: - cluster_nodes = self.restrictedTraverse('%s%s/objectItems' % (CLUSTER_FOLDER_PATH, clusterName))('Folder') + 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' % (clustername, e)) return None if isAdmin(self): @@ -632,10 +632,10 @@ try: cluster = self.restrictedTraverse('%s%s/objectItems' \ - % (CLUSTER_FOLDER_PATH, clusterName)) + % (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' % (clustername, e)) return None if cluster_permission_check(self, cluster): --- conga/luci/site/luci/Extensions/LuciSyslog.py 2007/05/15 21:42:21 1.11.4.2 +++ conga/luci/site/luci/Extensions/LuciSyslog.py 2007/05/18 02:36:59 1.11.4.3 @@ -97,8 +97,6 @@ except: pass -luci_logc = None def get_logger(): - if luci_logc is None or luci_logc.initialized() is False: - luci_logc = LuciSyslog() + luci_logc = LuciSyslog() return luci_logc --- conga/luci/site/luci/Extensions/Attic/LuciZopePerm.py 2007/05/15 21:42:21 1.1.2.1 +++ conga/luci/site/luci/Extensions/Attic/LuciZopePerm.py 2007/05/18 02:36:59 1.1.2.2 @@ -23,13 +23,6 @@ pass return False -def userIsAdmin(self, userId): - try: - return self.portal_membership.getMemberById(userId).has_role('Owner', self.restrictedTraverse(PLONE_ROOT)) - except Exception, e: - pass - return False - # In case we want to give access to non-admin users in the future def havePermCreateCluster(self): --- conga/luci/site/luci/Extensions/Attic/RicciQueries.py 2007/05/15 21:42:21 1.1.2.3 +++ conga/luci/site/luci/Extensions/Attic/RicciQueries.py 2007/05/18 02:36:59 1.1.2.4 @@ -6,7 +6,6 @@ # Free Software Foundation. from xml.dom import minidom -from xml.dom.Node import ELEMENT_NODE from ricci_communicator import RicciCommunicator, extract_module_status from LuciSyslog import get_logger from conga_constants import LUCI_DEBUG_MODE @@ -657,60 +656,29 @@ if not bt_node: return None - mod_node = None - for node in bt_node.childNodes: - if node.nodeType == ELEMENT_NODE: - if node.nodeName == 'module': - mod_node = node - if not mod_node: - return None - - resp_node = None - for node in mod_node.childNodes: - if node.nodeType == ELEMENT_NODE: - resp_node = node - if not resp_node: - return None - - fr_node = None - for node in resp_node.childNodes: - if node.nodeType == ELEMENT_NODE: - fr_node = node - if not fr_node: - return None - - varnode = None - for node in fr_node.childNodes: - if node.nodeName == 'var': - varnode = node - break - if not varnode: - return None - - resultlist = list() - for node in varnode.childNodes: - if node.nodeName == 'service': - svchash = {} - try: - name = node.getAttribute('name') - if not name: - raise - except: - name = '[unknown]' - svchash['name'] = name - - try: - svc_enabled = node.getAttribute('enabled') - except: - svc_enabled = '[unknown]' - svchash['enabled'] = svc_enabled - - try: - running = node.getAttribute('running') - except: - running = '[unknown]' - svchash['running'] = running - resultlist.append(svchash) + svc_nodes = bt_node.getElementsByTagName('service') + for node in svc_nodes: + svchash = {} + try: + name = node.getAttribute('name') + if not name: + raise + except: + name = '[unknown]' + svchash['name'] = name + + try: + svc_enabled = node.getAttribute('enabled') + except: + svc_enabled = '[unknown]' + svchash['enabled'] = svc_enabled + + try: + running = node.getAttribute('running') + except: + running = '[unknown]' + svchash['running'] = running + resultlist.append(svchash) return resultlist --- conga/luci/site/luci/Extensions/StorageReport.py 2007/05/15 21:42:21 1.23.2.3 +++ conga/luci/site/luci/Extensions/StorageReport.py 2007/05/18 02:36:59 1.23.2.4 @@ -245,11 +245,7 @@ return 'Luci internal error. Please file bug report.' return 'should never come here' -def get_storage_report(ricci_comm, - session): - #print 'get_storage_report()' - #print ricci_comm, session - +def get_storage_report(ricci_comm, session): if ricci_comm is None: return None @@ -262,19 +258,9 @@ if session[SESSION_STORAGE_XML_REPORT].has_key(storagename): tmp_report = session[SESSION_STORAGE_XML_REPORT][storagename] if tmp_report is not None: - print 'using cached storage_xml_report' return StorageReport(tmp_report) - # retrieve storage report using ricci - print 'retrieving new storage_xml_report' - - #print ricci_comm.authenticated() - #print ricci_comm.cluster_info() - print ricci_comm.hostname() - print ricci_comm.os() - - # request doc = minidom.Document() batch = doc.createElement('batch') @@ -354,8 +340,6 @@ return StorageReport(xml_report) - - def get_content_data(self, storage_report, mapper_id, bd_path, content_id): bd_data = get_bd_data(self, storage_report, mapper_id, bd_path) for cont in bd_data['contents']: @@ -363,8 +347,6 @@ return cont return None - - def get_bd_data(self, storage_report, mapper_id, path): if storage_report is None or mapper_id is None: return None @@ -383,8 +365,6 @@ return mapper['snapshot_template'] return None - - def get_mappers_data(self, storage_report): ret_dir = {} # mappers @@ -420,8 +400,6 @@ return ret_dir - - def get_mapper_data(self, storage_report, mapper_id): if self is None or storage_report is None or mapper_id is None: return None --- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/05/16 21:27:21 1.255.2.6 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/05/18 02:36:59 1.255.2.7 @@ -61,15 +61,15 @@ except: download_pkgs = 1 - clusterName = None + clustername = None try: - clusterName = str(request.form['clusterName']) + clustername = str(request.form['clustername']) except Exception, e: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('PNC00: missing cluster name: %r' % e) - clusterName = None + clustername = None - if clusterName is None: + if clustername is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('PCN0: no cluster name was given') return (False, { 'errors': [ 'No cluster name was given' ]}) @@ -86,7 +86,7 @@ except: same_node_passwds = False - add_cluster = { 'name': clusterName, + add_cluster = { 'name': clustername, 'shared_storage': shared_storage, 'download_pkgs': download_pkgs, 'cluster_os': cluster_os, @@ -207,9 +207,9 @@ cluster_os = None add_cluster, incomplete, errors, messages = parseClusterNodes(self, request, cluster_os) - clusterName = add_cluster['name'] + clustername = add_cluster['name'] - if len(clusterName) > 15: + if len(clustername) > 15: errors.append('A cluster\'s name must be less than 16 characters long') try: @@ -258,8 +258,8 @@ node_list = add_cluster['nodes'].keys() batchNode = rq.createClusterBatch(add_cluster['cluster_os'], - clusterName, - clusterName, + clustername, + clustername, node_list, True, True, @@ -273,7 +273,7 @@ errors.append('Unable to generate cluster creation ricci command') return (False, { 'errors': errors, 'messages': messages }) - error = manageCluster(self, clusterName, add_cluster['nodes'], add_cluster['cluster_os']) + error = manageCluster(self, clustername, add_cluster['nodes'], add_cluster['cluster_os']) if error: errors.append('Unable to create the cluster Luci database objects') request.SESSION.set('create_cluster', add_cluster) @@ -308,10 +308,10 @@ return (False, { 'errors': errors, 'messages': messages }) continue - buildClusterCreateFlags(self, batch_id_map, clusterName) + buildClusterCreateFlags(self, batch_id_map, clustername) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \ - % (request['URL'], CLUSTER_CONFIG, clusterName)) + % (request['URL'], CLUSTER_CONFIG, clustername)) def validateAddClusterNode(self, request): import time @@ -340,13 +340,13 @@ except: cluster_os = None - clusterName = None + clustername = None try: - clusterName = str(request.form['clusterName']) + clustername = str(request.form['clustername']) except: - clusterName = None + clustername = None - if clusterName is None: + if clustername is None: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('VACN0: no cluster name was given') return (False, { 'errors': [ 'No cluster name was given' ]}) @@ -354,13 +354,13 @@ if cluster_os is None: cluster_folder = None try: - cluster_folder = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clusterName)) + cluster_folder = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername)) if not cluster_folder: 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)) - return (False, { 'errors': [ 'The database object for %s is missing' % clusterName ] }) + luci_log.debug_verbose('VACN1: %s: %r' % (clustername, e)) + return (False, { 'errors': [ 'The database object for %s is missing' % clustername ] }) try: cluster_os = cluster_folder.manage_getProperty('cluster_os') @@ -368,21 +368,21 @@ 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' % (clustername, e)) cluster_os = None if cluster_os is None: try: - cluster_ricci = getRicciAgent(self, clusterName) + cluster_ricci = getRicciAgent(self, clustername) 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' % (clustername, e)) cluster_os = None if cluster_os is None: if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('Unable to determine cluster OS for %s' % clusterName) + luci_log.debug_verbose('Unable to determine cluster OS for %s' % clustername) return (False, { 'errors': [ 'Unable to determine the version of the cluster suite this cluster is running' ] }) shared_storage = False @@ -397,7 +397,7 @@ except: same_node_passwds = False - add_cluster = { 'name': clusterName, + add_cluster = { 'name': clustername, 'shared_storage': shared_storage, 'download_pkgs': download_pkgs, 'cluster_os': cluster_os, @@ -501,14 +501,14 @@ return (False, { 'errors': errors, 'messages': messages }) try: - cluster_ricci = getRicciAgent(self, clusterName) + cluster_ricci = getRicciAgent(self, clustername) if not cluster_ricci: - raise Exception, 'Unable to find a ricci agent for %s' % clusterName + raise Exception, 'Unable to find a ricci agent for %s' % clustername except Exception, e: incomplete = True - errors.append('Unable to contact a ricci agent for %s' % clusterName) + 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' % (clustername, e)) if incomplete or len(errors) > 0: request.SESSION.set('add_node', add_cluster) @@ -518,8 +518,8 @@ model = getModelBuilder(None, cluster_ricci, cluster_ricci.dom0()) if not model: errors.append('Unable to build the cluster model for %s' \ - % clusterName) - raise Exception, 'unable to get model for %s' % clusterName + % clustername) + raise Exception, 'unable to get model for %s' % clustername nodesptr = model.getClusterNodesPtr() used_ids = {} @@ -529,11 +529,11 @@ if node_name in system_list: system_list[node_name]['errors'] = True errors.append('%s is already a member of %s' \ - % (node_name, clusterName)) + % (node_name, clustername)) except Exception, e: incomplete = True errors.append('Unable to build the cluster model for %s' \ - % clusterName) + % clustername) if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('VACN11: %r' % e) @@ -548,7 +548,7 @@ i = system_list[x] try: - batch_node = rq.addClusterNodeBatch(clusterName, + batch_node = rq.addClusterNodeBatch(clustername, True, True, shared_storage, @@ -619,7 +619,7 @@ except Exception, e: incomplete = True errors.append('Unable to update the cluster node list for %s' \ - % clusterName) + % clustername) if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('VACN15: %r' % e) @@ -627,12 +627,12 @@ request.SESSION.set('add_node', add_cluster) return (False, { 'errors': errors, 'messages': messages }) - error = createClusterSystems(self, clusterName, system_list) + error = createClusterSystems(self, clustername, system_list) if error: incomplete = True errors.append(error) if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('VACN16: %s: %s' % (clusterName, error)) + luci_log.debug_verbose('VACN16: %s: %s' % (clustername, error)) if incomplete or len(errors) > 0: request.SESSION.set('add_node', add_cluster) @@ -674,11 +674,11 @@ request.SESSION.set('add_node', add_cluster) return (False, { 'errors': errors, 'messages': messages }) - buildClusterCreateFlags(self, batch_id_map, clusterName) + buildClusterCreateFlags(self, batch_id_map, clustername) response = request.RESPONSE response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \ - % (request['URL'], CLUSTER_CONFIG, clusterName)) + % (request['URL'], CLUSTER_CONFIG, clustername)) def validateServiceAdd(self, request): errors = list() @@ -3104,7 +3104,7 @@ raise except: try: - clustername = req.form['clusterName'] + clustername = req.form['clustername'] if not clustername: clustername = None except: @@ -3938,7 +3938,7 @@ clustername = request['clustername'] except KeyError, e: try: - clustername = request.form['clusterName'] + clustername = request.form['clustername'] if not clustername: raise except: @@ -4001,7 +4001,7 @@ cluname = req.form['clustername'] except: try: - cluname = req.form['clusterName'] + cluname = req.form['clustername'] except: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('ICB0: No cluster name -- returning empty map') --- conga/luci/site/luci/Extensions/homebase_adapters.py 2007/05/15 21:42:21 1.50.2.4 +++ conga/luci/site/luci/Extensions/homebase_adapters.py 2007/05/18 02:36:59 1.50.2.5 @@ -496,7 +496,7 @@ pass try: - cluster_name = request.form['clusterName'].strip() + cluster_name = request.form['clustername'].strip() except: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('VAC0: no cluster name') --- conga/luci/storage/form-chooser 2006/10/15 22:34:54 1.5 +++ conga/luci/storage/form-chooser 2007/05/18 02:37:00 1.5.8.1 @@ -7,9 +7,9 @@ + tal:define="global preferred_size_units python:here.set_persistent_var('preferred_size_units', 'GB')"/> + tal:define="global preferred_path_display python:here.set_persistent_var('preferred_path_display', 'path')"/>