FAQ
Hi guys,

I'm trying to do the following in my template:

location <%= location %> {
proxy_pass <%= proxy %>;
<% if scope.lookupvar('nginx::resource::location::proxy_header') then
scope.lookupvar('nginx::resource::location::proxy_header').each do
header| %>
proxy_set_header <%= header %>
<% end %>
}

But i'm getting this error instead:

err: Could not retrieve catalog from remote server: Error 400 on SERVER:
compile error
/etc/puppet/modules/nginx/templates/vhost/vhost_location_proxy.erb:9:
syntax error, unexpected $end, expecting kEND
; _erbout
^
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

I've tried changing to

<% if scope.lookupvar('nginx::resource::location::proxy_header')
scope.lookupvar('nginx::resource::location::proxy_header').each do
header| %>
and

<% if scope.lookupvar('nginx::resource::location::proxy_header') %>
<% scope.lookupvar('nginx::resource::location::proxy_header').each
do |header| %>

and

<% if scope.lookupvar('nginx::resource::location::proxy_header')
then scope.lookupvar('nginx::resource::location::proxy_header').each do
header| %>
but none of these are working. Any pointers are definitely appreciated

--
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/-/MTSFB6oGybYJ.
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.

Search Discussions

  • Gonzalo Servat at Sep 3, 2012 at 4:22 am

    On Mon, Sep 3, 2012 at 1:31 PM, Choon Ming Goh wrote:

    Hi guys,

    I'm trying to do the following in my template:

    location <%= location %> {
    proxy_pass <%= proxy %>;
    <% if scope.lookupvar('nginx::resource::location::proxy_header') then
    scope.lookupvar('nginx::resource::location::proxy_header').each do
    header| %>
    proxy_set_header <%= header %>
    <% end %>
    Not sure if this is it, but try adding another <% end %> as you have an
    "if" statement and a "do" block to close.

    - Gonzalo

    --
    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.
  • Choon Ming Goh at Sep 3, 2012 at 9:03 am
    Hey,

    Thanks it works! Funny that it didnt work before this as I swore I tried it
    too. my luck maybe.
    On Monday, September 3, 2012 12:14:54 PM UTC+8, Gonzalo wrote:

    On Mon, Sep 3, 2012 at 1:31 PM, Choon Ming Goh <choonm...@gmail.com<javascript:>
    wrote:
    Hi guys,

    I'm trying to do the following in my template:

    location <%= location %> {
    proxy_pass <%= proxy %>;
    <% if scope.lookupvar('nginx::resource::location::proxy_header') then
    scope.lookupvar('nginx::resource::location::proxy_header').each
    do |header| %>
    proxy_set_header <%= header %>
    <% end %>
    Not sure if this is it, but try adding another <% end %> as you have an
    "if" statement and a "do" block to close.

    - Gonzalo
    --
    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/-/RsZd0U66mlgJ.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedSep 3, '12 at 3:31a
activeSep 3, '12 at 9:03a
posts3
users2
websitepuppetlabs.com

2 users in discussion

Choon Ming Goh: 2 posts Gonzalo Servat: 1 post

People

Translate

site design / logo © 2022 Grokbase