Problem recognizing existence of directory

2009-12-17 Thread bernd . adamowicz
I guess I'm facing a typical beginners problem, however, I didn't find a solution. I'm checking the existence of a directory. If it's not there, I'm going to extract a tarball which creates it and some other files. This works very fine. However the extracting of the tarball is done sometimes to

Re: Problem recognizing existence of directory

2009-12-17 Thread Nicolas Charles
Hi, Maybe you could use something like this : bundle agent check_nagios_installation { files: "${nagios_install_dir}/" create => "true", comment => "Creating nagios directory", classes => if_repaired("not_nagios_installed"); commands: not_nagios_instal

Re: Problem recognizing existence of directory

2009-12-17 Thread bernd . adamowicz
Hi Nicolas, I tried your example and this is what happened: - the nagios directory is created (which should lead to creating the class 'not_nagios_installed') - the extraction of the tarball does not happen at all Having a look at the output of the agent there's no evidence that anything is ha

Re: Problem recognizing existence of directory

2009-12-17 Thread NWatson
Verbose output might be better than debug output for discovering faults. Also it might be more efficient to have CF copy the files recursively than copying a tar ball and then extracting it. You'll have greater reliability too as CF will log any problems during the copy. Sincerely, -- Neil Wat

Re: Problem recognizing existence of directory

2009-12-17 Thread bernd . adamowicz
Following your advice concerning copying instead of extracting a tarbal I have implemented this: 158 bundle agent check_nagios_installation { 159 160 files: 161 "/usr/local/nagios/." 162 comment => "Creating Nagios installation", 163 depth_search => recurse("in

warnings promise classes

2009-12-17 Thread NWatson
Perhaps I'm misunderstanding but it seems to me that warning actions are outside of the normal promise classes. It would be nice if instead they were a fourth class. For example consider this promise. files: any:: "/tmp/foo" action => warn_now,

Re: Problem recognizing existence of directory

2009-12-17 Thread NWatson
We've all been or are still there. CF's promise theory offers a different way of thinking. It's takes some time to adjust to it. Think of it like calculus. For a while your brain just explodes but, eventually it starts to make sense. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY

Re: Problem recognizing existence of directory

2009-12-17 Thread Brendan Strejcek
Regarding your original case, it would be more natural to use isdir() rather than fileexists() (though both should work). I can't replicate any problems with either isdir() or fileexists() though. I also tried interpolating a variable into the path checked for, because that seems like a likely plac

Re: Problem recognizing existence of directory

2009-12-17 Thread Brendan Strejcek
This is reliable, but not very efficient. It requires at least 2N file checksum calculations (where N is the number of files in the tree being copied or verified) on every pass. You are also using 2N space, since you are storing a copy in ${sys.workdir} to compare against. Another suggestion: use

Re: Problem recognizing existence of directory

2009-12-17 Thread NWatson
Brendan Strejcek wrote on 2009-12-17 10:44:35: > This is reliable, but not very efficient. It requires at least 2N file > checksum calculations (where N is the number of files in the tree > being copied or verified) on every pass. You are also using 2N space, > since you are storing a copy in ${s

List iteration within parameterized bundles

2009-12-17 Thread Bryan Ramirez
Here's a very simple example of something that looks like it should work and doesn't. My question is should I find a different way of doing this, or should this work? This will just put "server 10.90.34.15" into the file, but not the other line. bundle agent ntp { vars: "ntpserver

Re: List iteration within parameterized bundles

2009-12-17 Thread Mark Burgess
See http://www.cfengine.org/manuals/cf3-reference.html#List-variable-substitution-and-expansion Bryan Ramirez wrote: > Here's a very simple example of something that looks like it should work > and doesn't. My question is should I find a different way of doing > this, or should this work? > >

Re: List iteration within parameterized bundles

2009-12-17 Thread NWatson
You can pass the entire list for greater efficiency. ... files: redhat|suse|sunos_5_10:: "${crontabs}/root" comment => "Added cron jobs to table.", edit_line => AppendIfNoLine("@{cron.root_cron_lines}"); } bundle edit_line AppendIfNoLine(l

Re: Solaris packages

2009-12-17 Thread Mark Burgess
Simon, I checked with my guys now, and they claim the standard solaris packages body works ok with solaris 10 (see the one in tests/units) M Simon Barrett wrote: > I'm using Solaris 10 5/09 with standard Solaris pkgadd, pkginfo commands. > > Many Thanks, > > Simon > > > > 2009/11/12 Mark

Updating Solaris cfengine binaries

2009-12-17 Thread Justin Lloyd
I have a theoretical question regarding updates of cfengine binaries on Solaris systems. I've not tested this yet, so I'm just looking for comments from anyone who has experience with this. If cfengine is installed as a package, when cfengine pulls updated binaries from the policy server, that woul

Re: List iteration within parameterized bundles

2009-12-17 Thread Bryan Ramirez
This was the approach I was going to try next. I just didn't know if what I did should work. Thanks, Bryan On Thu, 17 Dec 2009 nwat...@symcor.com wrote: > Date: Thu, 17 Dec 2009 11:04:44 -0500 > From: nwat...@symcor.com > To: Bryan Ramirez > Cc: help-cfengine@cfengine.org, help-cfengine-boun..

Re: List iteration within parameterized bundles

2009-12-17 Thread NWatson
See this earlier thread. https://cfengine.org/pipermail/help-cfengine/2009-December/006742.html 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 in

Re: Updating Solaris cfengine binaries

2009-12-17 Thread Brendan Strejcek
This is something that you will need to test on a spare box, but I think you are correct that the Solaris package manager would get in the way. You could use Cfengine to schedule an at or cron job to do the upgrade. On Thu, Dec 17, 2009 at 11:43 AM, Justin Lloyd wrote: > I have a theoretical que

Re: Updating Solaris cfengine binaries

2009-12-17 Thread NWatson
If I understand you correctly you have a problem with two masters. CF is updating binaries but so is the Solaris package manager. Only one service should be in charge of keeping CF binaries up to date. Either is fine but be consistent. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALIT

Setting perms based on server copy?

2009-12-17 Thread Jessica Greer
I could have sworn I read or heard that cf3 would allow for permissions on a file copy to be set to match the permissions on the master copy. I don't see that in the latest manual, though, and I could argue it impinges, to some degree, on agent autonomy - so maybe this was wishful thinking on my p

Re: Setting perms based on server copy?

2009-12-17 Thread NWatson
http://www.cfengine.org/manuals/cf3-reference.html#copy_005ffrom-in-files 'preserve' You are correct however that trusting the perms on the source file is not ideal. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including any attachments, is for the exclus

RE: Updating Solaris cfengine binaries

2009-12-17 Thread Justin Lloyd
Yes, that's the basic problem. I don't see how it's possible to use Cfengine's package management facility to handle updating the Solaris Cfengine package, given there's no package update/upgrade command on Solaris, only pkgrm and pkgadd. Thus you'd have to have it remove the current package to

What means tidy in dirlinks on the delete body?

2009-12-17 Thread Jean-Noël Rivasseau
Hello, there are three options for dirlinks: delete, keep and tidy. What means tidy? This is not explained in the manual; please update the manual accordingly. -- Jean-Noël Rivasseau ___ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfen

Uncommenting in cf3?

2009-12-17 Thread Jessica Greer
Can I get examples of uncommenting lines from other cf3 users? Commenting is straightforward with replace_with, but uncommenting seems non-trivial. I thought about using getfields(), using my comment character as a delimiter, to stuff the remainder of the line into a variable I could then use wit

Re: Uncommenting in cf3?

2009-12-17 Thread Michael Potter
actually it is very trivial. just use a regular expression to match the part of the string excluding the comment, and then replace the string with $(match.1) i.e. if a commented line was: # username=password You could use a regex like: #\s+(.*) And replace it with $(match.1) to get usernam

Re: Uncommenting in cf3?

2009-12-17 Thread Mark Burgess
Jessica, try this... ## # # Uncomment lines # ## body common control { version => "1.2.3"; bundlesequence => { "testbundle" }; } # try this on some test data