木偶,hiera和erb – erb不会识别数组

我有一个非常恼人的错误,我急于解决。 我有一个木偶模块,在yaml文件(hiera)中保存某些东西,以便人们可以快速编辑该部分。

该结构是嵌套的。

这样的模板

<%= @platforms[@platform]['users_allowed'][@host].class %> 

呈现给:

 Array 

但是当我尝试迭代它时:

 <% @platforms[@platform]['users_allowed'][@host].each do | pubkey | %> <%= pubkey %> <% end %> 

木偶说:

 Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template somemodule/templates/authorized_keys.erb: Filepath: /etc/puppet/modules/somemodule/templates/authorized_keys.erb Line: 1 Detail: undefined method `each' for nil:NilClass 

它是如何突然成为零,我如何在这里迭代?

恐怕我被困在这里,甚至不知道在哪个方向上我应该寻找解决scheme。

没有hiera或没有嵌套结构的重写模块在这种情况下不是一个选项。

我testing过我的傀儡,正确的语法是:

 <% @platforms[@platform]['users_allowed'][@host].each do | pubkey | -%> <%= pubkey %> <% end -%> 

我希望我帮助。