[OCF]Resource Agent Environment variables

Alan Robertson ocf@lists.community.tummy.com
Fri, 18 Jul 2003 17:14:10 -0600


Hi,

One of our goals for resource agent scripts is to have them be compatible 
with LSB init scripts.  Part of the difference between these init scripts 
and resource agents is the possibility for resource agents to take 
parameters via the environment.

In practice, many LSB init scripts already take parameters - but through a 
configuration file, not through the environment.  Typically the have a "." 
construct in them like this:
	
	. /etc/sysconfig/syslog
Files like /etc/syslog/sysconfig then have variables set in them like this:

	SYSLOGD_PARAMS="-r"
	KLOGD_PARAMS="-2"
	SYSLOGD_ADDITIONAL_SOCKET_DHCP="/var/lib/dhcp/dev/log"

Then later on in the script, they are referenced as normal shell variables. 
  This is *very* similar to what we are trying to do.

So, one could make this script usable as both a resource agent, and an init 
script, one could change that first line so that it looked more like this:
	test "X$OCF_RA_VERSION_MAJ" = X && . /etc/syconfig/syslog

And then this script could be called either as an OCF resource script, or as 
an init script with very minimal changes.  However, there is one rub, which 
I'd like to make go away...

In Section 3.5.1, the spec says:
> 3.5.1. Syntax for instance parameters
> 
> They are directly converted to environment variables; the name is prefixed
> with "OCF_RESKEY_".
> 
> The instance parameter "force" with the value "yes" thus becomes:
> 	OCF_RESKEY_force=yes
> in the environment.
> 
> See section 4. for a more formal explanation of instance parameters

This make it incompatible with common usage in current init scripts.  And, 
given the advantages that we *almost* have, I'd like to drop the prefix from 
environment variables.  This would make it more palatable, I think, and 
easier to treat an only-slightly-hacked init script directly as an init 
script.  A proposed new Section 3.5.1:

-------------------------------------------------------------------------
3.5.1. Syntax for instance parameters

They are directly converted to environment variables.  There is no prefix 
added to the environment variables.

The instance parameter "force" with the value "yes" thus becomes:
	force=yes
in the environment.

See section 4. for a more formal explanation of instance parameters.
-------------------------------------------------------------------------


Comments?
-- 
     Alan Robertson <alanr@unix.sh>

"Openness is the foundation and preservative of friendship...  Let me claim 
from you at all times your undisguised opinions." - William Wilberforce