interpolation of puppet fact, with quotes, into erb template

87 views
Skip to first unread message

John

unread,
Aug 18, 2017, 8:02:59 PM8/18/17
to Puppet Users
 i have this bit of code here

   <% @microservices.sort.each do |service,val| -%>
      upstream <%= service %> {
        server <% val['endpoint']['{domain_suffix}'] = "@domain_suffix" -%> resolve;
      }
  <% end -%>

i'm trying to do a string replacement of the @domain_suffix puppet fact, however ruby requires quotes around this value. however, with the quotes, that value cannot be rendered in the template.

i'm sure ruby can do this another way however i don't know it very well.

James Perry

unread,
Aug 19, 2017, 8:08:40 PM8/19/17
to Puppet Users
Did you try assigning the @domain_suffix to a local variable in the embedded Ruby and see if that would permit it to do as you want? 
Reply all
Reply to author
Forward
0 new messages