help-cfengine
[Top][All Lists]
Advanced

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

macros from modules set too late?


From: Martin Andrews
Subject: macros from modules set too late?
Date: Thu, 31 Jan 2002 20:40:07 -0500

I am trying to use a module to define macro values in cfengine-2.0.a16 and I 
cannot get them to take affect.

Here is an example config:
--------
control:
    actionsequence = ( module:environ copy )
#    HOST_SHORT = ( tbd )
#    HOST_SHORT = ( foo )
    moduledirectory = ( "$(CFINPUTS)/scripts" )
    domain = ( dev.netgenics.com )

copy:
    /bin/sh dest=/tmp/$(HOST_SHORT)
--------

Here is the module:
--------
#!/bin/sh
echo "=HOST_SHORT=`hostname | sed 's/\..*//'`"
--------

Running cfagent I get:

    cfengine: Need to link files /tmp/${HOST_SHORT} -> ./bash

If I uncomment the hardcoded values for HOST_SHORT I get:

    cfengine:dhcp8::17: Warning: Redefinition of macro HOST_SHORT=dhcp8
    cfengine: Need to link files /tmp/foo -> ./bash

So it appears that the module is processed and the macro is set before the 
copy is performed, but the the variable was expanded as some prior phase. Any 
ideas? Am I doing something wrong?

Martin



 
--------
Martin Andrews
mandrews@netgenics.com



reply via email to

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