Jesse Cotton
2014-May-25 23:16 UTC
[Puppet Users] Patterns for building configs using hashes & arrays
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 reassigned (within the same scope). This has become a real issue while trying to dynamically build hashes and arrays that reflect the options and flags that are passed to duplicity. I opted for this approach b/c it makes composition easier and it results in a very clean template definition. For example, ``` <%- @_flags.each do |flag| -%> <%= flag -%> \ <%- end -%> <%- @_options.each do |key,val| -%> <%= key -%> <%= val -%> \ <%- end -%> ``` As opposed to checking for the existence of a dozen different variables and outputting their values if they have a "good" value. How do others work around this issue? I am looking at this the wrong way? -- 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+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fcca193a-8ceb-4dd3-a7bc-c653c38a7734%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.