[Puppet Users] Re: Patterns for building configs using hashes & arrays

2014-05-27 Thread jcbollinger
On Sunday, May 25, 2014 6:16:28 PM UTC-5, Jesse Cotton wrote: > > I am new to puppet and decided to really get my feet wet by writing a > duplicity module (https://github.com/JCotton1123/puppet-duplicity.git). I > am struggling to deal with the fact that variables are immutable and cannot > be

Re: [Puppet Users] Re: Patterns for building configs using hashes & arrays

2014-05-27 Thread Felix Frank
Hi, On 05/26/2014 03:43 PM, Jesse Cotton wrote: > if $gpg_key_id == undef { > $flags += ['--no-encryption'] > } adding to arrays may actually work. > else { > $options['--encrypt-id'] = $gpg_key_id > } Yeah, I guess that's an issue. You may find that such logic will indeed have to move to your

[Puppet Users] Re: Patterns for building configs using hashes & arrays

2014-05-26 Thread William Leese
This should help: https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/parser/functions/delete_undef_values.rb -- 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, se

[Puppet Users] Re: Patterns for building configs using hashes & arrays

2014-05-26 Thread Jesse Cotton
I like this approach too :) I am just wondering how you build the hash or array up since variables are immutable and cannot be reassigned. For example, I want to do the below however I can't. define duplicity::job( $directories= [], $gpg_key_id = undef, $print_stats

[Puppet Users] Re: Patterns for building configs using hashes & arrays

2014-05-25 Thread William Leese
I've always found that when creating modules I'd focus on creating class parameters out of the most important configuration options of whatever I'm managing. After that I'd add a similar approach as yours for "everything else". This is a good approach because your module becomes usable for all