Re: [Puppet Users] Re: Auto-generate multiple facts

2013-03-13 Thread Toni Schmidbauer
At Wed, 13 Mar 2013 05:53:37 -0700 (PDT), Gavin Williams wrote: > What I'm struggling with is how to remove the \n character easily as part > of the existing code... :s db.chomp! regards toni -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To

[Puppet Users] Re: Auto-generate multiple facts

2013-03-13 Thread Gavin Williams
Think I've sorted it actually... Did this: === --- lib/facter/oracle_clones.rb(revision 96307) +++ lib/facter/oracle_clones.rb(working copy) @@ -9,7 +9,7 @@ Facter.add("clone_#{db}") do setcode { # Look

[Puppet Users] Re: Auto-generate multiple facts

2013-03-13 Thread Gavin Williams
John I've updated to use the new fact, however I'm getting some intermittent hanging issues when Puppet agent is loading facts... Tracked it down to the below fact, and specifically it looks like a '\n' is creeping into the db var, which is causing the grep exec to hang :( Put in some additi

[Puppet Users] Re: Auto-generate multiple facts

2013-03-11 Thread Gavin Williams
John Cheers for that... Still getting the hang of Ruby, and looks like it allows code to be cut down to a one liner quite easily :D Will give your code a test and report back... Cheers Gavin On Monday, 11 March 2013 14:44:54 UTC, jcbollinger wrote: > > > > On Friday, March 8, 2013 9:43:30 AM

[Puppet Users] Re: Auto-generate multiple facts

2013-03-11 Thread jcbollinger
On Monday, March 11, 2013 9:44:54 AM UTC-5, jcbollinger wrote: > > # JCB: must use lines() or each_line(), not each() > > running_dbs.lines.grep(/REPC/).each do |db| > > I see that that comment might be confusing, since I do ultimately use each(). The comment was written toward the original c

[Puppet Users] Re: Auto-generate multiple facts

2013-03-11 Thread jcbollinger
On Friday, March 8, 2013 9:43:30 AM UTC-6, Gavin Williams wrote: > > Hmm, it seems that the new fact has broken my Network devices?! :( > > Getting the following when trying to run puppet against a network device: > $ sudo puppet device --deviceconfig devices/act-star-nactl01.conf -v > Info: sta

[Puppet Users] Re: Auto-generate multiple facts

2013-03-08 Thread Gavin Williams
Hmm, it seems that the new fact has broken my Network devices?! :( Getting the following when trying to run puppet against a network device: $ sudo puppet device --deviceconfig devices/act-star-nactl01.conf -v Info: starting applying configuration to act-star-nactl01 at act-star-nactl01 Info: Re

[Puppet Users] Re: Auto-generate multiple facts

2013-03-08 Thread Gavin Williams
Google to the rescue again... Stumbled across this link: http://serverfault.com/questions/325591/puppet-checking-sets-of-variables This suggested using the "inline_template" function to do an erb evaluation of my variable... So changed the following line: # Get export path fact for db $

[Puppet Users] Re: Auto-generate multiple facts

2013-03-08 Thread Gavin Williams
Ok, next challenge now I've got these facts is how to get the values out of them in my Puppet manifests :S As it's now an auto-generated name, I've got to work out a dynamic fact name, and then pull that value back... Have tried a few different code combos, however i'm not getting any luck :(

[Puppet Users] Re: Auto-generate multiple facts

2013-03-08 Thread Gavin Williams
Ok, looks like I wasn't googling hard-enough :( Managed to find Nan Liu's Puppetlabs blog post Facter Part 3: Caching and TTL , which showed how to generate multiple facter facts on the fly :) So after a bit of coding came up with: