help-cfengine
[Top][All Lists]
Advanced

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

Re: LocateLineMatching madness


From: Paul Krizak
Subject: Re: LocateLineMatching madness
Date: Tue, 11 May 2004 14:29:10 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Yes this would be a fantastic feature to have. I'm currently trying to put together an editfiles: routine to set up serial console support on our servers.

To set this up, I've got to edit the grub.conf file. The "kernel" line is obviously different for servers with different kernel versions, etc. So I'd like to be able to take a line that looks like this:

kernel /vmlinuz-2.4.23-bangalore3-02 ro root=/dev/hda2 hdc=ide-scsi apm=power-off

or like this:

kernel /vmlinuz-2.4.21-bangalore2-04 ro root=/dev/hda2 apm=power-off console=tty0,9600 console=ttyS0,9600

(note that one has an "hdc=ide-scsi" while the other doesn't, and the kernel versions are different)

I could set the appropriate console speed using classes and the control: section, then in the editfiles: section do something like this:

ReplaceAll "(kernel.*power-off).*" "\1 console=tty0,9600 console=ttyS0,9600"

and essentially append the correct console settings while effectively ignoring the kernel version and kernel options (and correct any incorrect console settings in the process)

Paul Krizak                         5900 E. Ben White Blvd. MS 625
Advanced Micro Devices              Austin, Tx  78741
MPD Linux Systems                   Phone: (512) 602-5860
Paul.Krizak@amd.com



Steve Wray wrote:

On Thursday 06 May 2004 09:45, Tod Oace wrote:
On May 5, 2004, at 05:40, Alexander Jolk wrote:
[snip]
Seems like it would be nice if we had something like:

ReplaceAllLinesMatching "URI.*" With "URI ldap://localhost/";

That *seems* convergent and safe to me but maybe someone else can see
a problem with it. If it doesn't work, how about:

CompleteAllLinesBeginning "URI " With "ldap://localhost/";

Actually, I'd been thinking it would be *really* nice to have some sort of 'capture' functionality ie;

ReplaceRegexMatching "(URI ldap://)foo/" "\1bar/"

so we would go from a line
URI ldap://foo
to a line;
URI ldap://bar

Not a fantastic example, but you get the picture.


_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine





reply via email to

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