One more approach, that doesn't require any file copying or tempfile
storage, is to build the file entirely with cfengine, like this yum.conf
example, where 3 variables are set depending on network segment, server
class, and whether it's a 'new build' or not:
{ /etc/yum.conf
EmptyEntireFilePlease
AppendIfNoSuchLine "[main]"
AppendIfNoSuchLine "cachedir=/var/cache/yum"
AppendIfNoSuchLine "pkgpolicy=newest"
AppendIfNoSuchLine "tolerant=1"
AppendIfNoSuchLine "exactarch=1"
AppendIfNoSuchLine "retries=3"
AppendIfNoSuchLine "exclude=${YumExcludes}"
AppendIfNoSuchLine "${LogString}"
AppendIfNoSuchLine "[base]"
AppendIfNoSuchLine "name=${packageserver} common rpm
repository"
AppendIfNoSuchLine "baseurl=ftp://${packageserver}"
AutoCreate
}
As with some of the other examples, cfengine doesn't actually rewrite
the file unless it's necessary. This is well-suited for short files,
would be a little bit of a pain to generate long files this way.
-Ed
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine