2014-10-31 104 views
6

我嘗試了一些木偶模板中添加參數如下算術運算模板內

"https://localhost:<%= 9443 + @offset %>/service/" 

這給了我下面的錯誤。

詳情:字符串不能被強迫Fixnum對象

「偏移」是一個數值。是否有可能在傀儡中進行這種算術運算?

回答

7

puppet中的所有東西都被解析爲一個字符串。給出如下嘗試:

"https://localhost:<%= 9443 + @offset.to_i %>/service/" 

"https://localhost:<%= 9443 + Integer(@offset) %>/service/" 

希望這有助於。

+0

謝謝!這兩個建議都很好。 – Anuruddha 2014-10-31 18:54:41