[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfengine-help
Subject:    Any idea why this does not work? Using Method parameters in variable
From:       Sven Mueller <sm () leogic ! com>
Date:       2004-06-30 18:02:50
Message-ID: 40E3004A.1000905 () leogic ! com
[Download RAW message or body]

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 ]----------------



_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic