Re: CFEngine Help: vim syntax highlighting

2012-07-21 Thread Daniel V. Klein
Very nice! And since I thought I had found a bug (I ultimately learned I hadn't), I did some tracing and now know more about vim highlighting, which is a double bonus! On Jul 21, 2012, at 5:40 AM, no-re...@cfengine.com wrote: > Forum: CFEngine Help > Subject: vim syntax highlighting > Author:

Re: CFEngine Help: Can CFEngine 3 scale to support a 1 million + Enterprise?

2012-04-14 Thread Daniel V. Klein
Jason- Stay tuned for an announcement of a USENIX "Configuration Management Summit - Virtualization, the cloud, and scale" being help in Boston in June. Your opinions and ideas would be extremely welcome there! -Dan Klein On Apr 13, 2012, at 7:48 PM, no-re...@cfengine.com wrote: > Forum: CFE

Re: Unexpected behavior with replace_or_add from stdlib

2012-03-05 Thread Daniel V. Klein
It is pretty hard to determine what you did wrong when you haven't shared what you did... Humorously: before the job: Bank Account: $192.37 after the job: Bank Account: $193.42 expected: Bank Account: $3,987,245.22 Can you discover what did I do wrong? On Mar 5, 2012, at 4:37 PM, Nick Anders

Re: file_select mtime catching some files it shouldn't

2012-03-04 Thread Daniel V. Klein
Jonathan- Looking naively at FnCallNow() in evalfunction.c, I believe you are correct in your suspicion that cf-agent uses the start time as "now". Now, I say "naively" because I am not that familiar with the Cfengine core code, and I have a not-quite up-to-date version. For a long-running ag

Re: CFEngine Help: Re: methods, usebundle and loops

2012-01-25 Thread Daniel V. Klein
Simon- As stated, the class you're setting is global in scope. However, the test for the existence of the class might not be redundant, depending on what exactly you _really_ want to do. My suggestion is to use classes whose names are also base on the parameter variable, i.e., if_repaired("ec

Fwd: CFEngine Help: insert line: bug ??

2012-01-11 Thread Daniel V. Klein
This is a "classic" mistake (that is, everyone makes it) so don't feel badly :-) The insert_lines promise really says "I promise that this line will be present in the file, and if it isn't, then I will insert it". So there are a few things going on here: 1) You said "insert a '{' if it is miss

Re: CFEngine Help: Re: Using dist for random selections

2012-01-08 Thread Daniel V. Klein
Neil- You should look at the tests/ directory in the source tree - there are plenty of examples of one bundle testing another :-) What I hear you saying is that you want repeatable randomness - is that correct? If so, store your results in a file (possibly generated by a script in a different

Re: if assignment in cfengine

2012-01-04 Thread Daniel V. Klein
You probably want to look at "promise_repaired" at http://cfengine.com/manuals/cf3-reference.html#classes-in-_002a - but note that this applies to the WHOLE promise, so you should be careful where you set the class (that is, in the main promise, in a subcomponent, etc). But FWIW, I use this fe

Re: combining classes

2011-09-27 Thread Daniel V. Klein
Both of your ideas should work, but CFEngine is rather picky about quotes... Try: "class_ab" or => {"class_a", "class_b"} "class_ab" expression => "class_a|class_b"; -Dan On Sep 27, 2011, at 12:13 PM, D'Ausilio, John wrote: > I define some classes in a common bundle represe

Re: Guide to CFEngine 3 Body of Knowledge

2011-09-22 Thread Daniel V. Klein
Nice way to collect all the documentation! On Sep 22, 2011, at 3:40 AM, Aleksey Tsalolikhin wrote: > There is a lot to know about CFEngine, which can make it hard for > people new to the subject. The purpose of this guide is to lay out > the resources available to CFEngine students and to orient

Re: CFEngine Help: Re: inserting lines into crontab

2011-09-13 Thread Daniel V. Klein
Before you get started on this, I think you should ask yourself this: 1) Do I want to maintain all of crontab (regardless of which machine gets what) with CFEngine, or 2) Do I want to maintain a PART of crontab with CFEngine (and handle machine differences manually on each machine) Personally,

Re: CFEngine Help: Re: Access single list element

2011-09-05 Thread Daniel V. Klein
Neil is correct, of course, but if you start thinking in those terms, then you're still thinking like Cfengine is a programming language, and not a declarative language. Why do you need a particular element of a list? The idea behind lists is that you address all of the elements, either serial

Re: Security Tools and Root Access

2011-08-13 Thread Daniel V. Klein
On Aug 13, 2011, at 9:38 AM, Diego Zamboni wrote: > Hi Tom, > >> 1) Are you aware of a wrapper, unique shell or simiar tool that could >> provide root level access at a read only level? > > What comes to mind is to put the read-only functionality you want in a > specific program, and then giv

Re: Announcements: STIG compliance policy example

2011-08-10 Thread Daniel V. Klein
Nice stuff! On Aug 10, 2011, at 5:52 AM, no-re...@cfengine.com wrote: > Forum: Announcements > Subject: STIG compliance policy example > Author: CFEngine > Link to topic: https://cfengine.com/forum/read.php?1,23071,23071#msg-23071 > > CFEngine releases policy example for STIG compliance: http://

Re: CFEngine Help: Variable Class Names

2011-07-19 Thread Daniel V. Klein
Aleksey is correct here - a string, which may contain variables to be expanded, is interpreted as a class, and the promise is evaluated if the resulting classname is true. So if the variable "foo" contains the 3 letters "baz", then ifvarclass => "foo$(foo)" will allow the promise to be execut

Re: CFEngine Help: Re: ${this.promiser} in comments

2011-07-15 Thread Daniel V. Klein
Really? Huh... that's weird... I'd file a bug report with an example, if I were you... -Dan On Jul 15, 2011, at 2:56 AM, no-re...@cfengine.com wrote: > Forum: CFEngine Help > Subject: Re: ${this.promiser} in comments > Author: svenXY > Link to topic: https://cfengine.com/forum/read.php?3,22798

Re: ${this.promiser} in comments

2011-07-14 Thread Daniel V. Klein
Sven- This was reported as a bug on 2010/02/26 and reported as partially resolved 2010/03/19 in https://cfengine.com/bugtracker/view.php?id=58 - here is the resolution notice: "This can only be partially fixed. The reason is that the precise knowledge of this.promiser comes too late to use in t

Re: CFEngine Help: files: copy to "/" does not seem to work

2011-07-07 Thread Daniel V. Klein
Yep that looks like a bug (so please file a report :-) However, I'd point out that copying recursively to '/' can be dangerous... (but should be allowed anyway) On Jul 7, 2011, at 7:32 AM, no-re...@cfengine.com wrote: > Forum: CFEngine Help > Subject: files: copy to "/" does not seem to work >

Re: Search and replace... need some regex help, please. handling the scenario where the setting has drifted.

2011-06-29 Thread Daniel V. Klein
I'd do it as a two stage process: 1) Delete any line that has "(#\s*)?O QueueLA" . If you really want to be fancy, I think you can say say "(#\s*)?O QueueLA=(?!100)" to only delete if the value is not 100). 2) Insert "O QueueLA=100" Remember, cfengine does not edit "the file", it edits a temp

Re: Cfengine Help: insert_lines twice problem

2011-06-29 Thread Daniel V. Klein
One way is to specify a location attribute, or use the insert_type => "preserve_block" attribute -Dan On Jun 29, 2011, at 10:13 AM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: insert_lines twice problem > Author: schattenfell > Link to topic: https://cfengine.com/forum/read.p

Re: Cfengine Help: Function readstringarrayidx () - Need Regex help

2011-06-27 Thread Daniel V. Klein
You're using the "comment" regex to match lines that DON'T look like something... Try this: "dim_array" int => readstringarrayidx("array","datafile","^(?!VM;[^;]*;name1;).+",";",10,1); The regex says "anything, as long as you don't seeVM;stuff;name1;, is a comment". I think it'll work...

Re: ifvarclass when file does NOT exist

2011-06-23 Thread Daniel V. Klein
Aleksey/Seva- So you want to recreate "make" in CFEngine? :-) ifvarclass() says "if the named class exists, do something" fileexists() says "if the named file exists, make the class expression 'true'" and that is used to create a named class. The two are incompatible (because the latter is onl

Re: Cfengine Help: long string format

2011-06-18 Thread Daniel V. Klein
I agree with Mark, and the error message is pretty much spot-on. -Dan On Jun 18, 2011, at 1:56 AM, Mark Burgess wrote: > > This is not a bug, I think. The problem is you wrote > > "atftpd_conf" string => { "5.2" }; > > You need either > > "atftpd_conf" string => "5.2" ; > > or > > "atftpd

Re: Cfengine Help: long string format

2011-06-18 Thread Daniel V. Klein
I agree with Mark, and the error message is pretty much spot-on. -Dan On Jun 18, 2011, at 1:56 AM, Mark Burgess wrote: > > This is not a bug, I think. The problem is you wrote > > "atftpd_conf" string => { "5.2" }; > > You need either > > "atftpd_conf" string => "5.2" ; > > or > > "atftpd

Re: Cfengine Help: long string format

2011-06-18 Thread Daniel V. Klein
Also note that if you really do want to indent the string, there is a whitespace_policy that might help... -Dan On Jun 18, 2011, at 4:59 AM, Jonathan Clarke wrote: > Mark, I think sauer is referring to this typo in the Solutions Guide, at > http://cfengine.com/manuals/cf3-solutions.html#Set-up-

Re: selecting files over N minutes/days/etc. old

2011-05-21 Thread Daniel V. Klein
Well, you could always do this instead: body file_select modified_over_a_year_ago { mtime => irange(ago(1,0,0,0,0,0),now()); file_result => "!mtime"; # modified more than a year ago } On May 21, 2011, at 10:16 PM, Aleksey Tsalolikhin wrote: > The following policy selects files more than a yea

Re: Cfengine Help: Re: Cfengine Help: question about editing smb.conf

2011-05-20 Thread Daniel V. Klein
I was just suggesting things to look at. But yes, an index with white space (or with white space stripped with regextract()) might do the trick... -Dan On May 20, 2011, at 4:33 PM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: Re: Cfengine Help: question about editing smb.conf

Re: Cfengine Help: Re: Cfengine Help: question about editing smb.conf

2011-05-20 Thread Daniel V. Klein
In general, take a look at whitespace_policy in insert_lines for some ideas... Also look at set_variable_values in cfengine_stdlib.cf for others -Dan On May 20, 2011, at 3:16 PM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: Re: Cfengine Help: question about editing smb.conf >

Re: need a working example of how to use "transformer" without $(this.promiser)

2011-05-16 Thread Daniel V. Klein
Aleksey- The promise is to run the transformer, nothing more. Most transformers use $(this.promiser) as their input. For example, you could gzip the file if it existed, knowing that gzip would remove the plain file once it compressed the result (so effectively, you promise that if the file ex

Re: Cfengine Help: Re: Cfengine Help: cfengine 3.1.5 pcre question

2011-05-13 Thread Daniel V. Klein
There are a couple of slightly different ways of doing this in PCRE: 1) '.*(?i)cfengine.*' 2) '.*(?i:cfengine).*' The first one turns on the "/i switch for everything after it, so the .* is also case-ignored The second one turns on the "/i switch" only for "cfengine". There's no difference in

Re: how to use process_select?

2011-05-13 Thread Daniel V. Klein
One thing to add: processes are first selected by the name in the promise, and then by process_select (which may be missing, in which case you just get what was in the promise). All other actions are in the promise. So typically, you'd do one of two things: 1) Select "foo" in your promise nam

Re: Time classes lifecycle index

2011-05-08 Thread Daniel V. Klein
On May 7, 2011, at 11:20 PM, Jerome Baum wrote: > Also, you can already do "real math" -- call a shell command to do the > computation and use an appropriate return code, then define the class based > on that. If the command is pure (as in "pure function") then it fits in with > promise theory

Re: Time classes lifecycle index

2011-05-07 Thread Daniel V. Klein
l it works. So like Miyamoto Musashi says in "The Book of Five Rings": think hard on this. -Dan On May 7, 2011, at 10:54 PM, Jerome Baum wrote: > On Sun, May 8, 2011 at 04:49, Daniel V. Klein wrote: > Some business models use a 3-year lifecycle. Amortization and probably other

Re: Time classes lifecycle index

2011-05-07 Thread Daniel V. Klein
Some business models use a 3-year lifecycle. Amortization and probably other stuff. Since you can't do math directly in Cfengine, a "lifecycle index" is a quick way of getting a value based o the year, for evaluating lifecycles. Personally, I have no use for it - but other folks do! -Dan On

Re: program cf-promises

2011-03-31 Thread Daniel V. Klein
Actually, cf-promises WILL parse the file for syntax errors. While not exactly the case, classes are "run time" and syntax is "compile time" (except, as you correctly observer, when classes are used for selective compilation). So you could do this: cf-promises -Dmonitor and get your

Re: edit_files: delete_line and insert_lines sometimes give different results in static environment

2011-03-14 Thread Daniel V. Klein
A different solution would be to use delete_select and delete_if_not_match_from_list to eliminate the lines you don't want, then insert the ones you do. I am not saying this is better, but if you see different results (like, the problem doesn't "just happen" any more), then that'd help narrow

Re: Cfengine Help: Please help with regex format

2011-03-03 Thread Daniel V. Klein
It appears you have a slight misunderstanding on indices, etc. Here's how I would rewrite your code (I didn't test, but you seemed to have a spurious : and the wrong slist indexing the wrong array (there is no mypasswd_user array, it is the slist into the mypasswd_array array): bundle agent pa

Re: Problems with edit_line and edit_defaults=>empty

2011-02-23 Thread Daniel V. Klein
The promises look good, and AFAICT you should always get 2 lines, but I'd suggest the following change for you: vars: any:: "dns" string => "192.168.1.20"; machineX:: "search" string => "domain2"; !machineX:: "search" string => "domain1"; This makes it clearer

Re: Bug when copying a file and changing perms

2011-02-02 Thread Daniel V. Klein
Ad I stand corrected on the significance of the umask here :-) I overlooked the fact that the file was created if it didn't exist. -Dan On Feb 2, 2011, at 3:57 AM, Eystein Måløy Stenberg wrote: > I looked into this, because it was taunted so "critical". > You are exactly right, Seva. >

Re: Bug when copying a file and changing perms

2011-02-02 Thread Daniel V. Klein
Umm... "go+r" does not mean "mode = 044"! It means "add r to g and o" or in other words, "mode = mode | 044". The umask should have nothing to do with it, as that is only used for file creation, AFAIK. As to why they said, "go+r" instead of "644" is anyone's guess :-) -Dan On Feb 2, 2011, at

Re: Cfengine Help: Re: Feature request: add a flag to enable bug reporting / automatic submission

2011-01-07 Thread Daniel V. Klein
Even better... why not help the developers by checking out the test framework, and when you find a bug, create a test that demonstrates the bug by failing, but which will also pass if the bug is gone. -Dan On Jan 7, 2011, at 10:56 AM, Mike Svoboda wrote: > Well, Cfengine is a mature product,

Re: Cfengine Help: Re: replace_pattern with quotes

2011-01-07 Thread Daniel V. Klein
Are you certain that the pattern matches? I see an \{ and no matching \} in your promise. Likewise, I see spaces in your pattern - are the number and type of whitespace an exact match? You might want to consider using \s+ or \s* instead of just a single space. -Dan On Jan 7, 2011, at 10:48

Re: Cfengine Help: Inherit shell variables in "commands:"

2010-12-28 Thread Daniel V. Klein
You want a commands promise that is a "module". See http://www.cfengine.org/manuals/cf3-reference.html#module-in-commands. You can't exactly inherit shell variables, but this is pretty close to what you said you need, and probably what you really want. -Dan On Dec 28, 2010, at 10:05 AM, no-re

Re: whitespace in associative array indices

2010-12-21 Thread Daniel V. Klein
Jim- Great example, and nice clear concise description - I will add a test to the testing tool to check for this... -Dan On Dec 21, 2010, at 3:05 PM, Jim Lawson wrote: > Hi help-cfengine, > > Happy winter/summer solstice (depending on which hemisphere you live in)! > > I am trying to create

Re: classes

2010-12-17 Thread Daniel V. Klein
ich is not a list? Could that avoid the bug > with "singleton lists"? > > Cheers, > > Sandra > > On 12/17/2010 02:19 PM, Daniel V. Klein wrote: >> I did not read your config in detail, but you said "only one server in a >> class" and th

Re: classes

2010-12-17 Thread Daniel V. Klein
I did not read your config in detail, but you said "only one server in a class" and then I see lists, so... If you are running 3.1.0(?), you have possibly stumbled across a bug with singleton lists that is repaired in the versions after that. Upgrade to the latest version, and you should see th

Re: Cfengine Help: silly cfengine trick #!

2010-12-09 Thread Daniel V. Klein
Duh! Why didn't I think of that? It was the -f that had me stumped. Good call! On Dec 9, 2010, at 4:43 AM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: silly cfengine trick #! > Author: matter > Link to topic: https://cfengine.com/forum/read.php?3,19692,19692#msg-19692 > >

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: Cfengine Help: Re: Class case sensitivity

2010-12-01 Thread Daniel V. Klein
This seems like an awful lot of work to get the long/short hostname. What about: classes: "xxx" expression => regextract("([\w-]+)\..*", "$(sys.fqhost)", "short_host"); After this, you have the short hostname in $(short_host[1]), and the long one has always been available as $(sys.fqhost)

Re: Cfengine Help: Re: what if cf-runagent could be able to call just one bundle from the bundlesequence?

2010-11-27 Thread Daniel V. Klein
The problem that I see with this is that it turns Cfengine into more of a "push" technology. By defining a class, you're still letting the remote agent set the policy, but by saying "run this bundle", you're bordering on setting the policy remotely... -Dan On Nov 26, 2010, at 6:29 PM, no-re..

Re: Cfengine Help: Re: "Duplicate selection of value for variable ..." messages

2010-11-25 Thread Daniel V. Klein
${foo} and $(foo) are equivalent, and @{foo{ and @(foo) are also equivalent. On Nov 25, 2010, at 2:43 PM, Seva Gluschenko wrote: > I'm not Cfengine guru by any kind, but it seems like wrong syntax to me. Try > > "foo" slist => @(bar); > > (parenthesises, not braces). > > By all means, Cfengine

Re: Cfengine Help: Re: replace_patterns bug?

2010-11-24 Thread Daniel V. Klein
It might help everyone to think about regex's this way: Every repeating pattern (that is, with a *, +, or ?) is "elastic". WHich means that it will gobble up as much as possible, leaving the remainder of the string for the rest of the pattern to attempt to match. If the match occurs, fine. B

Re: Cfengine Help: replace_patterns bug?

2010-11-19 Thread Daniel V. Klein
Michael, you are right and I feel like a fool. Of course - the regex was wrong! But to meet you half way... the \s* matches the spaces the first time, and the [^0] matches the "1". After that, it replaces the 0 with a 1, and then you're 100% right. Doh! -Dan On Nov 19, 2010, at 5:50 PM, Mic

Re: Cfengine Help: replace_patterns bug?

2010-11-19 Thread Daniel V. Klein
First of all, thank you for the self-contained example! That helps a lot. As far as I can tell, you have found a bug (but also a mistake in your interpretation). Your pattern wont match in the string "enabled = 00", but not because you only have a single 0 (it's because the first "0 doesn't mat

Re: body executor control and separately defined classes

2010-11-19 Thread Daniel V. Klein
Chris- Well, actually I think Cfengine is doing what it was supposed to, then :-) Rather than resort to hoop-jumping, why not just get in the habit of executing your policy immediately after you check it in, to test for missed bugs? -Dan On Nov 19, 2010, at 10:17 AM, C R Ritson wrote: >> I ag

Re: body executor control and separately defined classes

2010-11-19 Thread Daniel V. Klein
Chris- I agree with Seva about hard classes. But this makes me ask: why are you so erratically validating your promises? Why not every 5 minutes, which is the default? Cfengine is lightweight, and does not load your system. But if you have "expensive" promises, just change the "if_elapsed"

Re: missing symlinks in recursive copies

2010-11-17 Thread Daniel V. Klein
You could use: body link_from example { when_no_source => "force"; } But why worry if you're copying the whole tree? Cfengine will converge on the correct solution, and the ultimate goal is what you seek, and Cfengine will provide that. -Dan On Nov 17, 2010, at 12:41 PM,

Re: vars defined in agent bundles not usable?

2010-11-16 Thread Daniel V. Klein
There is a bug that has been reported in the latest release involving slists with a single element. I am sure that a patch is on the way soon... -Dan On Nov 16, 2010, at 12:11 PM, Gusto wrote: > Hi Folks, > > I am seeing this behavior on the the 3.1.0 release, where if I define > in a bundle

Re: AW: sshd_conf managing with cfengine

2010-11-15 Thread Daniel V. Klein
Try something like this: body common control { bundlesequence => { "test" }; inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf" }; } bundle agent test { files: "/tmp/sshd_config" edit_line => uncomment_lines_containing("PermitRootLogin.*","#"), classes => if_repaired("restart_ss

Re: problem with process_select and ttime

2010-11-12 Thread Daniel V. Klein
No, I was worng (doh!). I am did more research into this, and it is not the selection issue as I suspected. I apologize for any misleading. There is something wrong with your range - 15 is not "15 minutes" :-) You should use "accumulated" on both sides of the irange. On Nov 12, 2010, at 4:32

Re: problem with process_select and ttime

2010-11-12 Thread Daniel V. Klein
It is probably not a bug - it is a language (in)consistency. Well, maybe that's a bug... let's see what Mark says? You are promising two contradictory things, and that is the basic problem. The first promise is that you will set a class "user_procs_out_of_range" if the number of processes matc

Re: readstringlist in 3.1.0

2010-11-09 Thread Daniel V. Klein
Good catch, Michael - but here's the weird bit - it turns out that the list is actually there, you just can't iterate over it! -Dan body common control { bundlesequence => { setup, atest }; version=> "0.01"; } bundle agent setup { files: "/tmp/foo" create => "true", edit_lin

Re: Strategies for modular bundlesequence and inputs

2010-11-09 Thread Daniel V. Klein
as to begin vith an >> empty slist (now that we can use "cf_null") and then add bundles >> and inputs for each class the client belongs to. But it's not >> possible to use the slist as in: >> >> "specific" slist => { @(specific) , "other_stuf

Re: Strategies for modular bundlesequence and inputs

2010-11-08 Thread Daniel V. Klein
On Nov 8, 2010, at 8:02 AM, Marc Baudoin wrote: > Daniel V. Klein écrit : >> IMHO, the better strategy is to put everything (common and specific) in the >> inputs > > I'd rather have only what's needed for each type of host instead > of loading everythin

Re: Cfengine Help: Re: how to redirect to /dev/null

2010-11-01 Thread Daniel V. Klein
You could always try -s :-) On Nov 1, 2010, at 5:21 PM, Jesse Becker wrote: > On Mon, Nov 01, 2010 at 03:10:27PM -0400, Daniel V. Klein wrote: >> Try using grep -q, it is much easier than redirecting > > But not portable. The -q option is a GNU extension. > > [je...@titan

Re: Cfengine Help: Re: how to redirect to /dev/null

2010-11-01 Thread Daniel V. Klein
Try using grep -q, it is much easier than redirecting On Nov 1, 2010, at 3:07 PM, JIM AMANATIDIS, BLOOMBERG/ 731 LEXIN wrote: > > Okay, this seems to break with the string being searched is wrapped in > quotes, regardless of how many "\" surround it to escape it: > > classes: >"Has_ce_nic

Re: Cfengine Help: Re: Feature Request

2010-11-01 Thread Daniel V. Klein
It makes sense to do something if a file exists or not (you can do that now), and likewise if a file is of zero-size or not (not currently possible, but a non-existent file should also have zero size), so it seems logical to also do something based on a file's size (i.e., /foo/baz is bigger than

Re: Cfengine Help: Re: Multi-dimensional arrays

2010-10-27 Thread Daniel V. Klein
I guess that depends on what you mean by multidimensional arrays... :-) But this works: body common control { bundlesequence => { "test" }; nova_edition:: host_licenses_paid => "5"; } bundle agent test { vars: "a" string => "a"; "a[1]" string => "a sub 1"; "a[1][foo]" string => "a

Re: Cfengine Help: Read input files after update

2010-10-27 Thread Daniel V. Klein
Michael is certainly correct, but the other side of the answer is: why worry about it? Cfengine is designed to be convergent - if you make a change to your masterfiles, your inputs will be updated soon enough. If you're worried about testing your changes, then the better way to do it is have a

Re: Cfengine Help: usebundle and slist of sub-bundles

2010-10-26 Thread Daniel V. Klein
This will work as of 3.1.0, but do it this way instead (auto-iteration is always through a scalar reference to a list): bundle agent some_bundle { vars: "bundle_list" slist => some_function_generating_slist(...); methods: "any" usebundle => "$(bundle_list)"; } -Dan On O

Re: Unable to delete a directory

2010-10-25 Thread Daniel V. Klein
Yes, it is a bug which has since been fixed. I'd recommend upgrading to a newer version of Cfengine (and 3.1.0 will be coming out soon, too!) -Dan On Oct 25, 2010, at 2:06 PM, Jean-Noël Rivasseau wrote: > Hello, > > I want to delete a directory and all its content, I am running cfengine 3.0.3

Re: Cfengine Help: variable expansion inside a single bundle

2010-10-21 Thread Daniel V. Klein
Weird - the email version stripped the stuff in square brackets! There seems to be a bug in the mail system conversion... -Dan On Oct 21, 2010, at 10:56 AM, Seva Gluschenko wrote: > Daniel, look into forum. They are arrays. > > 2010/10/21 Daniel V. Klein : >> Your variab

Re: Cfengine Help: variable expansion inside a single bundle

2010-10-21 Thread Daniel V. Klein
Your variable "array1" and "array2" are not arrays - they are scalar strings. On Oct 21, 2010, at 10:12 AM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: variable expansion inside a single bundle > Author: bglomm > Link to topic: https://cfengine.com/forum/read.php?3,18819,18819#

Re: Cfengine Help: Re: Strange behaviour with insert_lines

2010-10-19 Thread Daniel V. Klein
Look at "empty_file_before_editing". You need to know that cfengine doesn't actually empty the file that you are promising - it makes a copy, does the edits on the copy, and overwrites the existing file if it needs to. So when you say "empty_file_before_editing", it starts the edits on a clean

Re: Cfengine Help: Strange behaviour with insert_lines

2010-10-19 Thread Daniel V. Klein
babudro- It _is_ confusing, but the explanation is simple: In one edit cycle, Cfengine considers the insertion of each line, one at a time. If it sees a line already present that it is supposed to insert, it does not insert it twice. So each of your blank comment lines are the same - and onl

Re: 3.1.0b2 - library.cf still conflicts with cfengine_stdlib.cf

2010-10-14 Thread Daniel V. Klein
As far as I know, library.cf is no longer part of the Cfengine distribution. Th only file that you should have is cfengine_stdlib.cf - if there are any conflicts, you should just change your private version of library.cf. -Dan On Oct 13, 2010, at 7:09 PM, Aleksey Tsalolikhin wrote: > Hi. Thi

Re: Cfengine Help: Best practice in edit_lines

2010-10-12 Thread Daniel V. Klein
Well first of all, look in cfengine_stdlib.cf - you might want to simply create a modified version of set_variable_values to do what you want (where you change the delimiter to "\s+" or something. But more importantly, you have a fundamental misunderstanding of how edit_lines works. Here's bas

Re: Cfengine Help: problem restarting services

2010-10-08 Thread Daniel V. Klein
One simple solution would be to define an array that maps service to process... What I show below is a quick kludge (if /etc/init.d/bind fails, then try /etc/init.d/bind9), but you could be neater and make something that uses isvariable(). Or you could simply define an array element for *every

Re: Cfengine Help: Re: Force variables to be defined after classes?

2010-10-08 Thread Daniel V. Klein
Jesse- A very simple solution to your problem is to define the classes in a common bundle that gets executed before the agent bundle the defines the variables. It isn't convoluted, but it might be counterintuitive if you're used to a procedural language (and Cfengine is declarative, not proced

Re: Cfengine Help: Looking for ideas: System User Management

2010-09-28 Thread Daniel V. Klein
Eduard- I have been developing a "maintain user accounts" system with Cfengine (so that you can add users and initialize their dotfiles, do password distribution or allow users to change their passwords, mark some fields as static and others as changeable, etc). This will be released very soon

Re: Cfengine Help: dynamic variable declaration

2010-09-23 Thread Daniel V. Klein
Bernhard- It would help if I understood better what you are trying to accomplish with the array... but a few things: 1) Look at section 11.1.2 at http://www.cfengine.org/manuals/cf3-reference.html#Introduction-to-functions for building array's from data 2) The error you're getting on this line

Re: Cfengine Help: Re: Accessing variables declared within cf3 modules

2010-09-16 Thread Daniel V. Klein
Yes, I will make sure it is clearer... maybe not 72pt, though :-) On Sep 16, 2010, at 4:44 PM, Jesse Becker wrote: > Is there a way to have this Seva's comment below integrated into the > docs, preferably in 72pt type? :-) > > Subtleties like this are nearly impossible to find in the current >

Re: Looking for ideas on people's config

2010-09-15 Thread Daniel V. Klein
What some people have done is to limit the number of bundles in the bundlesequence to the common stuff, but have one of the bundles call a bunch of modules: body common control { bundlesequence => {"update", "classes", "security", "host_specific", "tidy", "backup" }; } bundle agent host_speci

Re: Logic headache

2010-09-14 Thread Daniel V. Klein
Nope. What you're forgetting is the DeMorgan Laws. !A & !B <=> ! (A | B) !(A & B) <=> !A | !B -Dan On Sep 14, 2010, at 2:16 PM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: Logic headache > Author: neilhwatson > Link to topic: https://cfengine.com/forum/read.php?3,18232,182

Re: Cfengine Help: Re: Questions about the reference manual

2010-09-13 Thread Daniel V. Klein
On Sep 13, 2010, at 3:14 PM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: Re: Questions about the reference manual > Author: mwlarsen > Link to topic: https://cfengine.com/forum/read.php?3,18107,18209#msg-18209 > > neilhwatson Wrote: > --

Re: Cfengine Help: Re: Handles vs Classes - Scope Intersection

2010-09-12 Thread Daniel V. Klein
Actually, you're getting a different error. The syntax error cf3:/var/lib/cfengine3/inputs/promises.cf:64,25: syntax error, near token '@' is the first thing you need to look at. Everything else comes from it. The problem is that, like it or not, all variables in Cfengine must currently

Re: Cfengine Help: Handles vs Classes - Scope Intersection

2010-09-12 Thread Daniel V. Klein
Nima- Comments inline, below... -Dan On Sep 11, 2010, at 11:03 PM, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: Handles vs Classes - Scope Intersection > Author: nima > Link to topic: https://cfengine.com/forum/read.php?3,18170,18170#msg-18170 > > Are we free to do the follow

Re: Regex behavior in Cf3

2010-09-03 Thread Daniel V. Klein
19 PM, Tod Oace wrote: > On Sep 1, 2010, at 11:53 AM, Daniel V. Klein wrote: > >>> /^($(regexes))$/ # The slist contains strings, but they are >>> expanded and then the result is interpreted as a regex > > I like that. It's very familiar syntax, and solv

Regex behavior in Cf3

2010-09-01 Thread Daniel V. Klein
Mark- I'm Cc'ing this to the mailing list so that the rest of user community can chime in (since I may be barking up the wrong tree). This is in response to the many bug reports I see which involve regex's (that are in fact, not bugs but misunderstandings as to what are regex characters). It'

Re: Copy/Merge

2010-08-04 Thread Daniel V. Klein
Will- There is another way to do this (although Mark is certainly correct in what he says), and that is to do the management of the differences outside of Cfengine: 1) Create two subdirectories: $(masterfiles)/everyone and $(masterfiles)/special_everyone 2) Populate both those directories with

Re: Segmentation fault when using usebundle and bundle does not exists

2010-07-29 Thread Daniel V. Klein
Correct me if I am wrong, but there does not appear to be a bundle named "crash" anywhere, right? -Dan On Jul 29, 2010, at 3:49 AM, Bas van der Vlies wrote: > On 28 jul 2010, at 17:28, Bas van der Vlies wrote: > >> Hello, >> >> cfengine 3.0.5, did not see anything in the Changelog if this is

Re: Cfengine Help: Looking for suggestions on ordering

2010-07-01 Thread Daniel V Klein
Heh - just use "set_variable_values" from cfengine_stdlib.cf! Or see how it is done there - it's rather clever (I wish I thought of it :-) -Dan > Forum: Cfengine Help > Subject: Looking for suggestions on ordering > Author: Authority > Link to topic: https://cfengine.com/forum/read.php?3,17628,1

Re: Cfengine Help: Problems using the cfengine_stdlib

2010-06-25 Thread Daniel V. Klein
The error says: "Redefinition of body start for location". So clearly you must have a "body location start {..." somewhere else in your promises! You can only have ONE body of a type with a certain name, and cfengine_stdlib.cf is defining the second one in your collection of promises... -Dan

Re: Multiple Policy Servers

2010-06-11 Thread Daniel V Klein
No, this is not a Nova-ony feature. The policy_server.dat file is part of the Nova configs, but you can build the functionality yourself in Community. -Dan > Ummpossibly. :) I've never used Community, so I guess I don't know exactl > y where the differences are. However, promises.cf reads th

Configuration Management Summit

2010-06-08 Thread Daniel V Klein
With Mark's permission, I am wearing my USENIX hat for this email and promoting a couple of upcoming events that will prominently feature Cfengine... First, I'd like to make sure you are all aware of the Configuration Management Summit in Boston on June 24 (details are at http://www.usenix.org

Re: append value to variable slist

2010-06-05 Thread Daniel V Klein
I hear that you would prefer to write it one way, but sorry, you can't. Well, you sort of can, you need to look at "policy => free" or the synonym for this which is "policy => overridable", but we think you'd be wrong. Let me give you a counterexample. I program in C, and there really have been

Re: dependencies of bundles

2010-06-03 Thread Daniel V Klein
Take a look at methods promises, and specifically the value given to the usebundle attribute. http://www.cfengine.org/manuals/cf3-reference.html#methods-in-agent-promises -Dan > Hello. I need some feature like dependecies in bundles. > > For example: i have 5 agent bundles that can do specific

Re: Command execution if directory doesn't exist

2010-06-02 Thread Daniel V Klein
Is one of the commands perhaps to create the directory you want? Why not use the "create => true" attribute and just let the promises converge to the desired state? -Dan > --===1770191284== > Content-Type: multipart/alternative; boundary=0016e6470cf819ef39048813b6ae > > --0016e6470c

Re: Conditional control_common attribute

2010-05-24 Thread Daniel V Klein
Justin- Do you really have three separate licenses, or do you just want to distribute policy from three servers? If the latter, the host_licenses_paid is the number of licenses, not the number of suppoorted clients (and so you don't need to have a conditional control parameter :-) And if the for

Re: Problem defining classes from an slist

2010-05-17 Thread Daniel V Klein
anged mine to an agent bundle and it worked fine, but I'd like to do > it in a common bundle for global access. Is this a technical limitation > with how common bundles work? > > Justin > > -Original Message- > From: Daniel V Klein [mailto:d...@lonewolf.com] &

  1   2   >