[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cfengine-develop] Cfengine procedure calls
From: |
Mark Burgess |
Subject: |
[Cfengine-develop] Cfengine procedure calls |
Date: |
Mon, 12 May 2003 12:31:49 +0200 (MEST) |
I am slowly (oh so slowly) getting around to the things that have
been promised in cfengine 2.1 and the next thing on the list is
procedure calls (modules).
Here we need something that can do formally:
returnvalues = function(parameters)
Then there are all kinds of questions, such as scope of
variables. I have tried to think up an approach that will be
good enough for local or remote procedure calls.
I suppose that separate functions will be run as separate processes.
The protocol will be such that either cfengine files or general scripts
will be able to execute modules, though files not written in cfengine
are kind of dangerous since they needn't be convergent.
As for syntax, here is a suggestion. I am open for comments:
----------------------------------------------------------------------------
# Here we declare a procedure call
procedures:
classes::
MyFunctionName("param1","param2",ReadFile(file)) # name is just an ID
file=/var/cfengine/inputs/specialproc.cf
server=hostname # for "voluntary" RPC
# We need some kind of security when passing back values, or
it might be possible for other systems to spam su with huge files
during remote procedure calls, so place length limits on the return
data size
returns=name(8b,local),number(16b,local),value(4kB,global)
--------------------------------------------------------------------------
In a procedure file - looks like a regular cfengine program but with
declaration...
--------------------------------------------------------------------------
control:
ProcedureContext = ( "function-name" )
Arguments = (var1,var2,var3)
# reads a file /var/cfengine/functions/args_function_host-timestamp-or-nonce?
#
# + classes
# - classes
# =value=variable
# Delete file on successful completion or error
actionsequence = ( files procedures copt procedures )
---------------------------------------------------------------------------
Procedure returns values to mother as modules do, using alert functions
---------------------------------------------------------------------------
alerts:
# Then since procedures are cfengine scripts, scripts need to communicate
ReturnClasses(classname1,classname2..)
ReturnValue(variable=value1)
# Writes to a file /var/cfengine/returns/return_function_host
#
# + classes
# - classes
# =value=variable
Glad for considered comments.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272 Email: address@hidden
Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cfengine-develop] Cfengine procedure calls,
Mark Burgess <=