help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

methods


From: Brendan Strejcek
Subject: methods
Date: Tue, 6 Apr 2004 12:45:47 -0500
User-agent: Mutt/1.3.28i

I'm trying to learn how to use methods. This is the simplest test case
I have been able to construct.

    # cat /var/cfengine/modules/hello_method 
    control:
    
        MethodName = ( hello_world )
        MethodParamaters = ( null )
    
        actionsequence = (
            timezone
        )
    
    alerts:
    
        "hello world"
    
        ReturnVariables(void)
        ReturnClasses(void)

And here is my test method call:

    control:
    
        actionsequence = (
            methods
        )
    
    methods:
    
        any::
    
            hello_world(null) # function defined in method file
    
            action=hello_method # method file name
            server=localhost
            returnclasses=null
            returnvars=null

The reference suggests that this should print hello world, but it does
not for me. I also tried the classes: force = ( any ) trick and used
that in my method alerts section, but that did not make it work.

I think my problem might be (extracted from some -d 2 output included
below):

    Filename /var/cfengine/rpc_in/. is classified as ignorable
    Filename /var/cfengine/rpc_in/.. is classified as ignorable

But the reference does not mention access control to rpc_in in the
localhost examples. Are there maybe some control: variables I need to
set so that methods will be executed?

    # cfagent --version | head -1
    GNU cfengine 2.1.3
    # cfagent -qIKf method
    #

Here is some -d 2 output:

------------------------------------------------------------

DEFINED METHODS
 
 
 METHOD: [hello_world] if class (any)
   IfElapsed=1, ExpireAfter=120
   Executable file: hello_method
   Run with Uid=-1,Gid=-1
   Run in chdir=, chroot=
   Send arg 1: null
   Encrypt for server 1: localhost
   Return value 1: $(hello_world.null)
   Return class 1: null
------------------------------------------------------------

---------------------------------------------------------------------
Dispatching new methods   
---------------------------------------------------------------------
                          
ChecksumList(m)           
                          
Dispatch method localhost:hello_world to /var/cfengine/rpc_in
ChecksumList(m)           
EncapsulatingMethod(/var/cfengine/rpc_in/localhost_localhost_hello_world_MD5=37a6259cc0c1dae299a7866489dff0bd)
Packaging done            
Create arg_file 
/var/cfengine/rpc_in/localhost_localhost_hello_world_MD5=37a6259cc0c1dae299a7866489dff0bd_1
ExpandVarstring(null)     
---------------------------------------------------------------------
Evaluating incoming methods that policy accepts...
---------------------------------------------------------------------
                          
GetPendingMethods(0) in (/var/cfengine/rpc_in)
Processing applications...
Filename /var/cfengine/rpc_in/. is classified as ignorable
Filename /var/cfengine/rpc_in/.. is classified as ignorable
Found an attachment (add_MD5=e53b6d14f2b0d3440b02e00d3893bb50) to incoming 
method openbsd                 
Found an attachment (add_MD5=e53b6d14f2b0d3440b02e00d3893bb50_1) to incoming 
method openbsd               
Found an attachment (add_MD5=8c71236408d209d138b806fbcbd6aab6) to incoming 
method openbsd                 
Found an attachment (add_MD5=8c71236408d209d138b806fbcbd6aab6_1) to incoming 
method openbsd               
Found an attachment (MD5=37a6259cc0c1dae299a7866489dff0bd) to incoming method 
hello                       
Found an attachment (MD5=37a6259cc0c1dae299a7866489dff0bd_1) to incoming method 
hello                     
---------------------------------------------------------------------
Fetching replies to finished methods
---------------------------------------------------------------------
                          
GetPendingMethods(1) in (/var/cfengine/rpc_in)
Processing applications...
Filename /var/cfengine/rpc_in/. is classified as ignorable
Filename /var/cfengine/rpc_in/.. is classified as ignorable
Found an attachment (add_MD5=e53b6d14f2b0d3440b02e00d3893bb50) in reply to 
openbsd                        
Found an attachment (add_MD5=e53b6d14f2b0d3440b02e00d3893bb50_1) in reply to 
openbsd                      
Found an attachment (add_MD5=8c71236408d209d138b806fbcbd6aab6) in reply to 
openbsd                        
Found an attachment (add_MD5=8c71236408d209d138b806fbcbd6aab6_1) in reply to 
openbsd                      
Found an attachment (MD5=37a6259cc0c1dae299a7866489dff0bd) in reply to hello
Found an attachment (MD5=37a6259cc0c1dae299a7866489dff0bd_1) in reply to hello





reply via email to

[Prev in Thread] Current Thread [Next in Thread]