From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros site/luci/Exten ...
Date: 3 Nov 2006 22:48:15 -0000 [thread overview]
Message-ID: <20061103224815.7360.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-11-03 22:48:15
Modified files:
luci/cluster : form-macros
luci/site/luci/Extensions: cluster_adapters.py
conga_constants.py
Log message:
fix a couple of fence bugs and clean up the configuration validation in preparation for more fixes
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.97&r2=1.98
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.143&r2=1.144
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.21&r2=1.22
--- conga/luci/cluster/form-macros 2006/11/03 21:47:26 1.97
+++ conga/luci/cluster/form-macros 2006/11/03 22:48:14 1.98
@@ -394,6 +394,8 @@
</script>
<form name="basecluster" action="" method="post">
+ <input type="hidden" name="cluster_version"
+ tal:attributes="value os_version | nothing" />
<input type="hidden" name="pagetype"
tal:attributes="value request/pagetype | request/form/pagetype"
/>
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/03 21:13:25 1.143
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/03 22:48:15 1.144
@@ -21,6 +21,7 @@
from Samba import Samba
from FenceHandler import FenceHandler
from clusterOS import resolveOSType
+from FenceHandler import FENCE_OPTS
from GeneralError import GeneralError
from UnknownClusterError import UnknownClusterError
from homebase_adapters import nodeUnauth, nodeAuth, manageCluster, createClusterSystems, havePermCreateCluster, setNodeFlag, delNodeFlag, userAuthenticated, getStorageNode, getClusterNode
@@ -34,8 +35,6 @@
#then only display chooser if the current user has
#permissions on at least one. If the user is admin, show ALL clusters
-CLUSTER_FOLDER_PATH = '/luci/systems/cluster/'
-
try:
luci_log = LuciSyslog()
except LuciSyslogError, e:
@@ -481,17 +480,17 @@
## Cluster properties form validation routines
-def validateMCastConfig(self, form):
+def validateMCastConfig(model, form):
try:
mcast_val = form['mcast'].strip().lower()
if mcast_val != 'true' and mcast_val != 'false':
- raise KeyError(mcast_val)
+ raise KeyError, mcast_val
if mcast_val == 'true':
mcast_val = 1
else:
mcast_val = 0
except KeyError, e:
- return (False, {'errors': ['An invalid multicast selection was made.']})
+ return (False, {'errors': ['An invalid multicast selection was made']})
if not mcast_val:
return (True, {'messages': ['Changes accepted. - FILL ME IN']})
@@ -504,12 +503,12 @@
except socket.error, e:
try:
socket.inet_pton(socket.AF_INET6, addr_str)
- except socket.error, e6:
- return (False, {'errors': ['An invalid multicast address was given: ' + e]})
+ except socket.error, e:
+ return (False, {'errors': ['An invalid multicast address was given: %s' % str(e)]})
return (True, {'messages': ['Changes accepted. - FILL ME IN']})
-def validateQDiskConfig(self, form):
+def validateQDiskConfig(model, form):
errors = list()
try:
@@ -521,7 +520,7 @@
else:
qdisk_val = 0
except KeyError, e:
- return (False, {'errors': ['An invalid quorum partition selection was made.']})
+ return (False, {'errors': ['An invalid quorum partition selection was made']})
if not qdisk_val:
return (True, {'messages': ['Changes accepted. - FILL ME IN']})
@@ -529,64 +528,64 @@
try:
interval = int(form['interval'])
if interval < 0:
- raise ValueError('Interval must be 0 or greater.')
+ raise ValueError, 'Interval must be 0 or greater'
except KeyError, e:
- errors.append('No Interval value was given.')
+ errors.append('No Interval value was given')
except ValueError, e:
- errors.append('An invalid Interval value was given: ' + e)
+ errors.append('An invalid Interval value was given: %s' % str(e))
try:
votes = int(form['votes'])
if votes < 1:
- raise ValueError('Votes must be greater than 0')
+ raise ValueError, 'Votes must be greater than 0'
except KeyError, e:
- errors.append('No Votes value was given.')
+ errors.append('No Votes value was given')
except ValueError, e:
- errors.append('An invalid Votes value was given: ' + e)
+ errors.append('An invalid Votes value was given: %s' % str(e))
try:
tko = int(form['tko'])
if tko < 0:
- raise ValueError('TKO must be 0 or greater')
+ raise ValueError, 'TKO must be 0 or greater'
except KeyError, e:
- errors.append('No TKO value was given.')
+ errors.append('No TKO value was given')
except ValueError, e:
- errors.append('An invalid TKO value was given: ' + e)
+ errors.append('An invalid TKO value was given: %s' % str(e))
try:
min_score = int(form['min_score'])
if min_score < 1:
raise ValueError('Minimum Score must be greater than 0')
except KeyError, e:
- errors.append('No Minimum Score value was given.')
+ errors.append('No Minimum Score value was given')
except ValueError, e:
- errors.append('An invalid Minimum Score value was given: ' + e)
+ errors.append('An invalid Minimum Score value was given: %s' % str(e))
try:
device = form['device'].strip()
if not device:
- raise KeyError('device')
+ raise KeyError, 'device is none'
except KeyError, e:
- errors.append('No Device value was given.')
+ errors.append('No Device value was given')
try:
label = form['label'].strip()
if not label:
- raise KeyError('label')
+ raise KeyError, 'label is none'
except KeyError, e:
- errors.append('No Label value was given.')
+ errors.append('No Label value was given')
num_heuristics = 0
try:
num_heuristics = int(form['num_heuristics'])
if num_heuristics < 0:
- raise ValueError(form['num_heuristics'])
+ raise ValueError, 'invalid number of heuristics: %s' % form['num_heuristics']
if num_heuristics == 0:
num_heuristics = 1
except KeyError, e:
errors.append('No number of heuristics was given.')
except ValueError, e:
- errors.append('An invalid number of heuristics was given: ' + e)
+ errors.append('An invalid number of heuristics was given: %s' % str(e))
heuristics = list()
for i in xrange(num_heuristics):
@@ -601,37 +600,37 @@
(not prefix + 'hscore' in form or not form['hscore'].strip())):
# The row is blank; ignore it.
continue
- errors.append('No heuristic name was given for heuristic #' + str(i + 1))
+ errors.append('No heuristic name was given for heuristic #%d' % i + 1)
try:
hpath = form[prefix + 'hpath']
except KeyError, e:
- errors.append('No heuristic path was given for heuristic #' + str(i + 1))
+ errors.append('No heuristic path was given for heuristic #%d' % i + 1)
try:
hint = int(form[prefix + 'hint'])
if hint < 1:
- raise ValueError('Heuristic interval values must be greater than 0.')
+ raise ValueError, 'Heuristic interval values must be greater than 0'
except KeyError, e:
- errors.append('No heuristic interval was given for heuristic #' + str(i + 1))
+ errors.append('No heuristic interval was given for heuristic #%d' % i + 1)
except ValueError, e:
- errors.append('An invalid heuristic interval was given for heuristic #' + str(i + 1) + ': ' + e)
+ errors.append('An invalid heuristic interval was given for heuristic #%d: %s' % (i + 1, str(e)))
try:
hscore = int(form[prefix + 'score'])
if hscore < 1:
- raise ValueError('Heuristic scores must be greater than 0.')
+ raise ValueError, 'Heuristic scores must be greater than 0'
except KeyError, e:
- errors.append('No heuristic score was given for heuristic #' + str(i + 1))
+ errors.append('No heuristic score was given for heuristic #%d' % i + 1)
except ValueError, e:
- errors.append('An invalid heuristic score was given for heuristic #' + str(i + 1) + ': ' + e)
+ errors.append('An invalid heuristic score was given for heuristic #%d: %s' % (i + 1, str(e)))
heuristics.append([ hname, hpath, hint, hscore ])
if len(errors) > 0:
return (False, {'errors': errors })
return (True, {'messages': ['Changes accepted. - FILL ME IN']})
-def validateGeneralConfig(self, form):
+def validateGeneralConfig(model, form):
errors = list()
try:
@@ -655,7 +654,7 @@
return (True, {'messages': ['Changes accepted. - FILL ME IN']})
-def validateFenceConfig(self, form):
+def validateFenceConfig(model, form):
errors = list()
try:
@@ -692,19 +691,33 @@
errors = list()
messages = list()
+ try:
+ model = request.SESSION.get('model')
+ if not model:
+ raise Exception, 'model is none'
+ except Exception, e:
+ luci_log.debug_verbose('VCC0: unable to get model from session')
+ return (False, {'errors': ['No cluster model was found.']})
+
if not 'form' in request:
+ luci_log.debug_verbose('VCC1: no form passed in')
return (False, {'errors': ['No form was submitted.']})
+
if not 'configtype' in request.form:
+ luci_log.debug_verbose('VCC2: no configtype')
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.']})
- val = configFormValidators[request.form['configtype']]
- ret = val(self, 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'])
@@ -2673,7 +2686,7 @@
if fencedev.getName().strip() == fencename:
map = fencedev.getAttributes()
try:
- map['pretty_name'] = FenceHandler.FENCE_OPTS[fencedev.getAgentType()]
+ map['pretty_name'] = FENCE_OPTS[fencedev.getAgentType()]
except Exception, e:
map['pretty_name'] = fencedev.getAgentType()
@@ -2708,7 +2721,7 @@
for kee in kees:
fencedev[kee] = attr_hash[kee] #copy attrs over
try:
- fencedev['pretty_name'] = FenceHandler.FENCE_OPTS[fd.getAgentType()]
+ fencedev['pretty_name'] = FENCE_OPTS[fd.getAgentType()]
except Exception, e:
fencedev['pretty_name'] = fd.getAgentType()
--- conga/luci/site/luci/Extensions/conga_constants.py 2006/10/20 20:00:29 1.21
+++ conga/luci/site/luci/Extensions/conga_constants.py 2006/11/03 22:48:15 1.22
@@ -66,6 +66,9 @@
PATH_TO_PRIVKEY="/var/lib/luci/var/certs/privkey.pem"
PATH_TO_CACERT="/var/lib/luci/var/certs/cacert.pem"
+# Zope DB paths
+CLUSTER_FOLDER_PATH = '/luci/systems/cluster/'
+
#Node states
NODE_ACTIVE="0"
NODE_INACTIVE="1"
next reply other threads:[~2006-11-03 22:48 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-03 22:48 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-09-21 3:11 [Cluster-devel] conga/luci cluster/form-macros site/luci/Exten rmccabe
2007-06-19 15:54 rmccabe
2007-05-03 20:16 rmccabe
2007-03-15 16:41 rmccabe
2007-03-14 22:38 rmccabe
2007-03-14 22:37 rmccabe
2007-03-05 16:50 rmccabe
2007-03-05 16:50 rmccabe
2007-03-05 16:49 rmccabe
2007-02-15 22:44 rmccabe
2007-02-08 3:46 rmccabe
2007-02-07 17:02 rmccabe
2007-02-07 16:55 rmccabe
2007-02-02 4:34 rmccabe
2007-02-02 0:11 rmccabe
2007-02-01 20:49 rmccabe
2007-01-31 23:36 rmccabe
2007-01-31 5:26 rmccabe
2007-01-23 13:53 rmccabe
2007-01-15 18:21 rmccabe
2007-01-11 19:11 rmccabe
2007-01-10 21:40 rmccabe
2007-01-06 3:29 rmccabe
2006-12-14 23:14 rmccabe
2006-12-14 18:22 rmccabe
2006-12-11 22:42 rmccabe
2006-12-11 21:51 rmccabe
2006-12-06 22:11 rmccabe
2006-12-06 21:16 rmccabe
2006-11-13 21:40 rmccabe
2006-11-12 2:10 rmccabe
2006-11-09 20:32 rmccabe
2006-10-25 1:53 rmccabe
2006-10-25 1:11 rmccabe
2006-10-13 21:25 rmccabe
2006-08-03 18:36 shuennek
2006-07-21 14:49 rmccabe
2006-07-20 16:59 rmccabe
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=20061103224815.7360.qmail@sourceware.org \
--to=rmccabe@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.