help-cfengine
[Top][All Lists]
Advanced

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

Re: editfiles template; multiple edits; setting a class on update


From: Atom Powers
Subject: Re: editfiles template; multiple edits; setting a class on update
Date: Fri, 13 Jan 2006 22:33:41 -0800

So you are bumping the version of every file when any file changes?
Won't that trigger a restart every time?
Anyway, I doubt that will work for me; I'm not using m4, make, or
(overtly) time stamps.

I suppose I could grab my svn version number; but then the problem
gets worse, as it will certainly cause every service to restart every
time any config files are changed.

Right now the only solution I see is to:
1. checkout the config tree.
2. copy the config tree to a staging area.
3. use editfiles to modify the files in the stage.
4. copy the staging tree into the system and activate a restart as necessary.

But that's an awful lot of work...

Maybe subversion has some tools I can use to manage versions of
individual files; but even then a single file on the system may be
changed by two or more config files. So unless I have every config
file write it's own version number (which will require a lot of
ExecResult processes to get the current version) I'm back to the
copy-edit-copy procedure.

On 1/13/06, Russell Adams <RLAdams@adamsinfoserv.com> wrote:
> You're absolutely correct. The trigger is the version number, which my
> current macros use a timestamp which is written to the template when
> the m4 file is converted to a cfengine file.
>
> Because I use make to handle compiles, simply touching a m4 file will
> trigger a rewrite of the file on the hosts after my configs are
> recompiled.
>
> Russell
>
> On Fri, Jan 13, 2006 at 02:58:01PM -0800, Atom Powers wrote:
> > I looked at your wiki docs.
> > How do you enforce your editfiles action without changing the RCS
> > version? Correct me if I'm wrong, but it looks like your editfiles
> > block won't begin unless your template has changed.
> >
> > On 1/13/06, Adams, Russell L. <RLAdams@kelsey-seybold.com> wrote:
> > > I use my editfiles functions (ReplacementEdit and BlockEdit) for
> > > exactly this.
> > >
> > > I have an editfiles statement that rewrites the entire file
> > > (ReplacementEdit) if a new version is present, and then multiple
> > > BlockEdits that see if their block is current or missing and adds them
> > > if thats the case.
> > >
> > > Then of course I trigger a restart if the file was edited.
> > >
> > > See:
> > >
> > > http://cfwiki.org/cfwiki/index.php/Editfiles_Examples
> > > http://cfwiki.org/cfwiki/index.php/Managing_Blocks_of_Code_with_Editfiles
> > >
> > > I've m4 macroed these and the version numbering, so if I update the m4
> > > file the version number is updated which forces the file to be
> > > rewritten entirely, and defines additional classes for me to trigger
> > > events with.
> > >
> > > I could provide some code examples, etc, if you like.
> > >
> > > Russell
> > >
> > > On Fri, Jan 13, 2006 at 09:23:15AM -0800, Atom Powers wrote:
> > > > I have a situation, many of them in fact, where I want to create a
> > > > template file, make multiple edits to it, and then restart a service
> > > > if the destination file is updated. How can I manage my editfiles
> > > > without restarting the service every time cfengine runs?
> > > >
> > > > I could do my editfiles on "$(FileSource)/common/etc/inetd.conf"; but
> > > > then that file would be copied from the masterfiles server every time
> > > > cfengine runs.
> > > >
> > > > How have you solved this problem?
> > > >
> > > > For example:
> > > > I have a default inetd.conf file, with sshd in it.
> > > > --
> > > > copy::
> > > >       $(FileSource)/common/etc/inetd.conf
> > > >       dest=/etc/inetd.conf
> > > >       mode=664        owner=root      group=wheel
> > > > --
> > > > Some hosts run ftp, others run nntp:
> > > > --
> > > > editfiles:
> > > >   ftp-server::
> > > >       {  /etc/inetd.conf
> > > >       AppendIfNoSuchLine "ftp    stream  tcp nowait  root
> > > > /usr/libexec/ftpd   ftpd -l"
> > > >        DefineClasses "newinetd"
> > > >        }
> > > >
> > > >   nntp-server::
> > > >       {  /etc/inetd.conf
> > > >       AppendIfNoSuchLine "nntp   stream  tcp     nowait  news
> > > > /usr/local/libexec/nntpd        nntpd"
> > > >        DefineClasses "newinetd"
> > > >        }
> > > > --
> > > > Then I restart inetd if the config file changed:
> > > > --
> > > > shellcommands:
> > > >   newinetd::
> > > >     "/etc/rc.d/inetd restart"
> > > > --
> > > >
> > > > This will modify inetd.conf, and thus restart inetd, every time.
> > > >
> > > >
> > > > --
> > > > --
> > > > Perfection is just a word I use occasionally with mustard.
> > > > --Atom Powers--
> > > >
> > > >
> > > > _______________________________________________
> > > > 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
> > >
> >
> >
> > --
> > --
> > Perfection is just a word I use occasionally with mustard.
> > --Atom Powers--
> >
> >
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org
> > http://lists.gnu.org/mailman/listinfo/help-cfengine
> >
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine
>
>
>
>


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--




reply via email to

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