help-cfengine
[Top][All Lists]
Advanced

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

Re: multiple edits on one file?


From: Alexander Mattausch
Subject: Re: multiple edits on one file?
Date: Thu, 20 Jan 2005 11:01:29 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20041207)

Don Harper schrieb:
Based on various classes being defined, I want to edit one file.

Now, given that I have three classes defined in a module
[HaveGold,HaveBronze, and HaveGranite], I want to do something like
this:

any::
 { /tmp/file
    DeleteLinesContaining "/tmp"
    AppendIfNoSuchLine "LABEL=/local"
    DeleteLinesContaining "/gold"
    DeleteLinesContaining "/ "
    DeleteLinesContaining "/bronze"
    DeleteLinesContaining "/granite"
    AppendIfNoSuchLine "LABEL=/v-$(gold)"
  }

 HaveBronze::
  { /tmp/file
    AppendIfNoSuchLine "LABEL=/v-$(bronze)"
  }

 HaveGranite::
  { /tmp/file
    AppendIfNoSuchLine "LABEL=/v-$(granite)"
  }

Now, the any:: section runs, just like it should.  But, the other two
never run, even if one or both of the classes are defined.  The classes
get defined from a module defined, and they are listed in
AddInstallable.  Any clues?

It may also help to use a single editfile-statement and use the BeginGroupIfDefined statement.

Alex




reply via email to

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