Re: expand_scalars and templates

2010-02-17 Thread Mark Burgess
Jesse, you should use the fully qualified name $(tmpl.varA) for the variables in the file, as they get processed in a different bundle and are therefore not "local" M Jesse Becker wrote: > I'm trying to get a basic templating system working for several files, > and expand_scalars doesn't seem

expand_scalars and templates

2010-02-17 Thread Jesse Becker
I'm trying to get a basic templating system working for several files, and expand_scalars doesn't seem to work. I've found serveral references to other people having success with this, so I assume I've done something wrong. I'm running the cfengine 3.0.3 community RPM build. Here's the basic cod

Re: Good organizational practices

2010-02-17 Thread megamic
* site.cf I use this to set global classes that control what actions needs to be taken in a particular environment/server. I also set global vars in here, such as the slist which is passed to bundlesequence - that way all the stuff that varies depending on what classes are defined is consoli

Good organizational practices

2010-02-17 Thread Justin Lloyd
Hi all, I'm curious about what good practices people have developed for organizing their local configuration files, bundles, bodies, special files, etc. as well as naming conventions for bundles, bodies, variables, etc. to prevent conflicts with defaults. I checked www.cfwiki.org but it doesn't se

RE: regcmp help

2010-02-17 Thread Justin Lloyd
I'd forgotten all about that syntax as my more intermediate-to-advanced Perl has gotten a bit rusty. I'm glad to know that works with libpcre. Thanks for the tip! Justin -Original Message- From: Diego Zamboni [mailto:di...@zzamboni.org] Sent: Wednesday, February 17, 2010 3:37 PM To: Ju

Re: regcmp help

2010-02-17 Thread Diego Zamboni
Howdy, PCRE allows you to set the /s flag using (?s) at the beginning of the regex: PCRE_DOTALL If this bit is set, a dot metacharater in the pattern matches all char- acters, including those that indicate newline. Without it, a dot does not match when the current

RE: regcmp help

2010-02-17 Thread Justin Lloyd
Theoretically speaking, this would probably only work with a two-line string, correct? If so, is there a way to do it generically, i.e. where you don't know how many newlines may be in the string nor on which line the desired match may exist, similar to //s in Perl? Justin -Original Messag

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess wrote on 2010-02-17 15:37:36: > > .* only matches up to the newline, so you'll have to say > > .*REGEX.*\n.* That works. It's a bit painful compared with m// so I still wish for that :) Still thanks for the clarification and your patience with my stubbornness. Sincerely, --

Re: regcmp help

2010-02-17 Thread Mark Burgess
.* only matches up to the newline, so you'll have to say .*REGEX.*\n.* nwat...@symcor.com wrote: > .*OpenSSH.* still does not match > "SSH-OpenSSH-4.3 > newline"; > > I don't control the newline but I have to account for it somehow in my > 'match'. > > Sincerely, > -- > Neil Watson >

Re: referencing a slist within a slist array?

2010-02-17 Thread Mark Burgess
BTW - try the Special topics Guide on Iteration for hints of a workaround Lebel, Marco wrote: > Mark, > > I appreciate and I am sure that you will find and fix the bug if a bug it is. > > That being said we are in a midst of deploying v3.0.2 on our farm of servers > (half of them are now in hy

Re: regcmp help

2010-02-17 Thread NWatson
.*OpenSSH.* still does not match "SSH-OpenSSH-4.3 newline"; I don't control the newline but I have to account for it somehow in my 'match'. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including any attachments, is for the exclusive use of addres

Re: regcmp help

2010-02-17 Thread Mark Burgess
You can make it simply by writing .*REGEX.* nwat...@symcor.com wrote: > Mark Burgess wrote on 2010-02-17 15:25:23: > >> You misunderstand what is being matched against. That's documented. >> It doesn't say that is >> *searches* the string. It says it matches the string. You confused >> // no

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess wrote on 2010-02-17 15:25:23: > You misunderstand what is being matched against. That's documented. > It doesn't say that is > *searches* the string. It says it matches the string. You confused > // notation which is a > search not a comparison. Ack you are right. I assumed and

Re: regcmp help

2010-02-17 Thread Mark Burgess
You misunderstand what is being matched against. That's documented. It doesn't say that is *searches* the string. It says it matches the string. You confused // notation which is a search not a comparison. nwat...@symcor.com wrote: > Mark Burgess wrote on 2010-02-17 15:09:29: > >> There woul

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess wrote on 2010-02-17 15:09:29: > There wouldn't be a line break in your line. This is standard regex > stuff. Regexs don't go > through line breaks. The desired atom is before the line break. This I expect to match as it does with pcregrep, sed, grep and perl. [nwat...@unxxhd01

Re: regcmp help

2010-02-17 Thread Mark Burgess
There wouldn't be a line break in your line. This is standard regex stuff. Regexs don't go through line breaks. M nwat...@symcor.com wrote: > Mark Burgess wrote on 2010-02-17 15:01:05: > >> If there is a line break, use \n in the expression > > Assuming I know that there is a line break. Ty

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess wrote on 2010-02-17 15:01:05: > > If there is a line break, use \n in the expression Assuming I know that there is a line break. Typically one wants to match a known string, described as regular expression, in an unknown or unpredictable string. In this example the desire is to

Re: regcmp help

2010-02-17 Thread Mark Burgess
If there is a line break, use \n in the expression nwat...@symcor.com wrote: > This > "reg" string => "OpenSSH"; > "str" string => "SSH-OpenSSH-4.3 > newline"; # Continued from previous line > > classes: > > "port" expression => regcmp(".*${reg}.*","${str}"); > > S

RE: regcmp help

2010-02-17 Thread NWatson
This "reg" string => "OpenSSH"; "str" string => "SSH-OpenSSH-4.3 newline"; # Continued from previous line classes: "port" expression => regcmp(".*${reg}.*","${str}"); Should match. In my previous post the example die not match. I suspect this is because of the new

RE: regcmp help

2010-02-17 Thread Lebel, Marco
Not sure what you mean i.e. did you expect a match or not? I did try your example and it works for me or should I say it is a match!!! Marco -Original Message- From: nwat...@symcor.com [mailto:nwat...@symcor.com] Sent: Wednesday, February 17, 2010 2:32 PM To: Lebel, Marco Cc: help-cfeng

RE: regcmp help

2010-02-17 Thread NWatson
You are right the regex expects to look at the whole line. That is not as I would expect from a regular expression. I think this leads to a problem. Consider this new example where the string continues to another line. ## body common control { bundlesequence => { "tes

RE: regcmp help

2010-02-17 Thread Lebel, Marco
Should it not be ".* OpenSSH.*" fro the regular expression? Marco -Original Message- From: help-cfengine-boun...@cfengine.org [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of nwat...@symcor.com Sent: Wednesday, February 17, 2010 2:17 PM To: help-cfengine@cfengine.org Subject: r

Re: regcmp help

2010-02-17 Thread Michael Potter
I think regcmp needs to match the whole string, not part of it. On 18/02/2010 6:17 AM, wrote: A regcmp I would expect to match does not. What have I done wrong? [nwat...@unxxhd01 inputs]$ cat regcmp.cf ## body common control { bundlesequence => { "test" }; } bundle com

regcmp help

2010-02-17 Thread NWatson
A regcmp I would expect to match does not. What have I done wrong? [nwat...@unxxhd01 inputs]$ cat regcmp.cf ## body common control { bundlesequence => { "test" }; } bundle common agent { classes: "all" expression => "any"; } bundle agent test { classe

Re: referencing a slist within a slist array?

2010-02-17 Thread Mark Burgess
Sorry about that Lebel, Marco wrote: > Mark, > > I appreciate and I am sure that you will find and fix the bug if a bug it is. > > That being said we are in a midst of deploying v3.0.2 on our farm of servers > (half of them are now in hybrid mode) and I do not know when the business > will al

RE: referencing a slist within a slist array?

2010-02-17 Thread Lebel, Marco
Mark, I appreciate and I am sure that you will find and fix the bug if a bug it is. That being said we are in a midst of deploying v3.0.2 on our farm of servers (half of them are now in hybrid mode) and I do not know when the business will allow us to upgrade to 3.0.4. So, hopefully, other org

Re: referencing a slist within a slist array?

2010-02-17 Thread Mark Burgess
Just take a cold shower and give me a few hours. It seems to be a bug, so I'll fix it. nwat...@symcor.com wrote: > There is probably another way to do it if you step back and take a look. > Another option would be to try the lastest SVN to see if it's fixed and > will be ready for 3.0.4 due at

RE: referencing a slist within a slist array?

2010-02-17 Thread NWatson
There is probably another way to do it if you step back and take a look. Another option would be to try the lastest SVN to see if it's fixed and will be ready for 3.0.4 due at the end of the month. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including an

RE: referencing a slist within a slist array?

2010-02-17 Thread Lebel, Marco
Neil, Thanks for your effort, really appreciated... So I guess my take away is that it should work... but, helas, I came across a bug. Oh well back to hard coding the iterations. Marco -Original Message- From: nwat...@symcor.com [mailto:nwat...@symcor.com] Sent: Wednesday, February 1

Re: referencing a slist within a slist array?

2010-02-17 Thread NWatson
Seems to work the same on Community 3.0.2 and 3.0.3. [r...@unxxhd01 inputs]# /home/nwatson/src/cfengine-3.0.3/src/cf-agent -f ./test.cf R: Server = g1 Client_list = p1 R: Server = g1 Client_list = p2 R: Server = g1 Client_list = p3 List parameter not found while constructing "do_gather" - use @(

RE: Directory perms and ownership not getting set

2010-02-17 Thread Justin Lloyd
Thanks, Mark! I was beating my head against the wall on this one. :) I'll update the ticket I opened and let support know this is a known issue so they can close the ticket. Justin -Original Message- From: Mark Burgess [mailto:mark.burg...@iu.hio.no] Sent: Wednesday, February 17, 2010 1

Re: referencing a slist within a slist array?

2010-02-17 Thread Mark Burgess
What version are you running? If old, could this be related to a bug. Lebel, Marco wrote: > Neil, > > Yeap I figured you would suggest this, so I did that one too and tried it... > and sorry to say no success. It does not even iterate over the first entry > properly. > > So I am basically st

RE: referencing a slist within a slist array?

2010-02-17 Thread Lebel, Marco
Neil, Yeap I figured you would suggest this, so I did that one too and tried it... and sorry to say no success. It does not even iterate over the first entry properly. So I am basically stuck to hard code the iteration n'est-ce pas? Marco -Original Message- From: nwat...@symcor.com

RE: referencing a slist within a slist array?

2010-02-17 Thread NWatson
Perhaps fully qualify info_gathers also. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including any attachments, is for the exclusive use of addressee and may contain proprietary and/or confidential information. If you are not the intended recipient, any

RE: referencing a slist within a slist array?

2010-02-17 Thread Lebel, Marco
Here is the result: R: The client list for server gatherer1 are provider1) R: The client list for server gatherer1 are provider2) R: The client list for server gatherer1 are provider3) List parameter not found while constructing "do_gather" - use @(scope.variable) in calling reference R: The clie

Japan Visit

2010-02-17 Thread Mark Burgess
Greetings Japanese Cfengine Users, I shall be visiting Japan at the start of April and am gauging interest to arrange a community meeting or "update" presentation about Cfengine. Please reply to me privately if you are interested in such a meeting. Mark -- Mark Burgess --

Re: referencing a slist within a slist array?

2010-02-17 Thread Mark Burgess
Try using the full qualification @(master.info_) Lebel, Marco wrote: > Hello all, > > > > I have the following : > > > > bundle agent master > > { > >vars: > >"info_provider[gatherer1]" slist => { "provider1", "provider2", > "provider3" }; > >"info_provider[gatherer2

Re: referencing a slist within a slist array?

2010-02-17 Thread NWatson
Do you get any warnings? Try passing a fully qualified reference such as @(master.info_provider[$(info_gatherers)]) Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including any attachments, is for the exclusive use of addressee and may contain proprietary

referencing a slist within a slist array?

2010-02-17 Thread Lebel, Marco
Hello all, I have the following : bundle agent master { vars: "info_provider[gatherer1]" slist => { "provider1", "provider2", "provider3" }; "info_provider[gatherer2]" slist => { "provider4", "provider5", "provider6" }; "info_gatherers" slist => getindices("info_provider");

RE: 2.0.6-1 edit files question

2010-02-17 Thread NWatson
Hi Colin, I would suggest a search and replace. For some examples see the cf2 reference or my cookbook ( http://watson-wilson.ca/blog/cfcookbook.html#SECTION00015 ). Get something going and post back here with what you've tried. Sincerely, -- Neil Watson 416-673-3465 CONFIDE

Re: Directory perms and ownership not getting set

2010-02-17 Thread Mark Burgess
Justin, have you broken our software again ;-) We found this problem last week - remarkable that it's the simplest things that go awry. Anyway, this will be fixed in the updates that will be available at the end of the month. Sorry for the inconvenience. cheers, Mark Justin Lloyd wrote: > I'