[Top][All Lists]

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

Any idea why this does not work? Using Method parameters in variable def

From: Sven Mueller
Subject: Any idea why this does not work? Using Method parameters in variable definition
Date: Wed, 30 Jun 2004 20:02:50 +0200
User-agent: Thunderbird 0.6 (Windows/20040502)


I have the following in the definition file of a method

---------------- cut here --------------------
        MethodName       = ( InstallLeososPackage )
        MethodParameters = ( filename master_cfinput policyhost )
actionsequence = ( directories files copy shellcommands editfiles )
        tagsdir = ( /var/cfengine/share/installedLeososPackages )
 pkgname = ( ExecResult(
                /bin/bash -c "echo ${filename} | sed -e /_\.\*//"
        pkgversion = ( ExecResult(
                /bin/bash -c
        "/bin/echo ${filename} | sed -e s/\.\*_// | sed -e s,.tbz2,, "
        ) )
        myfilename = ( $(filename) )

installed = ( ReturnsZero(/bin/bash -c "/bin/grep ${pkgversion} ${tagsdir}/${pkgname} > /dev/null 2>&1" ) )

---------------- cut here ------------------------
When expanding the variables in the ExecResult statements, it complaints that it doesn't know variable filename:

cfengine:00:InstallLeososPackage: ExpandVarstring(/bin/bash -c "/bin/echo ${filename} | sed -e s/\.\*_// | sed -e s,.tbz2,, " )
cfengine:00:InstallLeososPackage: Returning substring value filename
cfengine:00:InstallLeososPackage: Scanning variable filename
cfengine:00:InstallLeososPackage: GetMacroValue(private-method,filename)
cfengine:00:InstallLeososPackage: Currently non existent variable $(filename) cfengine:00:InstallLeososPackage: HandleFunction: ExecResult(/bin/bash -c "/bin/echo ${filename} | sed -e s/\.\*_// | sed -e s,.tbz2,, " ) cfengine:00:InstallLeososPackage: cfpopen(/bin/bash -c "/bin/echo ${filename} | sed -e s/\.\*_// | sed -e s,.tbz2,, " ) cfengine:00:InstallLeososPackage: GetExecOutput got: [/bin/bash: -c: option requires an argument]

While I think I have a vague idea of what's going on, this is still pretty depressing because I want the Method to remember the installed version of each package. When I manually set the variables in the control section, the installed class is defined like I want it to, but I would really like to use the "arguments" passed to my method while setting variables.

Is there a way to achieve my goal?


---------------------[ Ciphire Signature ]----------------------
From: address@hidden signed email body (1748 characters)
Date: on 30 June 2004 at 18:00:52 GMT
To:   address@hidden
: The message above has been secured using Ciphire Mail.
: Verify this signature and download your free encryption
: software at The three garbled lines
: below are the sender's verifiable encoded signature.
------------------[ End Ciphire Signed Message ]----------------

reply via email to

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