help-cfengine
[Top][All Lists]
Advanced

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

RE: Stumped on editfiles problem


From: Ferguson, Steve
Subject: RE: Stumped on editfiles problem
Date: Tue, 19 Aug 2003 15:05:09 -0400

It seems that this is boiling down to more of my ignorance of the nuances of
cfengine's regex parser.  I still don't understand why one expression will
work on a Solaris 8 box, and not on a 2.6 box, but let's ignore that for the
moment.  Here is one regex that works on the 2.6 box:

CommentLinesMatching "^daytime.*"

I don't like this one because it doesn't extend to the general case.  I at
least want to match a right-most word boundary, because a string like "time"
might match something like "timer" or another longer string I may want to
keep enabled.  I can't figure out how to get a rightmost word boundary
match.  Here's stuff that doesn't result in a match, and I don't understand
why:

CommentLinesMatching "^\<daytime\>.*"
CommentLinesMatching "^daytime\>.*"
CommentLinesMatching "^daytime\W+.*"
CommentLinesMatching "^daytime[:space:].*"
CommentLinesMatching "^daytime\b.*"

Plugging similar expressions into Perl results in a match.

root:cfengine# perl -ne 'print if /^daytime\b.*/;' /etc/inetd.conf
daytime stream  tcp     nowait  root    internal
daytime dgram   udp     wait    root    internal
root:cfengine# perl -ne 'print if /^daytime\W+.*/;' /etc/inetd.conf
daytime stream  tcp     nowait  root    internal
daytime dgram   udp     wait    root    internal

So I'm missing some key piece about the regexes in cfengine.

I don't want to use my first solution, because as I mentioned that doesn't
limit my match to the entire first field.

Help?

Thanks,
Steve


> -----Original Message-----
> From: Ferguson, Steve 
> Sent: Tuesday, August 19, 2003 1:50 PM
> To: 'help-cfengine@gnu.org'
> Subject: Stumped on editfiles problem
> 
> 
> I'm running the same configuration on a Solaris 8 and a 2.6 
> system.  This works as expected on the 8 system, but does 
> nothing on the 2.6 box.
> 
> editfiles:
>   { /etc/inetd.conf
>     SetCommentStart "#"
>     CommentLinesMatching "^\<daytime\>.*"
>     DefineClasses "HupInetd"
>   }
> 
> The relevant lines from inetd.conf look like this on the 2.6 
> box (default shipped with 2.6):
> 
> daytime stream  tcp     nowait  root    internal
> daytime dgram   udp     wait    root    internal
> 
> They looks like this on the 8 system:
> 
> daytime stream  tcp6    nowait  root    internal
> daytime dgram   udp6    wait    root    internal
> 
> Running on the 8 box in debug mode, I see this:
> 
> Edit action: CommentLinesMatching
> Commenting #daytime     stream  tcp6    nowait  root    internal
> Commenting #daytime     dgram   udp6    wait    root    internal
> 
> On the 2.6 box I don't see any "Commenting" actions in the 
> debug output.
> 
> Begin editing /etc/./inet/inetd.conf
> Edit action: SetCommentStart
> Edit action: CommentLinesMatching
> Edit action: DefineClasses
> 
> I've even tried copying inetd.conf from the 8 box to the 2.6 
> box, just to be certain I didn't have any sort of bizarre 
> embedded unprintable characters in the file (od didn't show 
> any).  So I have the same config section and the same target 
> file, but on one system cfengine will make the change and on 
> the other it won't.
> 
> I'm stumped.  Any suggestions on what I'm missing?
> 
> Thanks,
> Steve
> 
> PS. I'm having the same "no op" issue on ALL of my DEC boxes 
> too.  I don't care about them yet, because I haven't been 
> able to get cfservd to run successfully there yet.  It's just 
> an additional data point.
> 
> --
> Steve Ferguson
> gedas USA, Inc.
> Steve.Ferguson@gedas.com
> http://www.gedasusa.com
> 




reply via email to

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