[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need 'UncommentAndSetValue' or some such
From: |
Russell Adams |
Subject: |
Re: Need 'UncommentAndSetValue' or some such |
Date: |
Tue, 25 Oct 2005 11:42:21 -0500 |
User-agent: |
Mutt/1.4.2.1i |
You and your m4 habit.
Russell
On Tue, Oct 25, 2005 at 11:03:59AM -0500, Adams, Russell L. wrote:
> Thats what m4 is for.
>
> Russell
>
> On Tue, Oct 25, 2005 at 10:03:32AM -0400, David Scott Coburn wrote:
> >
> > In many of my cfagent script I have constructs like this:
> >
> > editfiles:
> >
> > { /etc/postfix/main.cf
> > BeginGroupIfNoSuchLine "mydestination = $(host), $(fqhost),
> > localhost"
> > DeleteLinesMatching "^mydestination.*"
> > Append "mydestination = $(host), $(fqhost), localhost"
> > EndGroup
> > BeginGroupIfNoSuchLine "mydomain = $(domain)"
> > DeleteLinesMatching "^mydomain.*"
> > Append "mydomain = $(domain)"
> > EndGroup
> > DefineClasses "restart_postfix"
> > }
> >
> > The bit that bugs me the most about this construct is the repetition
> > of the text I am searching for and the text to replace it with.
> >
> > What would be nifty would be something like this:
> >
> > editfiles:
> >
> > { /etc/postfix/main.cf
> > UncommentAndSetValue "mydestination =" "$(host), $(fqhost),
> > localhost"
> > UncommentAndSetValue "mydomain =" "$(domain)"
> > DefineClasses "restart_postfix"
> > }
> >
> > The first argument would be the variable that get its value changed,
> > and the second argument would be what it gets set to.
> >
> > If the value was already set then nothing would happen. If a variable was
> > changed then the DefineClass would happen. If the variable was commented
> > out
> > then it would be uncommented and set to the given value.
> >
> > It seems like this kind of setting of variables in config files to some
> > value is half of what I use cfengine for and this would be a whole lot
> > easier to set up and then maintain.
> >
> > Perhaps there is already a better way to do it that I have not found in
> > the manual yet?
> >
> > Thanks,
> >
> > Scott
> >
> > --
> > * David Scott Coburn
> > * Brookhaven National Laboratory
> > * scott@bnl.gov 631.344.7110
> > * "Assume a spherical cow of uniform density..."
> > _______________________________________________
> > 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
>
------------------------------------------------------------------
Russell Adams RLAdams@AdamsInfoServ.com
PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/
Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
pgp_VR5oY8O_r.pgp
Description: PGP signature
- Need 'UncommentAndSetValue' or some such, David Scott Coburn, 2005/10/25
- Re: Need 'UncommentAndSetValue' or some such, Paul Krizak, 2005/10/25
- Re: Need 'UncommentAndSetValue' or some such, Brendan Strejcek, 2005/10/25
- Re: Need 'UncommentAndSetValue' or some such, Adams, Russell L., 2005/10/25
- Re: Need 'UncommentAndSetValue' or some such,
Russell Adams <=
- Re: Need 'UncommentAndSetValue' or some such, Brian C. Hill, 2005/10/25
- Message not available
- Message not available