[英]How do I get Puppet Master to run a manifest against a Puppet Agent node when there are different errors?
[英]Puppet - How can I compare value of manifest variable against index from a loop in Template
嗨,我正在嘗試比較清單文件中的一個值和人偶模板中的另一個值,如何對此進行比較,我嘗試了以下方法,並將其不包含在If語句中。
puppet.pp
$i = 0
$values = [val1, val2, otherval]
$var2 = template("/home/cluster/temp.erb")
notice ("This Current Location ${var2}")
temp.erb
<% @values.each_with_index do |this_server, idx| -%>
<% if idx==@i -%> #This is where I want to check
If True!!!!
<% end -%>
Out OF IFFF
<% end -%>
我該如何比較清單變量與模板循環中的索引的值。 提前致謝。
將值轉換為整數后,我發現了問題,一切正常。
以下內容已修改。
<% if idx==@i.to_i -%>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.