
dejanmm at fastmail
Sep 7, 2009, 7:57 AM
Post #2 of 2
(627 views)
Permalink
|
|
Re: [PATCH 1 of 2] cleanup exit, return and implement and use validate_all
[In reply to]
|
|
Hi Raoul, On Wed, Sep 02, 2009 at 05:20:21PM +0200, Raoul Bhatia [IPAX] wrote: > patch 1: > * some minor cleanup > * change exit to return and exit with $? where applicable > * move mysql-proxy binary check to validate_all + ocf_log err "MySQL Proxy binary '$binary' does not exist or cannot be executed." + return $OCF_ERR_GENERIC This should be OCF_ERR_INSTALLED. Otherwise the patch looks fine. I'll fix this, so you don't have to post again. Cheers, Dejan > * call validate_all for start and stop actions > > cheers, > raoul > -- > ____________________________________________________________________ > DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax > Technischer Leiter > > IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at > Barawitzkagasse 10/2/2/11 email. office [at] ipax > 1190 Wien tel. +43 1 3670030 > FN 277995t HG Wien fax. +43 1 3670030 15 > ____________________________________________________________________ > > --- mysql-proxy 2009-08-20 19:48:52.927607125 +0200 > +++ mysql-proxy.02 2009-08-20 19:47:24.922110009 +0200 > @@ -20,7 +20,6 @@ > # > # TODO > # * add error checking like in mysql ocf ra (e.g. socketdir) > -# * verify if mysql-proxy supports multiple --proxy-address(es) > # > # Test via > # */usr/sbin/ocf-tester -n mp /usr/lib/ocf/resource.d/heartbeat/mysql-proxy > @@ -156,7 +155,6 @@ Specify any of them here. > </actions> > </resource-agent> > END > - exit $OCF_SUCCESS > } > > isRunning() > @@ -184,13 +182,7 @@ mysqlproxy_start() > # if MySQL Proxy is running return success > if mysqlproxy_status ; then > ocf_log info "MySQL Proxy already running." > - exit $OCF_SUCCESS > - fi > - > - # check that the MySQL Proxy binary exists and can be executed > - if [ ! -x "$binary" ]; then > - ocf_log err "MySQL Proxy binary '$binary' does not exist or cannot be executed." > - exit $OCF_ERR_GENERIC > + return $OCF_SUCCESS > fi > > # check if the MySQL Proxy defaults-file exist > @@ -228,10 +220,10 @@ mysqlproxy_start() > > if [ $ret -ne 0 ]; then > ocf_log err "MySQL Proxy returned error." $ret > - exit $OCF_ERR_GENERIC > + return $OCF_ERR_GENERIC > fi > > - exit $OCF_SUCCESS > + return $OCF_SUCCESS > } > > > @@ -244,14 +236,14 @@ mysqlproxy_stop() > > if [ $ret -ne 0 ]; then > ocf_log err "MySQL Proxy returned an error while stopping." $ret > - exit $OCF_ERR_GENERIC > + return $OCF_ERR_GENERIC > fi > > # grant some time for shutdown and recheck > sleep 1 > if mysqlproxy_status ; then > ocf_log err "MySQL Proxy failed to stop." > - exit $OCF_ERR_GENERIC > + return $OCF_ERR_GENERIC > fi > > # remove dangling socketfile, if specified > @@ -269,7 +261,7 @@ mysqlproxy_stop() > fi > fi > > - exit $OCF_SUCCESS > + return $OCF_SUCCESS > } > > mysqlproxy_reload() > @@ -291,8 +283,14 @@ mysqlproxy_monitor() > > mysqlproxy_validate_all() > { > - > # @TODO > + > + # check that the MySQL Proxy binary exists and can be executed > + if [ ! -x "$binary" ]; then > + ocf_log err "MySQL Proxy binary '$binary' does not exist or cannot be executed." > + return $OCF_ERR_GENERIC > + fi > + > return $OCF_SUCCESS > } > > @@ -325,13 +323,18 @@ proxy_address=$OCF_RESKEY_proxy_address > > > case $1 in > - start) mysqlproxy_start > + start) mysqlproxy_validate_all > + mysqlproxy_start > + exit $? > ;; > > - stop) mysqlproxy_stop > + stop) mysqlproxy_validate_all > + mysqlproxy_stop > + exit $? > ;; > > reload) mysqlproxy_reload > + exit $? > ;; > > status) if mysqlproxy_status; then > @@ -352,6 +355,7 @@ case $1 in > ;; > > meta-data) meta_data > + exit $? > ;; > > usage) usage > @@ -362,4 +366,3 @@ case $1 in > exit $OCF_ERR_UNIMPLEMENTED > ;; > esac > - > > _______________________________________________________ > Linux-HA-Dev: Linux-HA-Dev [at] lists > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > Home Page: http://linux-ha.org/ _______________________________________________________ Linux-HA-Dev: Linux-HA-Dev [at] lists http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
|