Joel Majka wrote:
> I also couldn't find a way to concatenate variables. For example, I'd
> like to InsertLine in my editfiles stanza for the localhost definition
> in my /etc/hosts. To do this, I wanted to use the built-in $(host)
> variable plus some text like:
>
> InsertLine "127.0.0.1 $(host)"
>
> or even split it into two lines like:
>
> myvar = "127.0.0.1 " + $(host)
> InsertLine "$(myvar)"
My guess is that the problem is InsertLine. Are you using it within a
BeginGroup/EndGroup contruct? The manual says: "This should probably be
used in conjunction with the conditional begin-end tests to avoid lines
being inserted on every run," but I think it means "must" rather than
"should."
I would do:
{ /etc/hosts
DeleteLinesContaining "${host}"
AppendIfNoSuchLine "127.0.0.1 ${host}"
}
That should work. In won't update the file unless the edited buffer
differs from the on-disk copy, so despite the fact that I am using
a delete command, most of the time if won't get edited.
If you give us the exact editfiles stanza you are using, we can make
other suggestions.
_______________________________________________
Help-cfengine mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cfengine