help-cfengine
[Top][All Lists]
Advanced

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

RE: bug in iteration?


From: Wheeler, John
Subject: RE: bug in iteration?
Date: Wed, 1 Jan 2003 12:02:17 -0600

 groups:

   hostname::
      class1 = class2 = class3 = class4 = 1


Can you use Addclasses?

http://www.iu.hio.no/cfengine/docs/cfengine-Reference.html#addclasses

This is only valid in the control section, but I'm not sure that matters.

I've never been able to fully utilize the iteration feature. Can't help much there.

-----Original Message-----
From: Luke A. Kanies
To: address@hidden
Sent: 12/31/2002 4:57 PM
Subject: bug in iteration?

Hi all,

I'm messing with iteration in the shellcommands, and I've found some
strange behaviour.

If I have the following config:

groups:
   myhost )
   two = ( myhost )

control:
   AllowRedefinitionOf = ( variable name )
   testcmd = ( "/bin/echo" )

   one::
      name = ( one )
      variable = ( "${name}" )

   two::
      name = ( two )
      variable = ( "${variable}:${name}" )

   actionsequence = (
      shellcommands.testing
   )


shellcommands:

   testing::
      "${testcmd} ${variable}"

and I run cfagent against it I get:


cfengine:pixie:/bin/echo one: one
cfengine:pixie:/bin/echo two: two

But I make the following change:

   one::
      name = ( one )
      variable = ( "${variable}:${name}" )

I get the following output:

cfengine:pixie:/bin/echo ${var: :one:one:two
cfengine:pixie:/bin/echo one: one
cfengine:pixie:/bin/echo two: two

In other words, if a variable starts with the iteration character, then
the first time the shellcommand is run it is run with the entire
contents
of the variable, the iteration character is removed, and then the
variable
is iterated over normally.

This seems like a bug to me, but can anyone confirm that?

Also, can anyone explain to me why 'one' is getting added to the
variable
twice?  Is it because cfengine makes two passes?  If so, why isn't 'two'
being added twice?

And if anyone can provide a better way to set dummy classes than the way
I
am using, I'd love to hear about it.  I would like a simple method of
setting a bunch of classes, conceptually similar to this:

groups:

   hostname::
      class1 = class2 = class3 = class4 = 1

I know, this type of syntax doesn't work in cfengine, but I want a
relatively simple way to set a bunch of classes based on whether another
class is set.  Cfengine seems to prefer I use modules to do that, and I
would really prefer not to.

Thanks,
Luke

--
You can't have everything.  Where would you put it?
                -- Stephen Wright



_______________________________________________
Help-cfengine mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-cfengine


reply via email to

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