On Jun 23, 2011, at 12:47 PM, Daniel Pittman wrote: > On Thu, Jun 23, 2011 at 12:25, Craig White <[email protected]> wrote: >> >> Perhaps I am going at this the wrong way but I am getting far using the >> vhosts methodology from Pro Puppet and now I want to optionally include a >> static text file. >> >> <% if location_file_inc != '' %-> >> <% include #{location_file_inc} %> >> <% end -%> >> >> >> and I have '/etc/puppet/modules/apache/files/test.txt' in $location_file_inc >> with a bunch of rewrite rules & conditions and even some specific admin type >> subdirectory access controls which clearly are vhost specific and not well >> generalized. >> >> The above code fails to build a catalog. >> >> What is the best way to 'include' a file in an erb template (I think I am >> good with the conditionals). > > So, erb doesn't have any 'include' operation. If your file is just > static text, this should work: > > <%= File.open('/path/to/file').read %> > > If it has actual ERB content, life is more difficult. > > As an alternative, some folks use one of the various 'concat' file > modules, like the one by R.I.Pienaar, or the providerised version > recently posted to the dev list, that allows you to construct the > final file on the client. ---- File.open is enough for the time being - thanks. I forgot that this was available to me.
Craig -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
