[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) |
Hi.
I have the following in the definition file of a method
---------------- cut here --------------------
control:
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) )
classes:
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?
regards,
sven
--
---------------------[ Ciphire Signature ]----------------------
From: sm@leogic.com signed email body (1748 characters)
Date: on 30 June 2004 at 18:00:52 GMT
To: help-cfengine@gnu.org
----------------------------------------------------------------
: The message above has been secured using Ciphire Mail.
: Verify this signature and download your free encryption
: software at www.ciphire.com. The three garbled lines
: below are the sender's verifiable encoded signature.
----------------------------------------------------------------
00fAAAAAEAAADU/+JA1AYAAEwEAAIAAgACACA2A1N0anFAjhISsXqfspQ17ONB+Y
6A9ebgf4EvPUUdWwEAZ8hoc7VVY9dHDJGN9IMnlKpqZgaQgRfmZl6cjXlBQ4+cLr
pEYvc+gvNJ0v5qzVikF1wpOeYNdq34wUHvBWIzug==
------------------[ End Ciphire Signed Message ]----------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Any idea why this does not work? Using Method parameters in variable definition,
Sven Mueller <=