在puppet中定义可选属性的正确方法是什么? 现在我正在这样做:
define($command = "none") { }
然后像(在模板中):
<% if command != "none" %> do something with <%= command %> <% end %>
有没有更适当的方法来定义可选属性? 更类似于零或空而不是“无”?
你可以使用undef 。 在定义中明确地使用它,如:
define($command = undef) { }
而在模板中,undefvariables不会得到实例variables的定义,所以它们将是零:
<% if @command %> do something with <%= @command %> <% end %>