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
  $oracle_sid_lower = downcase($oracle_sid)
  $fact_name = "clone_${oracle_sid_lower}"
  # Use an inline template to lookup dynamically generated fact name
  $export_line = inline_template('<%= scope.lookupvar(fact_name) %>')

And hey-presto, it works... :D

Cheers
Gav

On Friday, 8 March 2013 10:54:53 UTC, Gavin Williams wrote:
>
> 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 
> :( 
>
> Is this something that's just not possible, or am I missing a trick? I'm 
> hoping the latter... 
>
> Cheers
> Gav
>
> On Friday, 8 March 2013 09:50:44 UTC, Gavin Williams wrote:
>>
>> Ok, looks like I wasn't googling hard-enough :( 
>>
>> Managed to find Nan Liu's Puppetlabs blog post Facter Part 3: Caching 
>> and TTL <https://puppetlabs.com/blog/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: 
>> https://gist.github.com/fatmcgav/5115394#file-oracle_clones-rb
>>
>> Cheers 
>> Gav
>>
>> On Friday, 8 March 2013 09:12:55 UTC, Gavin Williams wrote:
>>>
>>> Morning all
>>>
>>> I'm currently trying to work out a method to auto-generate a set of 
>>> facts. 
>>> These facts need to contain information about what database clones have 
>>> been created using NetApp SnapManager for Oracle on a given Host... 
>>>
>>> I need the fact to give the following information:
>>> clone_ACREPC11 => 
>>> 10.10.160.1:/vol/SnapManager_20130307153440293_v_ACTEST11_oradata/q_ACTEST11_oradata
>>>
>>> ACREPC11 is an generated database SID that will change across clones, 
>>> and the value is an auto-generated NFS export path... 
>>> The export path is going to be grepped out of the fstab, which I can 
>>> handle :D
>>>
>>> However there could be multiple clones on a given host, so ideally I 
>>> want one fact file to generate all the required facts... 
>>>
>>> Possible? 
>>>
>>> Cheers
>>> Gavin 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to