From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-chooser cluster/form-m ...
Date: 6 Dec 2006 18:38:57 -0000 [thread overview]
Message-ID: <20061206183857.24454.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-12-06 18:38:55
Modified files:
luci/cluster : form-chooser form-macros
luci/site/luci/Extensions: cluster_adapters.py
conga_constants.py
Log message:
The service delete option was doing nothing. Make it work, but only when the service is not running.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.121&r2=1.122
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.172&r2=1.173
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.27&r2=1.28
--- conga/luci/cluster/form-chooser 2006/11/10 19:44:57 1.13
+++ conga/luci/cluster/form-chooser 2006/12/06 18:38:53 1.14
@@ -80,6 +80,9 @@
<span tal:omit-tag="" tal:condition="python: ptype == '25'">
<div metal:use-macro="here/form-macros/macros/serviceprocess-form"/>
</span>
+ <tal:block tal:condition="python: ptype == '56'">
+ <div metal:use-macro="here/form-macros/macros/servicedelete-form" />
+ </tal:block>
<span tal:omit-tag="" tal:condition="python: ptype == '26'">
<div metal:use-macro="here/form-macros/macros/servicestart"/>
</span>
--- conga/luci/cluster/form-macros 2006/12/05 23:32:34 1.121
+++ conga/luci/cluster/form-macros 2006/12/06 18:38:54 1.122
@@ -2775,9 +2775,31 @@
<form method="post" onSubmit="return dropdown(this.gourl)">
<select name="gourl">
<option value="">Choose a Task...</option>
- <option value="" tal:attributes="value svc/cfgurl">Configure</option>
+ <option
+ tal:attributes="value svc/cfgurl | nothing"
+ tal:content="string:Configure this service" />
+
<option value="">----------</option>
- <option value="">Delete</option>
+
+ <option
+ tal:condition="running"
+ tal:attributes="value svc/retstarturl| nothing"
+ tal:content="string:Restart this service" />
+
+ <option
+ tal:condition="running"
+ tal:attributes="value svc/disableurl | nothing"
+ tal:content="string:Stop this service" />
+
+ <option
+ tal:condition="not: running"
+ tal:attributes="value svc/enableurl | nothing"
+ tal:content="string:Start this service" />
+
+ <option
+ tal:condition="not: running"
+ tal:attributes="value svc/delurl | nothing"
+ tal:content="string:Delete this service" />
</select>
<input type="submit" value="Go"/>
</form>
@@ -3047,14 +3069,15 @@
<option value="" tal:attributes="value innermap/disableurl">Disable this service</option>
<option value="">----------</option>
<option tal:repeat="starturl innermap/links" value="" tal:attributes="value starturl/url">Start this service on <span tal:replace="starturl/nodename"/></option>
- <option value="">----------</option>
- <option value="">Delete this service</option>
</tal:block>
<tal:block tal:condition="not: running">
<option value="">----------</option>
<option value="" tal:attributes="value innermap/enableurl">Enable this service</option>
<option value="">----------</option>
+ <option
+ tal:attributes="value innermap/delurl | nothing"
+ tal:content="string:Delete this service" />
</tal:block>
</select>
<input type="submit" value="Go"/>
@@ -3152,6 +3175,11 @@
<h2>Service Process Form</h2>
</div>
+<div metal:define-macro="servicedelete-form">
+ <h2>Service Delete Form</h2>
+ <tal:block tal:define="dummy python: here.delService(request)" />
+</div>
+
<div metal:define-macro="resources-form">
<h2>Resources Form</h2>
</div>
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/05 23:32:35 1.172
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/06 18:38:54 1.173
@@ -404,7 +404,6 @@
form_xml = request['form_xml']
if not form_xml:
raise KeyError, 'form_xml must not be blank'
- luci_log.debug_verbose('VSAXML DUMP: %s' % form_xml)
except Exception, e:
luci_log.debug_verbose('vSA0: no form_xml: %s' % str(e))
return (False, {'errors': ['No resource data was supplied for this service.']})
@@ -1920,6 +1919,7 @@
itemmap['nodename'] = item['nodename']
itemmap['autostart'] = item['autostart']
itemmap['cfgurl'] = baseurl + "?" + "clustername=" + cluname + "&servicename=" + item['name'] + "&pagetype=" + SERVICE
+ itemmap['delurl'] = baseurl + "?" + "clustername=" + cluname + "&servicename=" + item['name'] + "&pagetype=" + SERVICE_DELETE
svc = modelb.retrieveServiceByName(item['name'])
dom = svc.getAttribute("domain")
@@ -1980,6 +1980,8 @@
innermap['current'] = "This service is currently running on %s" % nodename
innermap['disableurl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + servicename + "&pagetype=" + SERVICE_STOP
innermap['restarturl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + servicename + "&pagetype=" + SERVICE_RESTART
+ innermap['delurl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + servicename + "&pagetype=" + SERVICE_DELETE
+
nodes = modelb.getNodes()
for node in nodes:
starturl = {}
@@ -2026,16 +2028,18 @@
if parent is not None:
rc_map['parent'] = parent
rc_map['name'] = child.getName()
+
+ #Note: Final version needs all resource attrs
if child.isRefObject() == True:
rc_map['ref_object'] = True
rc_map['type'] = child.getObj().getResourceType()
+ rc_map['attrs'] = child.getObj().getAttributes()
else:
rc_map['type'] = child.getResourceType()
+ rc_map['attrs'] = child.getAttributes()
rc_map['indent_ctr'] = indent_ctr
- #Note: Final version needs all resource attrs
- rc_map['attrs'] = child.getAttributes()
rc_map['uuid'] = make_uuid('resource')
rc_map['parent_uuid'] = parent_uuid
@@ -3985,6 +3989,82 @@
except:
continue
+def delService(self, request):
+ errstr = 'An error occurred while attempting to set the new cluster.conf'
+
+ try:
+ modelb = request.SESSION.get('model')
+ except Exception, e:
+ luci_log.debug_verbose('delService0: no model: %s' % str(e))
+ return (False, {'errors': [ errstr ] })
+
+ name = None
+ try:
+ name = request['servicename']
+ except:
+ try:
+ name = request.form['servicename']
+ except:
+ pass
+
+ if name is None:
+ luci_log.debug_verbose('delService1: no service name')
+ return (False, {'errors': [ '%s: no service name was provided.' % errstr ]})
+
+ clustername = None
+ try:
+ clustername = request['clustername']
+ except:
+ try:
+ clustername = request.form['clustername']
+ except:
+ pass
+
+ if clustername is None:
+ luci_log.debug_verbose('delService2: no cluster name for %s' % name)
+ return (False, {'errors': [ '%s: no cluster name was provided.' % errstr ]})
+
+ rc = getRicciAgent(self, clustername)
+ if not rc:
+ luci_log.debug_verbose('delService3: unable to get ricci agent for cluster %s' % clustername)
+ return (False, {'errors': [ '%s: unable to find a Ricci agent for this cluster.' % errstr ]})
+
+ try:
+ ragent = rc.hostname()
+ if not ragent:
+ raise Exception, 'unable to determine the hostname of the ricci agent'
+ except Exception, e:
+ luci_log.debug_verbose('delService4: %s: %s' % (errstr, str(e)))
+ return (False, {'errors': [ '%s: unable to find a Ricci agent for this cluster.' % errstr ]})
+
+ try:
+ modelb.deleteService(name)
+ except Exception, e:
+ luci_log.debug_verbose('delService5: Unable to find a service named %s for cluster %s' % (name, clustername))
+ return (False, {'errors': [ '%s: error removing service %s.' % (errstr, name) ]})
+
+ try:
+ conf = modelb.exportModelAsString()
+ if not conf:
+ raise Exception, 'model string is blank'
+ except Exception, e:
+ luci_log.debug_verbose('delService6: exportModelAsString failed: %s' \
+ % str(e))
+ return (False, {'errors': [ '%s: error removing service %s.' % (errstr, name) ]})
+
+ batch_number, result = setClusterConf(rc, str(conf))
+ if batch_number is None or result is None:
+ luci_log.debug_verbose('delService7: missing batch and/or result')
+ return (False, {'errors': [ '%s: error removing service %s.' % (errstr, name) ]})
+
+ try:
+ set_node_flag(self, clustername, ragent, str(batch_number), SERVICE_DELETE, "Removing service \'%s\'" % name)
+ except Exception, e:
+ luci_log.debug_verbose('delService8: failed to set flags: %s' % str(e))
+
+ response = request.RESPONSE
+ response.redirect(request['URL'] + "?pagetype=" + SERVICES + "&clustername=" + clustername + '&busyfirst=true')
+
def delResource(self, rc, request):
errstr = 'An error occurred while attempting to set the new cluster.conf'
@@ -4068,9 +4148,6 @@
if form is None:
form = request.form
- if form is not None:
- luci_log.debug_verbose('addIp DUMP: %s' % str(form.items()))
-
if not form:
luci_log.debug_verbose('addIp error: form is missing')
return None
--- conga/luci/site/luci/Extensions/conga_constants.py 2006/11/27 20:06:53 1.27
+++ conga/luci/site/luci/Extensions/conga_constants.py 2006/12/06 18:38:55 1.28
@@ -43,6 +43,7 @@
FENCEDEV_CONFIG="53"
FENCEDEV="54"
CLUSTER_DAEMON="55"
+SERVICE_DELETE = '56'
#Cluster tasks
CLUSTER_STOP = '1000'
next reply other threads:[~2006-12-06 18:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 18:38 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-09-25 22:47 [Cluster-devel] conga/luci cluster/form-chooser cluster/form-m rmccabe
2007-03-12 4:25 rmccabe
2007-03-12 4:24 rmccabe
2007-03-12 4:22 rmccabe
2007-02-23 22:07 rmccabe
2006-12-21 21:26 kupcevic
2006-12-07 17:54 rmccabe
2006-11-10 19:44 rmccabe
2006-10-09 17:12 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=20061206183857.24454.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 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).