[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PrepModule or actionsequence: Hobson's choice
From: |
Cedric Ware |
Subject: |
Re: PrepModule or actionsequence: Hobson's choice |
Date: |
Fri, 8 Jul 2005 18:50:38 +0200 |
User-agent: |
Mutt/1.5.9i |
> These two cases don't add up to me: if it runs fine when 'do_touch::' is
> replaced by 'class_touch::', that would seem to indicate there is not a
> problem with the "$CFALLCLASSES" being empty.
On the second run of the module, the one in actionsequence, CFALLCLASSES
is indeed defined, and class_touch is activated; if this class is used
directly to trigger the shell command, then it works. On the other hand,
the derived class do_touch is not activated, as if it were too late.
But if the module unconditionnally outputs +class_touch, without first
checking CFALLCLASSES, then that class becomes active on the first run,
the PrepModule one; in this case, do_touch is activated, and able to
trigger the "touch".
> I think I had trouble trying to use the environment variable approach
> too (been awhile since implementing a module), so I pass $(AllClasses)
> as a parameter to the module on the actionsequence line. I remember
A good idea, I thought. However, I need to pass it with PrepModule, not
actionsequence, and when I try the following cfagent.conf, cfagent either
hangs complaining that "Incomplete variable syntax or bracket mismatch"
on the PrepModule line, hogging the CPU; or it just doesn't call the
module.
control:
any::
moduledirectory = ( /tmp/cfengine )
actionsequence = ( module:echo shellcommands )
AddInstallable = ( class_touch do_touch )
groups:
any::
gotinit = ( PrepModule(module:echo,${AllClasses}) )
# Also tried:
#gotinit = ( PrepModule(module:echo,"${AllClasses}") )
#gotinit = ( PrepModule(module:echo, ${AllClasses} ) )
#gotinit = ( PrepModule(module:echo, $(AllClasses)) )
#
# With these two the module just isn't called:
#gotinit = ( PrepModule(module:echo,$(AllClasses)) )
#gotinit = ( PrepModule("module:echo ${AllClasses}", "") )
do_touch = ( class_touch )
shellcommands:
do_touch::
"/bin/touch /tmp/cfengine/touched"
Now, I did see similar problems with variable expansion in the list
archives, but apparently no solution... Anything else?
Regards,
Cedric Ware.