Re: Cfengine Help: Possibility of forwarding arguments via command line to cf-agent

2011-05-25 Thread Daniel Dehennin
rameter01 parameter02 > > I could probably do that with writing the parameter(s) into a file and > than let cfengine read from that file. But is there something more > comfortable ? Why not using classes? Just define classes on the command line and your cf policy will use them. Regard

Re: Cfengine Help: Re: conditional import of inputs -- i.e. using classes to control inputs

2011-05-24 Thread Daniel Dehennin
Daniel Dehennin writes: > Could this be considered a regression on bug 135[1] or is there a better > way to do it? Sorry, my fault, I forgot that classes in "bundle agent" are not globals. Here is my new results: #v+ bin/cf-agent -K -I R: Bundle agent test evaluated R: Bu

Re: Cfengine Help: Re: conditional import of inputs -- i.e. using classes to control inputs

2011-05-23 Thread Daniel Dehennin
Daniel Dehennin writes: > Daniel Dehennin writes: > >> Aleksey Tsalolikhin writes: >> >>> I moved the classes promise higher, before the vars promise, >>> (which is how it is evaluated anyway), but I get: >>> >>> Can't stat file &q

Re: Cfengine Help: Re: conditional import of inputs -- i.e. using classes to control inputs

2011-05-22 Thread Daniel Dehennin
Daniel Dehennin writes: > Aleksey Tsalolikhin writes: > >> I moved the classes promise higher, before the vars promise, >> (which is how it is evaluated anyway), but I get: >> >> Can't stat file "./@(g.country)" for parsing > > I remember some

Re: Cfengine Help: Re: conditional import of inputs -- i.e. using classes to control inputs

2011-05-19 Thread Daniel Dehennin
e mailing-list[2]. Regards. Footnotes: [1] https://cfengine.com/bugtracker/view.php?id=135 [2] https://cfengine.org/pipermail/help-cfengine/2010-May/008577.html -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpxtuZ89Wa1u.pgp

Re: Create array from list

2011-05-19 Thread Daniel Dehennin
Daniel Dehennin writes: > Hello, > > I'm trying to create an array with list expansion and wonder why there > is no coordinated iteration. > > Here is my test case: [...] More tests: #v+ body common control { bundlesequence => { "test" }; vers

Re: Create array from list

2011-05-18 Thread Daniel Dehennin
Daniel Dehennin writes: > Hello, > > I'm trying to create an array with list expansion and wonder why there > is no coordinated iteration. > > Here is my test case: > [...] > #v+ > bin/cf-agent -K -I > !! Redefinition of a constant list "index"

Create array from list

2011-05-18 Thread Daniel Dehennin
o bundle 'test' in file '/home/dad/.cfagent/inputs/promises.cf' near line 14 !! Redefinition of a constant list "index" cf3> -- Was {'cf_null'}cf3> now {'test1'}cf3> Promise (version 0.0.5) belongs to bundle 'test' in f

Re: Meta: Forum postings break help-cfengin email threads in Gmail

2011-02-13 Thread Daniel Dehennin
Footnotes: [1] http://www.freesoft.org/CIE/RFC/822/36.htm -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpL8rYFWjNQ1.pgp Description: PGP signature ___ Help-cfengine mailing list Help-cfengine@cfengin

Re: How to refer to an slist defined in a common bundle?

2010-12-23 Thread Daniel Dehennin
tnotes: [1] http://www.cfengine.org/manuals/cf3-tutorial.html#List-variables [2] http://www.cfengine.org/manuals/cf3-reference.html#List-variable-substitution-and-expansion -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpDi3XQzJ6IP.pgp Descript

Re: classes

2010-12-18 Thread Daniel Dehennin
tnotes: [1] https://cfengine.org/pipermail/help-cfengine/2010-December/010922.html -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpJfqzFDJW1s.pgp Description: PGP signature ___ Help-cfengine mailing

Re: Array as bundle parameter

2010-12-14 Thread Daniel Dehennin
Michael Potter writes: > I believe you have to pass them as ., e.g.: > >edit_line => insert_array_lines("filetest.line") Yes, I tried as a string but do not fully qualified it, thanks to you and zzamboni. Thanks. -- Daniel Dehennin Récupérer ma cle

Array as bundle parameter

2010-12-14 Thread Daniel Dehennin
$($(v)[$(idx)])"; } body edit_defaults empty { empty_file_before_editing => "true"; edit_backup => "false"; max_file_size => "30"; } #v- Regards. Footnotes: [1] like in http://blog.zzamboni.org/editing-sshd-configuration-files-w

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 Desc

Re: Cfengine Help: Re: edit_lines convergence

2010-12-10 Thread Daniel Dehennin
lue"; } #v- The only problem I found during my test is that, after the first test, I had two lines in my /tmp/main.cf, a good one and a bad one. The 'config_option_space_separated' body do not remove any misconfigured lines, as the 'regline' matches one of the lines. With the

Re: Cfengine Help: Re: edit_lines convergence

2010-12-09 Thread Daniel Dehennin
t; "Delete missconfigured smtp_host"; insert_lines: any:: "smtp_host $(smtp)", classes => if_repaired("SMTPHostAdded"), comment => "Add smtp_host if none"; } body replace_with value(

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 =>

Re: Cfengine Help: Re: edit_lines convergence

2010-12-09 Thread Daniel Dehennin
, classes => if_repaired("SMTPHostFixed"), comment => "Add smtp_host if none"; replace_patterns: HasSMTPhost:: "^(smtp_host)\s+(?!$(smtp)$).*" replace_with => value("$(match.1) $(smtp)"),

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
s/^(smtp_host)\s+(?!smtp.example.net$)$/$1 smtp.example.net/' [4] echo "smtp_host smtp.example.netsmtp.example.net" | perl -pi -e 's/^(smtp_host)\s+(?!smtp.example.net)$/$1 smtp.example.net/' [5] echo "smtp_host smtp.example.netsmtp.example.net" | perl -pi

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
he definition of "NoSMTPHostReplaced" in my example: #v+ body classes if_ok(notchanged, changed) { promise_kept => { "$(notchanged)" }; promise_repaired => { "$(changed)" }; } #v- Seems there is something[1] I did not understand. Regards. Footnotes: [1] s

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
HasSMTPhost:: "^(smtp_host)\s+(?!$(smtp)$).*$" replace_with => value("$(match.1) $(smtp)"), classes => if_ok("NoSMTPHostReplaced", "SomeSMTPHostReplaced"), comment => "Replace missconfigured smtp_

Re: edit_lines convergence

2010-12-08 Thread Daniel Dehennin
hanks, it looks like the match must be greedy. With the normal ordering of edit_line, I finish to delete_lines that do not match and then insert_lines. Thanks. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpFbjr5ft6gd.pgp Description: PGP sign

edit_lines convergence

2010-12-07 Thread Daniel Dehennin
ot; cf3 Promise (version 0.0.3) belongs to bundle 'fix_smtp_host' in file '/home/dad/.cfagent/inputs/promises.cf' near line 31 cf3 Comment: Replace smtp_host if any #v- The pattern to replace must not match the replacement string, I think that if I use delete_lines/insert_l

Re: Reference manual source

2010-12-06 Thread Daniel Dehennin
nfo ;-) Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpnweroWlbBA.pgp Description: PGP signature ___ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine

Reference manual source

2010-12-05 Thread Daniel Dehennin
Hello, I’m looking at the SVN cf3 repository and found the docs/ dircetory. The cf3-References.info is not up to date, I wonder where is the online reference manual source. Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgplUXq8eNmPo.pgp

Re: Cfengine Help: MySQL backup via Cfengine3

2010-12-04 Thread Daniel Dehennin
to the 'body contain'? body contain rootshell { useshell => "true"; umask => "077"; exec_owner => "root"; chdir => "/root"; } -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-

Re: Dynamic build of variable names

2010-12-03 Thread Daniel Dehennin
Daniel Dehennin writes: > Hello, Hello, First huge thanks to Michael Potter who helped me open my eyes on this issue. > = promises.cf > body common control > { > bundlesequence => { "test" }; > version => "0.0.1"; > } >

Re: Cfengine Help: Re: Dynamic build of variable names

2010-12-02 Thread Daniel Dehennin
d not happen at every run. Hope I can make my use case acceptable, I could put everything in LDAP or any database, but I like text files, diff and distributed version control systems ;-) Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

Re: Dynamic build of variable names

2010-12-02 Thread Daniel Dehennin
ee what variables must I declare to configure this particular service if I don't remenber. Are my intentions clearer? Do they look insane? Regards. Footnotes: [1] Like DNS, Nagios, cacti -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

Dynamic build of variable names

2010-12-01 Thread Daniel Dehennin
ot; expression => "any"; reports: ok:: "$($(sys.host)_ip)"; } = This results in = /usr/sbin/cf-agent -K -I R: $(hati_ip) = Thanks. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpd4jMVW

Singleton list is not iterated

2010-12-01 Thread Daniel Dehennin
reports: ok:: "X1: $(x1)"; "X2: $(x2)"; "X3: $(x3)"; } = The output is: = /usr/sbin/cf-agent -K -I R: X2: /tmp R: X2: /var/tmp R: X2: /usr/tmp R: X4: bar = Regards. Footnotes: [1] http://bugs.debian.org/

Re: Cfengine Help: Re: vars policy => "ifdefined" broken

2010-09-04 Thread Daniel Dehennin
strange behaviour but it can be a debian specific one. Regards. Footnotes: [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585619 -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpbogVWR1UmM.pgp Description: PGP signature _

Re: Array of slist

2010-06-11 Thread Daniel Dehennin
> R: outer: too > R: inner: this is an array element > R: inner: $(outer.arr[idx2]) Hello, Exactly the same with debian 3.0.5. Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpPloFE

Array of slist

2010-06-07 Thread Daniel Dehennin
ines were generated by promiser "/bin/echo key3 $(array[key3])" I: Made in version '0.0.2' of '/home/dad/.cfagent/inputs/promises.cf' near line 23 --8<---cut here---end--->8--- I found no example, in tutorial, reference m

Re: append value to variable slist

2010-06-05 Thread Daniel Dehennin
test" !! Redefinition of variable "list" (embedded list in RHS) in context "test" !! Redefinition of variable "list" (embedded list in RHS) in context "test" Q: ".../bin/echo $(dir": $(dirs)/$(files) I: Last 1 QUOTEed lines were generated by promiser "/bin/echo $(dirs)/$(files)" I: Made in version '0.0.2' of '/home/dad/.cfagent/inputs/promises.cf' near line 21 Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpuaLfihVsnd.pgp Description: PGP signature ___ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine

Re: append value to variable slist

2010-06-04 Thread Daniel Dehennin
*list => {}' construct could be seen as: promise to have elements listed in '{}' in the list named 'name'. My point is: - a list construct define a list variable if it's not already defined - then add the listed elements if they are not presents Maybe an 'a

Re: List composition

2010-05-26 Thread Daniel Dehennin
t;0", @(l1), @(l2)}, policy => "ifdefined"; I'll look at this after diner. Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpvmC6dbMzIR.pgp Description: PGP signature

List composition

2010-05-26 Thread Daniel Dehennin
ho @(l1)": @(l1) Q: ".../bin/echo @(l2)": @(l2) when "cf-agent -KI -DClass1" gives: Q: ".../bin/echo 0": 0 Q: ".../bin/echo 1": 1 Q: ".../bin/echo 2": 2 Q: ".../bin/echo @(l2)": @(l2) Is there a way to discard undefined variab

Re: duplicate selection of value

2010-05-16 Thread Daniel Dehennin
mega...@gmail.com writes: > It turns out a simple "grep -v grep" at the end of the shell command > did the trick: > > "myarray[$(mykeys)]" string => execresult("/usr/bin/ps -f | grep > $(mylist[$(mykeys)]) | grep -v grep","useshell"); Th

Re: List variable in inputs

2010-05-10 Thread Daniel Dehennin
ore team, obviously, needs to define something like: - bundlesequence => {"update", "main", @(services.bundles); - inputs => {"update.cf", "main.cf", "library.cf", "services/main.cf", @(services.inputs)}; This works, but seems more

Re: Cfengine Help: Re: List variable in inputs

2010-05-06 Thread Daniel Dehennin
puts" slist => { "test2.cf" }; } bundle agent test { reports: debian:: "In test"; } ## test2.cf bundle common test2 { vars: any:: "bundles" slist => { "test2" }; } bundle agent test2

Re: Cfengine Help: Re: List variable in inputs

2010-05-06 Thread Daniel Dehennin
omised. I'm trying to understand the code to provide a patch to do the same with inputs but fail for now. The only difference I see for now is that inputs appears in cf3parse.y and not bundlesequence... Any hint to guide me a little? Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyse

Re: Cfengine Help: Re: List variable in inputs

2010-05-04 Thread Daniel Dehennin
orward to know what, where and how to do it. Hope this clarify my intentions. Thanks. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgp4taXpR7D0k.pgp Description: PGP signature ___ Help-cfengine

Re: Cfengine Help: Re: List variable in inputs

2010-05-04 Thread Daniel Dehennin
promise to load everything under services/ (class based) and the "sub promises" do what they needs, including adding bundles to bundlesequence and files to inputs. I use this with cf2 and its import, maybe this hierarchical management is the wrong way? Regards. -- Daniel Dehennin Récu

Re: List variable in inputs

2010-05-03 Thread Daniel Dehennin
27;m looking crazy ;-) Another idea, instead of chaining the bundlesequence and inputs of the callee in the caller, using common bundles to add some. bundle common test { bundlesequence => { "test" }; inputs => {"test2.cf" }; } Does it sound crazy (again) that a bundle

List variable in inputs

2010-05-02 Thread Daniel Dehennin
2 { vars: any:: "bundles" slist => { "test2" }; "inputs" slist => {}; } bundle agent test2 { reports: debian:: "In test2"; } Is this a bug ? Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp

Re: load promise from file

2010-02-27 Thread Daniel Dehennin
find no import in cf3 reference manual. What's the way to include files based on classes? Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1 pgpabLxyj1uSY.pgp Description: PGP signature ___ He

Re: Multi-dimensional arrays

2010-01-28 Thread Daniel Dehennin
ress]" string => "10.2.3.5"; "Zone[vpn][srv3][ipaddress]" string => "10.2.6.7"; "Zone[vpn][srv4][ipaddress]" string => "10.2.6.8"; --8<---cut here---end--->8--- I want to get the IP add

Re: Multi-dimensional arrays

2010-01-28 Thread Daniel Dehennin
> > e.g. getindexlist("Hosts","2") > > to extract a list of the second index? vars: "Zone[dmz][srv1]" string => "10.2.3.4"; "Zone[dmz][srv2]" string => "10.2.3.5"; "Zone[vpn][srv3]" string => &q

Re: how to replace a couple of lines with another couple ?

2010-01-04 Thread Daniel Dehennin
replacement[is] string => "222"; "replacement[test] string => "333"; "patterns" slist => getindices("replacement"); } --8<---cut here---end--->8--- I hope it will help you. Regards. -- Daniel Dehennin R

Multi-dimensional arrays

2009-12-25 Thread Daniel Dehennin
3.4"; "Hosts[server2][ipaddress]" string => "10.2.3.5"; --8<---cut here---end--->8--- Then doing a getindices("Hosts[server1]"). Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu -

Re: Access other hosts variables

2009-12-24 Thread Daniel Dehennin
ts and look into the peer-to-peer functionality of features > like the remotescalar() special function: > > http://www.cfengine.org/manuals/cf3-reference.html#Function-remotescalar Look interesting, I have not finished the reference manual yet. Regards. -- Daniel Dehennin Récupérer ma clef GPG:

Access other hosts variables

2009-12-22 Thread Daniel Dehennin
webapp:: "IpAddress" string => "10.4.5.6"; webapp.appli:: "UrlPath" string => "/path/to/appli"; } --8<---cut here---end--->8--- Now I need to edit a file on revproxy and insert the IpAddress