[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Réf. : problems with LocateLineMatching regex
From: |
paguerlais |
Subject: |
Réf. : problems with LocateLineMatching regex |
Date: |
Fri, 1 Aug 2003 10:44:08 +0200 |
When you use regexps within cfengine, your regexp must match the entire
line (from ^ t o $). You must think of regexps mostly like expr regexps,
not like Perl regexps.
Therefore, your LocateLineMatching regexp can't match /var/log/httpd/...
You should write :
LocateLineMatching '.*/httpd.*log[:space:]+{[:space:]*'
HIH
Patrice
help-cfengine-bounces+paguerlais=airfrance.fr@gnu.org@spacepants.org> le
01/08/2003 08:28:05
Envoyé par : Jamie Wilkinson <jaq@spacepants.org>
Pour : help-cfengine@gnu.org
cc :
Objet : problems with LocateLineMatching regex
I'm having some problems getting a regex to match a line in a logrotate
config file.
The editfiles section looks like this:
{ /etc/logrotate.d/httpd
Backup 'off'
LocateLineMatching 'httpd.*log[:space:]+\{[:space:]*$'
BeginGroupifNoMatch '^/var/log/httpd/\*_log /var/log/httpd/\*\*_log
\{$'
ReplaceLineWith '/var/log/httpd/*_log /var/log/httpd/*/*_log {'
EndGroup
}
and the file in question looks like:
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2>/dev/null ||true
endscript
}
(default /etc/logrotate.d/httpd from Red Hat 9)
Nothing happens to the file, and the following message appears when cfagent
is run in verbose mode:
Begin editing /etc/logrotate.d/httpd
Edit: Search for httpd.*log[:space:]+\{[:space:]*$ failed. Current line
still 1
LocateLineMatchingRegexp failed in /etc/logrotate.d/httpd, aborting editing
End editing /etc/logrotate.d/httpd
Interestingly, if I change the first regex to just '\{$' the search also
fails. There is no space between the { and the end of line in the actual
file. A regex of '[{]$' also fails.
I am using cfengine 2.0.4 on this machine; I have not yet had time to
upgrade my cfengine RPMs for my network unfortunately.
Any ideas?
--
jaq@spacepants.org http://spacepants.org/jaq.gpg
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine
- Réf. : problems with LocateLineMatching regex,
paguerlais <=