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). Thanks -- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white@ttiltd.com 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com Need help communicating between generations at work to achieve your desired success? Let us help! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Thu, Jun 23, 2011 at 12:25, Craig White <craig.white@ttiltd.com> 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. Regards, Daniel -- ⎋ Puppet Labs Developer – http://puppetlabs.com ✉ Daniel Pittman <daniel@puppetlabs.com> ✆ Contact me via gtalk, email, or phone: +1 (877) 575-9775 ♲ Made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 23.6.2011 21:47, Daniel Pittman wrote:> On Thu, Jun 23, 2011 at 12:25, Craig White <craig.white@ttiltd.com> 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
On Jun 23, 2011, at 12:47 PM, Daniel Pittman wrote:> On Thu, Jun 23, 2011 at 12:25, Craig White <craig.white@ttiltd.com> 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.