From: jparsons@sourceware.org <jparsons@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions FenceHandler.p ...
Date: 18 Dec 2006 15:18:38 -0000 [thread overview]
Message-ID: <20061218151838.25230.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: jparsons at sourceware.org 2006-12-18 15:18:37
Modified files:
luci/site/luci/Extensions: FenceHandler.py cluster_adapters.py
Log message:
remove dingdang tabs and fix indent error
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.185&r2=1.186
--- conga/luci/site/luci/Extensions/FenceHandler.py 2006/12/18 04:44:52 1.6
+++ conga/luci/site/luci/Extensions/FenceHandler.py 2006/12/18 15:18:37 1.7
@@ -1050,7 +1050,7 @@
fencedevs = model.getFenceDevices()
for fd in fencedevs:
- if fd.getName().strip() == fencedev_name
+ if fd.getName().strip() == fencedev_name:
return (FD_VAL_FAIL, FD_PROVIDE_NAME)
if agent_type == "fence_apc":
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/18 04:44:52 1.185
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/18 15:18:37 1.186
@@ -992,113 +992,112 @@
}
def validateConfigCluster(self, request):
- errors = list()
- messages = list()
- rc = None
+ errors = list()
+ messages = list()
+ rc = None
- try:
- model = request.SESSION.get('model')
- if not model:
- raise Exception, 'model is none'
- except Exception, e:
- model = None
- try:
- cluname = request.form['clustername']
- except:
- try:
- cluname = request['clustername']
- except:
- luci_log.debug_verbose('VCC0a: no model, no cluster name')
- return (False, {'errors': ['No cluster model was found.']})
+ try:
+ model = request.SESSION.get('model')
+ if not model:
+ raise Exception, 'model is none'
+ except Exception, e:
+ model = None
+ try:
+ cluname = request.form['clustername']
+ except:
+ try:
+ cluname = request['clustername']
+ except:
+ luci_log.debug_verbose('VCC0a: no model, no cluster name')
+ return (False, {'errors': ['No cluster model was found.']})
- try:
- model = getModelForCluster(self, cluname)
- except:
- model = None
+ try:
+ model = getModelForCluster(self, cluname)
+ except:
+ model = None
- if model is None:
- luci_log.debug_verbose('VCC0: unable to get model from session')
- return (False, {'errors': ['No cluster model was found.']})
- try:
- if not 'configtype' in request.form:
- luci_log.debug_verbose('VCC2: no configtype')
- raise Exception, 'no config type'
- except Exception, e:
- luci_log.debug_verbose('VCC2a: %s' % str(e))
- return (False, {'errors': ['No configuration type was submitted.']})
+ if model is None:
+ luci_log.debug_verbose('VCC0: unable to get model from session')
+ return (False, {'errors': ['No cluster model was found.']})
+ try:
+ if not 'configtype' in request.form:
+ luci_log.debug_verbose('VCC2: no configtype')
+ raise Exception, 'no config type'
+ except Exception, e:
+ luci_log.debug_verbose('VCC2a: %s' % str(e))
+ return (False, {'errors': ['No configuration type was submitted.']})
- if not request.form['configtype'] in configFormValidators:
- luci_log.debug_verbose('VCC3: invalid config type: %s' % request.form['configtype'])
- return (False, {'errors': ['An invalid configuration type was submitted.']})
+ if not request.form['configtype'] in configFormValidators:
+ luci_log.debug_verbose('VCC3: invalid config type: %s' % request.form['configtype'])
+ return (False, {'errors': ['An invalid configuration type was submitted.']})
- try:
- cp = model.getClusterPtr()
- except:
- luci_log.debug_verbose('VCC3a: getClusterPtr failed')
- return (False, {'errors': ['No cluster model was found.']})
+ try:
+ cp = model.getClusterPtr()
+ except:
+ luci_log.debug_verbose('VCC3a: getClusterPtr failed')
+ return (False, {'errors': ['No cluster model was found.']})
- config_validator = configFormValidators[request.form['configtype']]
- ret = config_validator(model, request.form)
+ config_validator = configFormValidators[request.form['configtype']]
+ ret = config_validator(model, request.form)
- retcode = ret[0]
- if 'errors' in ret[1]:
- errors.extend(ret[1]['errors'])
-
- if 'messages' in ret[1]:
- messages.extend(ret[1]['messages'])
-
- if retcode == True:
- try:
- config_ver = int(cp.getConfigVersion()) + 1
- # always increment the configuration version
- cp.setConfigVersion(str(config_ver))
- model.setModified(True)
- conf_str = model.exportModelAsString()
- if not conf_str:
- raise Exception, 'conf_str is none'
- except Exception, e:
- luci_log.debug_verbose('VCC4: export model as string failed: %s' \
- % str(e))
- errors.append('Unable to store the new cluster configuration')
+ retcode = ret[0]
+ if 'errors' in ret[1]:
+ errors.extend(ret[1]['errors'])
- try:
- clustername = model.getClusterName()
- if not clustername:
- raise Exception, 'cluster name from modelb.getClusterName() is blank'
- except Exception, e:
- luci_log.debug_verbose('VCC5: error: getClusterName: %s' % str(e))
- errors.append('Unable to determine cluster name from model')
+ if 'messages' in ret[1]:
+ messages.extend(ret[1]['messages'])
- if len(errors) > 0:
- return (retcode, {'errors': errors, 'messages': messages})
+ if retcode == True:
+ try:
+ config_ver = int(cp.getConfigVersion()) + 1
+ # always increment the configuration version
+ cp.setConfigVersion(str(config_ver))
+ model.setModified(True)
+ conf_str = model.exportModelAsString()
+ if not conf_str:
+ raise Exception, 'conf_str is none'
+ except Exception, e:
+ luci_log.debug_verbose('VCC4: export model as string failed: %s' \
+ % str(e))
+ errors.append('Unable to store the new cluster configuration')
- if not rc:
- rc = getRicciAgent(self, clustername)
- if not rc:
- luci_log.debug_verbose('VCC6: unable to find a ricci agent for the %s cluster' % clustername)
- errors.append('Unable to contact a ricci agent for cluster %s' \
- % clustername)
-
- if rc:
- batch_id, result = setClusterConf(rc, str(conf_str))
- if batch_id is None or result is None:
- luci_log.debug_verbose('VCC7: setCluserConf: batchid or result is None')
- errors.append('Unable to propagate the new cluster configuration for %s' \
- % clustername)
- else:
- try:
- set_node_flag(self, clustername, rc.hostname(), batch_id,
- CLUSTER_CONFIG, 'Updating cluster configuration')
- except:
- pass
+ try:
+ clustername = model.getClusterName()
+ if not clustername:
+ raise Exception, 'cluster name from modelb.getClusterName() is blank'
+ except Exception, e:
+ luci_log.debug_verbose('VCC5: error: getClusterName: %s' % str(e))
+ errors.append('Unable to determine cluster name from model')
- if len(errors) < 1:
- messages.append('The cluster properties have been updated.')
- else:
- return (retcode, {'errors': errors, 'messages': messages})
+ if len(errors) > 0:
+ return (retcode, {'errors': errors, 'messages': messages})
- response = request.RESPONSE
- response.redirect(request['URL'] + "?pagetype=" + CLUSTER_CONFIG + "&clustername=" + clustername + '&busyfirst=true')
+ if not rc:
+ rc = getRicciAgent(self, clustername)
+ if not rc:
+ luci_log.debug_verbose('VCC6: unable to find a ricci agent for the %s cluster' % clustername)
+ errors.append('Unable to contact a ricci agent for cluster %s' \
+ % clustername)
+
+ if rc:
+ batch_id, result = setClusterConf(rc, str(conf_str))
+ if batch_id is None or result is None:
+ luci_log.debug_verbose('VCC7: setCluserConf: batchid or result is None')
+ errors.append('Unable to propagate the new cluster configuration for %s' \
+ % clustername)
+ else:
+ try:
+ set_node_flag(self, clustername, rc.hostname(), batch_id, CLUSTER_CONFIG, 'Updating cluster configuration')
+ except:
+ pass
+
+ if len(errors) < 1:
+ messages.append('The cluster properties have been updated.')
+ else:
+ return (retcode, {'errors': errors, 'messages': messages})
+
+ response = request.RESPONSE
+ response.redirect(request['URL'] + "?pagetype=" + CLUSTER_CONFIG + "&clustername=" + clustername + '&busyfirst=true')
def validateFenceAdd(self, request):
errors = list()
@@ -1129,68 +1128,68 @@
luci_log.debug_verbose('VFE: unable to get model from session')
return (False, {'errors': ['No cluster model was found.']})
- form = None
- try:
- response = request.response
- form = request.form
- if not form:
- form = None
- raise Exception, 'no form was submitted'
- except:
- pass
+ form = None
+ try:
+ response = request.response
+ form = request.form
+ if not form:
+ form = None
+ raise Exception, 'no form was submitted'
+ except:
+ pass
- if form is None:
- luci_log.debug_verbose('VFE: no form was submitted')
- return (False, {'errors': ['No form was submitted']})
+ if form is None:
+ luci_log.debug_verbose('VFE: no form was submitted')
+ return (False, {'errors': ['No form was submitted']})
fencehandler = FenceHandler()
error_code,error_string = fencehandler.validateNewFenceDevice(form, model)
if error_code == FD_VAL_SUCCESS:
message.append(error_string)
- try:
+ try:
cp = model.getClusterPtr()
- cp.incrementConfigVersion()
- model.setModified(True)
- conf_str = model.exportModelAsString()
- if not conf_str:
- raise Exception, 'conf_str is none'
- except Exception, e:
- luci_log.debug_verbose('VFE: export model as string failed: %s' \
- % str(e))
- errors.append('Unable to store the new cluster configuration')
-
- try:
- clustername = model.getClusterName()
- if not clustername:
- raise Exception, 'cluster name from modelb.getClusterName() is blank'
- except Exception, e:
- luci_log.debug_verbose('VFA: error: getClusterName: %s' % str(e))
- errors.append('Unable to determine cluster name from model')
-
- if not rc:
- rc = getRicciAgent(self, clustername)
- if not rc:
- luci_log.debug_verbose('VFA: unable to find a ricci agent for the %s cluster' % clustername)
- errors.append('Unable to contact a ricci agent for cluster %s' \
- % clustername)
-
- if rc:
- batch_id, result = setClusterConf(rc, str(conf_str))
- if batch_id is None or result is None:
- luci_log.debug_verbose('VFA: setCluserConf: batchid or result is None')
- errors.append('Unable to propagate the new cluster configuration for %s' \
- % clustername)
- else:
- try:
- set_node_flag(self, clustername, rc.hostname(), batch_id,
- CLUSTER_CONFIG, 'Updating cluster configuration')
- except:
- pass
+ cp.incrementConfigVersion()
+ model.setModified(True)
+ conf_str = model.exportModelAsString()
+ if not conf_str:
+ raise Exception, 'conf_str is none'
+ except Exception, e:
+ luci_log.debug_verbose('VFE: export model as string failed: %s' \
+ % str(e))
+ errors.append('Unable to store the new cluster configuration')
+
+ try:
+ clustername = model.getClusterName()
+ if not clustername:
+ raise Exception, 'cluster name from modelb.getClusterName() is blank'
+ except Exception, e:
+ luci_log.debug_verbose('VFA: error: getClusterName: %s' % str(e))
+ errors.append('Unable to determine cluster name from model')
+
+ if not rc:
+ rc = getRicciAgent(self, clustername)
+ if not rc:
+ luci_log.debug_verbose('VFA: unable to find a ricci agent for the %s cluster' % clustername)
+ errors.append('Unable to contact a ricci agent for cluster %s' \
+ % clustername)
+
+ if rc:
+ batch_id, result = setClusterConf(rc, str(conf_str))
+ if batch_id is None or result is None:
+ luci_log.debug_verbose('VFA: setCluserConf: batchid or result is None')
+ errors.append('Unable to propagate the new cluster configuration for %s' \
+ % clustername)
+ else:
+ try:
+ set_node_flag(self, clustername, rc.hostname(), batch_id,
+ CLUSTER_CONFIG, 'Updating cluster configuration')
+ except:
+ pass
- return (TRUE, {'errors': errors, 'messages': messages})
+ return (TRUE, {'errors': errors, 'messages': messages})
else:
errors.append(error_string)
- return (FALSE, {'errors': errors, 'messages': messages})
+ return (FALSE, {'errors': errors, 'messages': messages})
def validateFenceEdit(self, request):
@@ -1221,19 +1220,19 @@
luci_log.debug_verbose('VFE: unable to get model from session')
return (False, {'errors': ['No cluster model was found.']})
- form = None
- try:
- response = request.response
- form = request.form
- if not form:
- form = None
- raise Exception, 'no form was submitted'
- except:
- pass
+ form = None
+ try:
+ response = request.response
+ form = request.form
+ if not form:
+ form = None
+ raise Exception, 'no form was submitted'
+ except:
+ pass
- if form is None:
- luci_log.debug_verbose('VFE: no form was submitted')
- return (False, {'errors': ['No form was submitted']})
+ if form is None:
+ luci_log.debug_verbose('VFE: no form was submitted')
+ return (False, {'errors': ['No form was submitted']})
#This is a fence edit situation, so the model should already have an
#entry for this fence device.
@@ -1241,7 +1240,7 @@
#pass form and model to validation method, then save changes if it passes.
##########End of orig method
- return (True, {})
+ return (True, {})
def validateDaemonProperties(self, request):
errors = list()
next reply other threads:[~2006-12-18 15:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-18 15:18 jparsons [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-08-06 20:17 [Cluster-devel] conga/luci/site/luci/Extensions FenceHandler.p rmccabe
2008-01-02 21:00 rmccabe
2007-10-03 19:40 rmccabe
2007-09-21 3:02 rmccabe
2007-07-26 4:36 rmccabe
2007-05-15 21:42 rmccabe
2007-01-19 21:48 rmccabe
2007-01-19 19:41 rmccabe
2007-01-11 22:49 rmccabe
2006-12-20 22:06 jparsons
2006-12-20 20:24 jparsons
2006-12-18 22:16 jparsons
2006-12-18 4:44 jparsons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061218151838.25230.qmail@sourceware.org \
--to=jparsons@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).