erb - Comparing two string variables in puppet template -
i'm trying write if statement compares 2 variables in puppet erb template:
<% @array_of_ip_addresses.each_with_index |ip, idx| -%> <% if @ip == @ipaddress_eth0 -%> <%= "doing #{idx}" -%> <% end -%> <% end -%> i cannot figure out why, condition on if statement keeps returning false (needless confirmed there should match).
what dumb thing missing?
ip block scope variable , not variable instantiated invoking code (in case, puppet's template function), should not specify class instance variable @. when remove , specify block scope variable ip, template like:
<% @array_of_ip_addresses.each_with_index |ip, idx| -%> <% if ip == @ipaddress_eth0 -%> <%= "doing #{idx}" -%> <% end -%> <% end -%> using class instance variable @ip result in resolution of nil, false nil != @ipaddress_eth0 unless facter failed resolve value eth0 ipaddress, quite uncommon (but still possible).
Comments
Post a Comment