Dear cfengine people, I know that the usage of Exec* functions with convoluted shell oneliners is not a sign of good cfengine practices, but I do want to use them from time to time, and period breakages of what was working before annoyed me previously, and now I just couldn't make old lines working as before... I spent good few hours playing around but that is enough...
I'm running Debian sid with cfengine2 2.1.20-1 now. To overcome all issues with Exec*Result being illogical, not well documented to make sense of the syntax, I wrote a tiny wrapper: #!/bin/bash # BUCK QUOTE BACK PIPE SEMI dict='@B@:$ @Q@:" @A@:\\ @P@:| @S@:;' args="$@" for pair in $dict; do key=${pair%:*} value=${pair#*:} args=$(echo $args | sed -e "s/$key/$value/g") done bash -c "$args" Now, from within cfengine config files I have lines like: RCSRev = ( ExecResult("/usr/local/sbin/shh echo $Revision: 1.17 $ @P@ /usr/bin/cut -f2 [EMAIL PROTECTED]@ @Q@") ) RCSFile = ( ExecResult("/usr/local/sbin/shh echo $RCSfile: cf.main,v $ @P@ /usr/bin/cut -f2 [EMAIL PROTECTED]@ @Q@") ) outiface = ( ExecResult("/usr/local/sbin/shh route -n @P@ awk @Q@/^0.0.0.0/{print @A@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@Q@") ) lociface = ( ExecResult("/usr/local/sbin/shh route -n @P@ awk @Q@/^10.0.0.0/{print @A@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@Q@") ) Yes -- they are convoluted but a. I hope them to survive through unexpected changes in cfengine handing of the arguments to Exec* b. I can easily debug such calls from the command line c. I can easily expand the dictionary to accommodate other symbols (I bet I might need () ) I just wanted to share... you might say that it is a very nasty way to do things, and there might be a cleaner way, but I gave up -- nice howto/standard might resolve the ambiguity. -- Yaroslav Halchenko Research Assistant, Psychology Department, Rutgers-Newark Office: (973) 353-5440x263 | FWD: 82823 | Fax: (973) 353-1171 101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07102 Student Ph.D. @ CS Dept. NJIT _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org http://cfengine.org/mailman/listinfo/help-cfengine