I've written the following in my templates, but when I run puppet client it keeps complaining of "Failed to parse template Detail: Could not find value for 'mas". My problem is that ipa variable is empty of does not exist when doing this check, so why is mas.empty getting executed?

<% if !ipa.empty? %>
    <% if !mas.empty? %>address=<%= address %>
<% end -%>
<% end -%>

What tips are there for debugging this?


1 Answer 1


I would just do:

<% if @ipa %>
  <% if @mas %>address=<%= @address %>
  <% end -%>
<% end -%>

The @ipa will be false if it isn't set (is empty), so the following code would not be executed.

I use this code a lot in my templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.