Thought I'd try again. Is there additional information I can provide to get traction on the issue described below?
Thanks, .sf On Fri, 2005-04-15 at 10:52 -0700, Stephen Fromm wrote: > On Thu, 2005-04-14 at 23:35 +0200, Grzegorz Marszałek wrote: > > Hello! > > > > I'm trying do write a method, which will then proceed differently based > > on parameter passed to it. The problem is that I cannot define class > > based on string in variable, BUT, which is funny but confusing, I CAN > > use this variable in editfiles section without problems! It seems, that > > arguments passed to methods are created AFTER classes section was > > evaluated. Any ideas, what to do about that? Passing class to method > > possibly would solve my problem of course, but then whole idea of using > > methods in my system (I'd like to use them, because they could very > > clearly isolate some components - ie.: to play with Kerberos you have > > one method, and you can play with it only via parameters defined by > > desiger of module). Of course I can use few methods as well, but still > > this strange behaviour of cfengine is at best confusing... > > I'm encountering a similar problem with methods. In my case, I'm > passing 6 arguments to the method Simple: > > Simple("/var/adm","messages","root","root","0640","14") > action=cf.simple > server=localhost > returnvars=alpha > returnclasses=null > > The method is pretty simple for testing purposes: > > groups: > doit = ( any ) > > control: > MethodName = ( Simple ) > MethodParameters = ( dir file owner group mode age ) > actionsequence = ( shellcommands ) > > shellcommands: > "/bin/echo vars: $(dir) $(file) $(owner) $(group) $(mode) $(age)" > > files: > $(dir)/$(file) owner=$(owner) group=$(group) mode=$(mode) > action=touch > > alerts: > doit:: > "Testing received vars: ${dir} ${file} ${owner} ${group} > ${mode} ${age}" > ReturnVariables( ${dir} ${file} ${owner} ${group} ${mode} > ${age}" ) > ReturnClasses( success ) > > When cfagent is evoked, parsing of cf.simple fails with the following > errors: > > cfengine::Simple: cf:cfengine::/var/cfengine/modules/cf.simple:19: Invalid > mode string ($(mode)) > cfengine::Simple: cfengine::/var/cfengine/modules/cf.simple:19: Warning: mode > string is incomplete > > If I comment out the files section, the file is parsed successfully and > everything works as expected. Likewise, I can include the same files > section in cfagent.conf with $(mode) defined in control and cfagent.conf > will parse successfully. Alternatively, I can define $(mode) in > cf.simple's control block and the file will parse successfully. > However, in the last case I don't get the value I passed to the method > for that variable. > > shellcommands does what you would expect and echo's the values to all 6 > variables. All of the variables are returned to the calling process. > > Any ideas on what's going on? :-) > > Thanks, > > .sf > > > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@gnu.org > http://lists.gnu.org/mailman/listinfo/help-cfengine _______________________________________________ Help-cfengine mailing list Help-cfengine@gnu.org http://lists.gnu.org/mailman/listinfo/help-cfengine