help-cfengine
[Top][All Lists]
Advanced

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

Variable substitution using builtin functions


From: Peter Sevborn
Subject: Variable substitution using builtin functions
Date: 4 Aug 2004 06:54:10 -0700

Hi folks,

Maybe this is covered in the manuals or this forum but I did'nt find
it. If it exists please point me in the correct direction.

I have the following simple test config.

# cat test2.conf
groups:
  cfgroups_exists = ( FileExists($(CFINPUTS)/cf.groups) )
control:
  actionsequence = ( shellcommands )
alerts:
  cfgroups_exists::
    "cfgroups_exists defined"

Running cfagent -f ./test2.conf doesn't define cfgroups_exists.

However if I change
cfgroups_exists = ( FileExists($(CFINPUTS)/cf.groups) )
to
cfgroups_exists = ( FileExists(${CFINPUTS}/cf.groups) )
cfgroups_exists gets defined.

What is the difference between parenthesis and curly brackets arround
a variable using a builtin function? Did I miss something in the
documentation?

Tanks,
Peter


Running cfagent -d1 -f ./test2.conf produces the following ouput about
Groups: section when using parenthesis around the variable.

==============================BEGIN NEW ACTION Groups:=============


Resetting CLASS to ANY

LVALUE cfgroups_exists
HandleLVALUE(cfgroups_exists) in action Groups:
EQUALS =
LEFTBRACK
RVAL-VAROBJ FileExists($(CFINPUTS)/cf.groups)

HandleGroupRvalue(FileExists($(CFINPUTS)/cf.groups))
ExpandVarstring(FileExists($(CFINPUTS)/cf.groups))
ExtractInnerVarString(CFINPUTS)/cf.groups)) - syntax verify
HandleGroupRVal(FileExists(/var/tmp/cf.groups)) group
(cfgroups_exists), type=0
-)
[No match of class FileExists(/var/tmp/cf.groups)]

RIGHTBRACK

   (No actions pending in Groups:)
InitializeAction()
   (No actions pending in Groups:)


==============================BEGIN NEW ACTION Control
Defintions:=============


Running cfagent -d1 -f ./test2.conf produces the following ouput about
Groups: section when using curly brackets around the variable.

==============================BEGIN NEW ACTION Groups:=============


Resetting CLASS to ANY

LVALUE cfgroups_exists
HandleLVALUE(cfgroups_exists) in action Groups:
EQUALS =
LEFTBRACK
RVAL-FUNCTION FileExists(${CFINPUTS}/cf.groups)
HandleFunctionObject(FileExists(${CFINPUTS}/cf.groups))
IsBuiltinFunction(FileExists(${CFINPUTS}/cf.groups))
IsBuiltinFunction: FileExists(${CFINPUTS}/cf.groups)
ExpandVarstring(${CFINPUTS}/cf.groups)
ExtractInnerVarString(CFINPUTS}/cf.groups) - syntax verify
HandleFunction: FileExists(/var/tmp/cf.groups)
ExpandVarstring(any)
HandleGroupRVal(any) group (cfgroups_exists), type=0
AddClassToHeap(cfgroups_exists)
RIGHTBRACK

   (No actions pending in Groups:)
InitializeAction()
   (No actions pending in Groups:)


==============================BEGIN NEW ACTION Control
Defintions:=============


reply via email to

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