Cfengine Help: Re: edit_lines convergence

2010-12-12 Thread no-reply
Forum: Cfengine Help Subject: Re: edit_lines convergence Author: brawsky Link to topic: https://cfengine.com/forum/read.php?3,19673,19722#msg-19722 Thanks for the info. + +" ___ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengin

Re: edit_lines convergence

2010-12-11 Thread Mark Burgess
And thanks for your thanks! On 12/11/2010 01:09 PM, Daniel Dehennin wrote: > Hello, > > Thanks Mark[1], it works. > > Footnotes: > [1] > http://source.cfengine.com/browse/core/trunk/src/files_editline.c?view=log&sortby=log&sortdir=down&pathrev=1590 > > > > > _

Re: edit_lines convergence

2010-12-11 Thread Daniel Dehennin
Hello, Thanks Mark[1], it works. Footnotes: [1] http://source.cfengine.com/browse/core/trunk/src/files_editline.c?view=log&sortby=log&sortdir=down&pathrev=1590 -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgp5SKBADc1mi.pgp Description: PGP si

Re: Cfengine Help: Re: edit_lines convergence

2010-12-10 Thread Daniel Dehennin
Seva Gluschenko writes: > I've proposed a generic edit_line bundle for /etc/fstab adjustment > recently which can be easily adapted to handle almost any space > separated file: > > bundle edit_line config_option_space_separated(name,value) > { > classes: > "not_there" not => regline("$(

Re: Cfengine Help: Re: edit_lines convergence

2010-12-09 Thread Daniel Dehennin
Seva Gluschenko writes: > Dan, > > the useful policy to keep in mind all the time while creating either > cfengine promises or any other piece of code is KISS (keep it safe and > simple). > > I've proposed a generic edit_line bundle for /etc/fstab adjustment > recently which can be easily adapted

Re: Cfengine Help: Re: edit_lines convergence

2010-12-09 Thread Seva Gluschenko
Dan, the useful policy to keep in mind all the time while creating either cfengine promises or any other piece of code is KISS (keep it safe and simple). I've proposed a generic edit_line bundle for /etc/fstab adjustment recently which can be easily adapted to handle almost any space separated fi

Re: Cfengine Help: Re: edit_lines convergence

2010-12-09 Thread Daniel Dehennin
Daniel Dehennin writes: [...] > The replace_patterns is always repaired: [...] Even a simple one like this: #v+ cat /tmp/main.cf: smtp_host smtp.example.net2 #v- #v+ replace_patterns: HasSMTPhost:: "^(smtp_host)\s+smtp\.example\.net$" replace_with => value("$(match.

Re: Cfengine Help: Re: edit_lines convergence

2010-12-09 Thread Daniel Dehennin
no-re...@cfengine.com writes: > I don't think that PCRE exactly matches Perl regular expressions so > beware when testing with Perl. I tend to use pcregrep to test > matches. However, that is not exactly like Cfengine's use of PCRE > since CF tends to need extra escapes here and there. So I als

Cfengine Help: Re: edit_lines convergence

2010-12-09 Thread no-reply
Forum: Cfengine Help Subject: Re: edit_lines convergence Author: neilhwatson Link to topic: https://cfengine.com/forum/read.php?3,19673,19693#msg-19693 I don't think that PCRE exactly matches Perl regular expressions so beware when testing with Perl. I tend to use pcregrep to test ma

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
Michael Potter writes: > Ok...your definition of if_ok seems non-standard (I always understood it to > be define X if kept *or repaired). Maybe your one should be called > kept_or_repaired. This was just to understand how it works, making tests. > I am not really sure why you are getting non-co

Re: edit_lines convergence

2010-12-08 Thread Michael Potter
Ok...your definition of if_ok seems non-standard (I always understood it to be define X if kept *or repaired). Maybe your one should be called kept_or_repaired. I am not really sure why you are getting non-convergent behavior...although this looks strange: cf3 -> Looking at pattern ^(smtp_host)\

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
Michael Potter writes: > I think the problem is you are using if_ok to set "SomeSMTPHostReplaced". > Try using if_repaired instead... Seemes that the problem is that the promise is repaired at every run. The difference between if_ok and if_repaired body classes is for the definition of "NoSMTPH

Re: edit_lines convergence

2010-12-08 Thread Michael Potter
On Thu, Dec 9, 2010 at 4:57 AM, Daniel Dehennin < daniel.dehen...@baby-gnu.org> wrote: > Michael Potter writes: > > > I believe the problem is this expression: > > > > "^(smtp_host)\s+.*$" replace_with => value("$(match.1) $(smtp)"), > > > > Because you use a .* after the whitespace, the regex wi

Re: edit_lines convergence

2010-12-08 Thread Daniel V. Klein
All PCRE matches are greedy, unless you make them stingy. So .* is greedy, .*? is stingy On Dec 8, 2010, at 12:02 AM, Daniel Dehennin wrote: > Michael Potter writes: > >> I believe the problem is this expression: >> >> "^(smtp_host)\s+.*$" replace_with => value("$(match.1) $(smtp)"), >> >>

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
Michael Potter writes: > I believe the problem is this expression: > > "^(smtp_host)\s+.*$" replace_with => value("$(match.1) $(smtp)"), > > Because you use a .* after the whitespace, the regex will continue to match > after any replacement occurs. > > Try using a negative lookahead assertion: >

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
Michael Potter writes: > I believe the problem is this expression: > > "^(smtp_host)\s+.*$" replace_with => value("$(match.1) $(smtp)"), > > Because you use a .* after the whitespace, the regex will continue to match > after any replacement occurs. > > Try using a negative lookahead assertion: >

Re: edit_lines convergence

2010-12-07 Thread Michael Potter
ote: > Hello, > > I have some troubles with edit_lines convergence: > > #v+ > body common control > { > >bundlesequence => { "filetest" }; >version => "0.0.3"; > } > > bundle agent filetest > { > >vars: &

edit_lines convergence

2010-12-07 Thread Daniel Dehennin
Hello, I have some troubles with edit_lines convergence: #v+ body common control { bundlesequence => { "filetest" }; version => "0.0.3"; } bundle agent filetest { vars: "smtp" string => "smtp.example.net"; files: