[Cluster-devel] conga/luci/site/luci/Extensions LuciClusterInf ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Fri Jun 8 18:27:02 UTC 2007
CVSROOT: /cvs/cluster
Module name: conga
Branch: EXPERIMENTAL
Changes by: rmccabe at sourceware.org 2007-06-08 18:27:00
Modified files:
luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py
ResourceHandler.py
cluster_adapters.py
luci/site/luci/Extensions/ClusterModel: Cluster.py
ModelBuilder.py
TagObject.py
Log message:
Bug fixes and cleanups
Patches:
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.8&r2=1.1.2.9
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.15&r2=1.1.2.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ResourceHandler.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/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.13&r2=1.255.2.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/Cluster.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/ClusterModel/ModelBuilder.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/ClusterModel/TagObject.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.3&r2=1.1.2.4
--- conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/06/07 06:41:05 1.1.2.8
+++ conga/luci/site/luci/Extensions/Attic/LuciClusterInfo.py 2007/06/08 18:27:00 1.1.2.9
@@ -62,6 +62,10 @@
return res_info
def getResources(model):
+ if model is None:
+ if LUCI_DEBUG_MODE is True:
+ luci_log.debug_verbose('getResources0: model is none')
+ return []
return map(lambda x: getResourcesInfo(model, None, x), model.getResources())
def getClusterStatusModel(model):
@@ -1060,7 +1064,10 @@
fence_map = {}
fencename = request['fencename']
+ nodes = model.getNodes()
fencedevs = model.getFenceDevices()
+ clustername = model.getClusterName()
+
for fencedev in fencedevs:
if fencedev.getName().strip() == fencename:
fence_map = fencedev.getAttributes()
@@ -1071,7 +1078,7 @@
fence_map['pretty_name'] = fencedev.getAgentType()
nodes_used = list()
- for node in model.getNodes():
+ for node in nodes:
flevels = node.getFenceLevels()
for flevel in flevels:
# These are the method blocks...
@@ -1087,7 +1094,6 @@
if found_duplicate is True:
continue
baseurl = request['URL']
- clustername = model.getClusterName()
node_hash = {}
cur_nodename = node.getName().strip()
node_hash['nodename'] = cur_nodename
@@ -1109,24 +1115,17 @@
def getFenceInfo(self, model, request):
if not model:
if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('getFenceInfo00: model is None')
+ luci_log.debug_verbose('getFenceInfo0: model is None')
return {}
- try:
- clustername = request['clustername']
- except:
- try:
- clustername = request.form['clustername']
- except:
- if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('getFenceInfo0: unable to determine cluster name')
- return {}
+ fvars = GetReqVars(request, [ 'clustername', 'URL', 'nodename' ])
+ baseurl = fvars['URL'] or LUCI_CLUSTER_BASE_URL
+ clustername = fvars['clustername'] or model.getClusterName()
- try:
- baseurl = request['URL']
- except Exception, e:
+ nodename = fvars['nodename']
+ if nodename is None:
if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('getFenceInfo1: no request.URL')
+ luci_log.debug_verbose('getFenceInfo1: no nodename')
return {}
fence_map = {}
@@ -1142,16 +1141,6 @@
major_num = 1
minor_num = 100
- try:
- nodename = request['nodename']
- except:
- try:
- nodename = request.form['nodename']
- except:
- if LUCI_DEBUG_MODE is True:
- 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
# Each level has its own list of fence devs used in that level
# For each fence dev, a list of instance structs is appended
--- conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/06/07 06:41:05 1.1.2.15
+++ conga/luci/site/luci/Extensions/Attic/LuciDB.py 2007/06/08 18:27:00 1.1.2.16
@@ -12,7 +12,7 @@
from LuciSyslog import get_logger
from conga_constants import CLUSTER_FOLDER_PATH, BATCH_ID, TASKTYPE, \
- FLAG_DESC, CLUSTER_ADD, LAST_STATUS, PLONE_ROOT, \
+ FLAG_DESC, CLUSTER_ADD, LAST_STATUS, \
STORAGE_FOLDER_PATH, LUCI_DEBUG_MODE
# Cluster node exception attribute flags
@@ -24,8 +24,8 @@
def getClusterNode(self, nodename, clustername):
try:
- cluster_node = self.restrictedTraverse('%s%s/%s' \
- % (CLUSTER_FOLDER_PATH, clustername, nodename))
+ path = str('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, nodename))
+ cluster_node = self.restrictedTraverse(path)
if not cluster_node:
return None
return cluster_node
@@ -37,10 +37,10 @@
def getStorageNode(self, nodename):
try:
- storage_node = self.restrictedTraverse('%s%s' \
- % (STORAGE_FOLDER_PATH, nodename))
+ path = str('%s%s' % (STORAGE_FOLDER_PATH, nodename))
+ storage_node = self.restrictedTraverse(path)
if not storage_node:
- return None
+ raise Exception, 'no storage node found'
return storage_node
except Exception, e:
if LUCI_DEBUG_MODE is True:
@@ -86,7 +86,7 @@
% (e, str(e)))
def set_node_flag(self, cluname, agent, batchid, task, desc):
- path = '%s%s' % (CLUSTER_FOLDER_PATH, cluname)
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, cluname))
batch_id = str(batchid)
objname = '%s____flag' % agent
@@ -94,7 +94,7 @@
try:
clusterfolder = self.restrictedTraverse(path)
clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
- objpath = '%s%s' % (path, objname)
+ objpath = str('%s%s' % (path, objname))
flag = self.restrictedTraverse(objpath)
flag.manage_addProperty(BATCH_ID, batch_id, 'string')
flag.manage_addProperty(TASKTYPE, task, 'string')
@@ -108,7 +108,7 @@
def NodeBusy(self, clustername, nodename, rc=None):
try:
- path = '%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, nodename)
+ path = str('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, nodename))
nodefolder = self.restrictedTraverse(path)
if not nodefolder:
raise Exception, 'cannot find database object at %s' % path
@@ -179,9 +179,8 @@
return False
def resolve_nodename(self, clustername, nodename):
- path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
-
try:
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
clusterfolder = self.restrictedTraverse(path)
objs = clusterfolder.objectItems('Folder')
except Exception, e:
@@ -213,8 +212,8 @@
return 'Unable to find cluster nodes for %s' % clustername
try:
- cluster_node = self.restrictedTraverse('%s/systems/cluster/%s' \
- % (PLONE_ROOT, clustername))
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ cluster_node = self.restrictedTraverse(path)
if not cluster_node:
raise Exception, 'cluster node is none'
except Exception, e:
@@ -275,7 +274,7 @@
for i in new_list:
try:
cluster_node.manage_addFolder(i)
- new_node = cluster_node.restrictedTraverse(i)
+ new_node = cluster_node.restrictedTraverse(str(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))
except Exception, e:
@@ -287,9 +286,8 @@
return messages
def buildClusterCreateFlags(self, batch_map, clustername):
- path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
-
try:
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
clusterfolder = self.restrictedTraverse(path)
except Exception, e:
if LUCI_DEBUG_MODE is True:
@@ -306,7 +304,7 @@
clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
# now designate this new object properly
- objpath = '%s/%s' % (path, objname)
+ objpath = str('%s/%s' % (path, objname))
flag = self.restrictedTraverse(objpath)
flag.manage_addProperty(BATCH_ID, batch_id, 'string')
@@ -318,10 +316,8 @@
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)
-
try:
- clusters = self.restrictedTraverse(CLUSTER_FOLDER_PATH)
+ clusters = self.restrictedTraverse(str(CLUSTER_FOLDER_PATH))
if not clusters:
raise Exception, 'cannot find the cluster entry in the DB'
except Exception, e:
@@ -330,7 +326,8 @@
return 'Unable to create cluster %s: the cluster directory is missing.' % clustername
try:
- newCluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ newCluster = self.restrictedTraverse(path)
if newCluster:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('MC1: cluster %s: already exists' \
@@ -341,7 +338,8 @@
try:
clusters.manage_addFolder(clustername)
- newCluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ newCluster = self.restrictedTraverse(path)
if not newCluster:
raise Exception, 'unable to create the cluster DB entry for %s' % clustername
except Exception, e:
@@ -376,7 +374,8 @@
try:
newCluster.manage_addFolder(host)
- newSystem = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, host))
+ path = str('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, host))
+ newSystem = self.restrictedTraverse(path)
if not newSystem:
raise Exception, 'unable to create cluster system DB entry for node %s' % host
newSystem.manage_acquiredPermissions([])
@@ -412,14 +411,16 @@
try:
# It's already there, as a storage system, no problem.
- dummy = self.restrictedTraverse('%s%s' % (STORAGE_FOLDER_PATH, host)).objectItems()
+ path = str('%s%s' % (STORAGE_FOLDER_PATH, host))
+ dummy = self.restrictedTraverse(path)
continue
except:
pass
try:
ssystem.manage_addFolder(host)
- newSystem = self.restrictedTraverse('%s%s' % (STORAGE_FOLDER_PATH, host))
+ path = str('%s%s' % (STORAGE_FOLDER_PATH, host))
+ newSystem = self.restrictedTraverse(path)
newSystem.manage_acquiredPermissions([])
newSystem.manage_role('View', [ 'Access contents information' , 'View' ])
except Exception, e:
@@ -429,7 +430,8 @@
def createClusterSystems(self, clustername, node_list):
try:
- clusterObj = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ clusterObj = self.restrictedTraverse(path)
if not clusterObj:
raise Exception, 'cluster %s DB entry is missing' % clustername
except Exception, e:
@@ -450,7 +452,8 @@
% (clustername, host, e, str(e)))
try:
- newSystem = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, host))
+ path = str('%s%s/%s' % (CLUSTER_FOLDER_PATH, clustername, host))
+ newSystem = self.restrictedTraverse(path)
if not newSystem:
raise Exception, 'cluster node DB entry for %s disappeared from under us' % host
newSystem.manage_acquiredPermissions([])
@@ -481,14 +484,16 @@
try:
# It's already there, as a storage system, no problem.
- dummy = self.restrictedTraverse('%s%s' % (STORAGE_FOLDER_PATH, host)).objectItems()
+ path = str('%s%s' % (STORAGE_FOLDER_PATH, host))
+ dummy = self.restrictedTraverse(path)
continue
except:
pass
try:
ssystem.manage_addFolder(host)
- newSystem = self.restrictedTraverse('%s%s' % (STORAGE_FOLDER_PATH, host))
+ path = str('%s%s' % (STORAGE_FOLDER_PATH, host))
+ newSystem = self.restrictedTraverse(path)
newSystem.manage_acquiredPermissions([])
newSystem.manage_role('View', [ 'Access contents information' , 'View' ])
except Exception, e:
@@ -540,7 +545,8 @@
unauth = True
else:
try:
- dummy = self.restrictedTraverse('%s%s/%s' % (CLUSTER_FOLDER_PATH, cluster_name, systemName)).objectItems()
+ path = str('%s%s/%s' % (CLUSTER_FOLDER_PATH, cluster_name, systemName))
+ dummy = self.restrictedTraverse(path).objectItems()
except Exception, e:
# It's not a member of a managed cluster, so unauthenticate.
unauth = True
@@ -584,7 +590,8 @@
def delClusterSystem(self, cluster, systemName):
try:
- dummy = self.restrictedTraverse('%s%s' % (STORAGE_FOLDER_PATH, systemName)).objectItems()
+ path = str('%s%s' % (STORAGE_FOLDER_PATH, systemName))
+ dummy = self.restrictedTraverse(path).objectItems()
except:
# It's not a storage system, so unauthenticate.
try:
@@ -604,7 +611,8 @@
def delClusterSystems(self, clustername):
try:
- cluster = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ cluster = self.restrictedTraverse(path)
if not cluster:
raise Exception, 'cluster DB entry is missing'
@@ -661,8 +669,8 @@
def getCluster(self, clustername):
try:
- cluster_obj = self.restrictedTraverse('%s%s' \
- % (CLUSTER_FOLDER_PATH, clustername))
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ cluster_obj = self.restrictedTraverse(path)
except Exception, e:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('GCobj0: %s: %r %s' \
@@ -675,7 +683,8 @@
def getClusterSystems(self, clustername):
try:
- cluster_nodes = self.restrictedTraverse('%s%s/objectItems' % (CLUSTER_FOLDER_PATH, clustername))('Folder')
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
+ cluster_nodes = self.restrictedTraverse(path).objectItems('Folder')
except Exception, e:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('GCSy0: %s: %r %s' \
@@ -691,7 +700,7 @@
def getClusters(self):
try:
- clusters = self.restrictedTraverse('%s/systems/cluster/objectItems' % PLONE_ROOT)('Folder')
+ clusters = self.restrictedTraverse(CLUSTER_FOLDER_PATH).objectItems('Folder')
except Exception, e:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('GC0: %r %s' % (e, str(e)))
@@ -703,11 +712,12 @@
def getStorage(self):
try:
- storage = self.restrictedTraverse('%s/systems/storage/objectItems' % PLONE_ROOT)('Folder')
+ storage = self.restrictedTraverse(STORAGE_FOLDER_PATH).objectItems('Folder')
except Exception, e:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('GS0: %r %s' % (e, str(e)))
return None
+
if isAdmin(self):
return storage
return allowed_systems(storage)
@@ -756,8 +766,9 @@
luci_log.debug_verbose('GRA0: %r %s' % (e, str(e)))
return None
+ clusterfolder = None
try:
- path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
clusterfolder = self.restrictedTraverse(path)
if not clusterfolder:
if LUCI_DEBUG_MODE is True:
@@ -776,8 +787,8 @@
if LUCI_DEBUG_MODE is True:
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))
+ if clusterfolder is not None and len(clusterfolder.objectItems()) < 1:
+ clusters = self.restrictedTraverse(CLUSTER_FOLDER_PATH)
clusters.manage_delObjects([clustername])
except Exception, ein:
if LUCI_DEBUG_MODE is True:
@@ -854,7 +865,7 @@
def getClusterDBObj(self, clustername):
try:
- cluster_path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
+ cluster_path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
nodelist = self.restrictedTraverse(cluster_path)
if not nodelist:
raise Exception, 'no nodelist'
@@ -867,7 +878,7 @@
def getClusterDBNodes(self, clustername):
try:
- cluster_path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
+ cluster_path = str('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
nodelist = self.restrictedTraverse(cluster_path).objectItems('Folder')
except Exception, e:
if LUCI_DEBUG_MODE is True:
@@ -910,7 +921,7 @@
def getClusterFlags(self, cluname):
try:
- path = '%s%s' % (CLUSTER_FOLDER_PATH, cluname)
+ path = str('%s%s' % (CLUSTER_FOLDER_PATH, cluname))
clusterfolder = self.restrictedTraverse(path)
if not clusterfolder:
raise Exception, 'clusterfolder is None'
--- conga/luci/site/luci/Extensions/Attic/ResourceHandler.py 2007/05/22 17:12:25 1.1.2.5
+++ conga/luci/site/luci/Extensions/Attic/ResourceHandler.py 2007/06/08 18:27:00 1.1.2.6
@@ -770,15 +770,15 @@
except Exception, e:
raise Exception, [ 'No Resource named "%s" exists.' % oldname ]
else:
- res = resource_table[type][1]()
+ res = resource_table[res_type][1]()
- if type != 'ip':
+ if res_type != 'ip':
if not form.has_key('resourceName') or not form['resourceName'].strip():
raise Exception, [ 'All resources must have a unique name.' ]
rname = form['resourceName'].strip()
res.addAttribute('name', rname)
- errors = resource_table[type][0](res, rname, form, model)
+ errors = resource_table[res_type][0](res, rname, form, model)
try:
dummy = getResourceForEdit(model, rname)
if dummy:
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/06/07 06:41:05 1.255.2.13
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/06/08 18:27:00 1.255.2.14
@@ -28,6 +28,7 @@
from system_adapters import validate_svc_update
from homebase_adapters import parseHostForm
from LuciClusterInfo import getClusterInfo, getModelBuilder, getModelForCluster
+from LuciClusterActions import propagateClusterConfAsync
from conga_constants import BATCH_ID, CLUNODE_CREATE_ERRORS, \
CLUSTER_ADD, CLUSTER_CONFIG, CLUSTER_DAEMON, CLUSTER_DELETE, \
@@ -919,61 +920,23 @@
buildSvcTree(new_service, form_hash['toplevel']['kids'])
model.resourcemanager_ptr.addChild(new_service)
+ model.setModified(True)
- clustername = model.getClusterName()
- if not clustername:
- if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('vAS6: no cluname from mb')
- return (False, {'errors': [ 'Unable to determine cluster name' ]})
-
- try:
- model.setModified(True)
- conf = model.exportModelAsString()
- if not conf:
- 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 %s' \
- % (e, str(e)))
- return (False, {'errors': [ 'An error occurred while adding this service' ]})
-
- rc = getRicciAgent(self, clustername)
- if not rc:
- if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('vAS6b: unable to find a ricci agent for cluster %s' % clustername)
- return 'Unable to find a ricci agent for the %s cluster' % clustername
-
- try:
- ragent = rc.hostname()
- if not ragent:
- if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('vAS7: missing ricci hostname')
- raise Exception, 'unknown ricci agent hostname'
-
- batch_number, result = rq.setClusterConf(rc, str(conf))
- if batch_number is None or result is None:
- if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('vAS8: missing batch_number or result')
- raise Exception, 'unable to save the new cluster configuration'
- except Exception, e:
- if LUCI_DEBUG_MODE is True:
- luci_log.debug_verbose('vAS9: %r %s' \
- % (e, str(e)))
- return 'An error occurred while propagating the new cluster.conf: %s' % str(e)
-
- try:
- if request.form['action'] == 'edit':
- set_node_flag(self, clustername, ragent, str(batch_number), SERVICE_CONFIG, 'Configuring service "%s"' % service_name)
- else:
- 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 %s' \
- % (e, str(e)))
+ if request.form['action'].strip().lower() == 'edit':
+ action_type = SERVICE_CONFIG
+ action_msg = 'Configuring service "%s"'
+ else:
+ action_type = SERVICE_ADD
+ action_msg = 'Creating service "%s"'
+
+ ret = propagateClusterConfAsync(self, model, rc=None,
+ action=action_type, pmsg=action_msg % service_name)
+ if ret[0] is False:
+ return ret
response = request.RESPONSE
response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
- % (request['URL'], SERVICES, clustername))
+ % (request['URL'], SERVICES, model.getClusterName()))
def validateResourceAdd(self, request):
try:
@@ -3135,6 +3098,7 @@
if LUCI_DEBUG_MODE is True:
luci_log.info('ICB16: Unable to delete %s: %r %s' \
% (item[0], e, str(e)))
+ busy_map['busy'] = None
else:
node_report = {}
busy_map['busy'] = 'true'
--- conga/luci/site/luci/Extensions/ClusterModel/Attic/Cluster.py 2007/05/15 21:42:21 1.1.2.3
+++ conga/luci/site/luci/Extensions/ClusterModel/Attic/Cluster.py 2007/06/08 18:27:00 1.1.2.4
@@ -55,7 +55,16 @@
self.incrementConfigVersion()
else:
self.is_cfg_version_dirty = False
- TagObject.generateXML(doc, parent)
+
+ tag = doc.createElement(self.TAG_NAME)
+ if parent is None:
+ parent = doc
+ parent.appendChild(tag)
+ self.exportAttributes(tag)
+ if len(self.children) > 0:
+ for child in self.children:
+ if child is not None:
+ child.generateXML(doc, tag)
def getNameAlias(self):
return self.getAlias()
--- conga/luci/site/luci/Extensions/ClusterModel/Attic/ModelBuilder.py 2007/06/07 06:41:05 1.1.2.7
+++ conga/luci/site/luci/Extensions/ClusterModel/Attic/ModelBuilder.py 2007/06/08 18:27:00 1.1.2.8
@@ -421,7 +421,6 @@
self.restore_unusual_items()
try:
-
doc = minidom.Document()
self.object_tree.generateXML(doc)
strbuf = doc.toprettyxml()
@@ -547,9 +546,10 @@
self.isModified = True
def retrieveNodeByName(self, name):
- ret = filter(lambda x: x.getName() == name, self.getNodes())
+ ret = filter(lambda x: x.getName() == name, self.clusternodes_ptr.getChildren())
if len(ret) != 1:
raise KeyError, name
+ return ret[0]
def deleteNodeByName(self, name):
return self.deleteNode(self.retrieveNodeByName(name))
--- conga/luci/site/luci/Extensions/ClusterModel/Attic/TagObject.py 2007/05/15 21:42:21 1.1.2.3
+++ conga/luci/site/luci/Extensions/ClusterModel/Attic/TagObject.py 2007/06/08 18:27:00 1.1.2.4
@@ -17,7 +17,6 @@
self.TAG_NAME = tagname
def addChild(self, child):
- #print "in AddChild, adding child %s" % child.getName()
self.children.append(child)
def removeChild(self, child):
@@ -35,22 +34,15 @@
return True
def generateXML(self, doc, parent=None):
- #tag = parent.createNode(TAG_NAME)
- #print "TAGNAME is %s" % TAG_NAME
- #print "self.TAGNAME is %s" % self.TAG_NAME
tag = doc.createElement(self.TAG_NAME)
- if parent is not None:
- parent.appendChild(tag)
- else:
- doc.appendChild(tag)
- #tag = parent.createChildElement(TAG_NAME)
+ if parent is None:
+ parent = doc
+ parent.appendChild(tag)
self.exportAttributes(tag)
- #parent.appendChild(tag)
if len(self.children) > 0:
for child in self.children:
- if child is None:
- continue
- child.generateXML(doc, tag)
+ if child is not None:
+ child.generateXML(doc, tag)
def exportAttributes(self, tag):
attrs = self.attr_hash.keys()
More information about the Cluster-devel
mailing list