On 23.6.2011 21:47, 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.
As another alternative, one could handle the include at apache level. Make the location_file_inc a separate file and include it from your vhost config. -- Kind Regards, Markus Falb
signature.asc
Description: OpenPGP digital signature
