AlexanderKrauth/resource-agents — comment on commit 9ded560e14dde4590c9f88fc065611e660a1ae56
File: heartbeat/SAPDatabase line 94
By dmuhamedagic:

On Tue, Feb 14, 2012 at 01:50:15AM -0800, Alexander Krauth wrote:
> > How probable it is that "old" installations may break? And how
> > old are those installations?
[...]
> So, if I got you correct. You think about an agent that has both,
> the new and the old code in it. If we find the executable of the
> required daemon, we use the new functions, otherwise the
> old once.
> I think that is doable. In that case I would separate the old
> funcionality into specific functions. So there would be functions
> like:
> start
> start_old
> stop
> stop_old
> ...
> That would it make easier to remove it in the future.
>
> Is this a valid solution ?

Sure. You can also split the RA and source the appropriate set of
functions. Something like:

if this_installation_can_run_2.0; then
. sapdb-2.x.sh
else
. sapdb-1.x.sh
fi
sapdb_validate
case "$1" in
start) sapdb_start;;
...

Both files would then contain functions with same names. Of
course, you should organize the code in such a way so that
there's no code repetition.

There's an extra directory where one can install files to be
sourced (currently, only the apache RA is split). That's where
ocf-shellfuncs is installed too.