Hi,

Works fine for me:

matti@acrux ~ $ cat > test.erb
*.notice;news.none;cron.none @loghost:514

<% if @hostname == "foo" %>
  # Provides UDP syslog reception
  $ModLoad imudp.so
  $UDPServerRun 514
<% end %>
matti@acrux ~ $ sed -i 's/foo/acrux/' test.erb
matti@acrux ~ $ cat | puppet apply
file { '/tmp/test.txt':
  content => template('/tmp/test.erb')
}
notice: /Stage[main]//File[/tmp/test.txt]/ensure: defined content as 
'{md5}c3230100f527db4f0fe50e200ed99fe9'
notice: Finished catalog run in 0.06 seconds
matti@acrux ~ $ cat /tmp/test.txt
*.notice;news.none;cron.none @loghost:514


  # Provides UDP syslog reception
  $ModLoad imudp.so
  $UDPServerRun 514
matti@acrux ~ $

KW

On Friday, August 31, 2012 6:40:26 PM UTC+1, banjer wrote:
>
> Thanks for the reply KW, but thats not quite what I was asking.  Heres the 
> relevant section of the template:
>
>
> *.notice;news.none;cron.none @loghost:514
>
> <% if @hostname == "foo" %>
>   # Provides UDP syslog reception
>   $ModLoad imudp.so
>   $UDPServerRun 514
> <% end %>
>
> So you can see it lives outside of a <%  %> block.
>
> This part: "*.notice;news.none;cron.none @loghost:514*" *should be a 
> literal string.  Its a standard rsyslog configuration.  "Loghost" is the 
> actual hostname of a host in our network that we send all of our servers' 
> syslogs to.  In other words, I don't want it to be evaluated as ERB code.  
> So how can I have puppet/the template engine ignore the '@' symbol and 
> treat it as a literal string?
>
>
>
>
> On Friday, August 31, 2012 11:21:08 AM UTC-4, Krzysztof Wilczynski wrote:
>>
>> Hi,
>>
>> I am not sure how your template looks like, or how do you render it, but 
>> try to avoid putting anything with @ into a <%= %> block. It should just 
>> work:
>>
>> matti@acrux ~ $ irb
>> >> require 'erb'
>> => true
>> >> host = 'localhost'
>> => "localhost"
>> >> p ERB.new('*.notice;news.none;cron.none @<%= host 
>> %>:514').result(binding)
>> "*.notice;news.none;cron.none @localhost:514"
>> => nil
>> >> @host = host.clone
>> => "localhost"
>> >> p ERB.new('*.notice;news.none;cron.none @<%= @host 
>> %>:514').result(binding)
>> "*.notice;news.none;cron.none @localhost:514"
>> => nil
>> >> 
>>
>> matti@acrux ~ $ cat | puppet apply --noop
>> notice inline_template('*.notice;news.none;cron.none @<%= @hostname 
>> %>:514')                           notice: Scope(Class[main]): 
>> *.notice;news.none;cron.none @acrux:514
>> notice: Finished catalog run in 0.03 seconds
>> matti@acrux ~ $ 
>>
>> KW
>>
>> On Friday, 31 August 2012 15:09:17 UTC+1, banjer wrote:
>>>
>>> Hi,
>>> I have a template named rsyslog.conf.erb, and the puppet agents seem to 
>>> be choking on this:
>>>
>>> **.notice;news.none;cron.none @loghost:514*
>>>
>>>
>>> The agents report an error of ": bad URI(is not URI?): " followed by a 
>>> bunch of jargon.  I'm pretty sure its the literal '@' symbol that its 
>>> trying to evaluate as erb code.  How can I escape this @ symbol so its a 
>>> literal?  Thanks.
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/U6pC8D80PeQJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to