在此行,我得到了错误
node.default['aem_dispatcher_cookbook']['ip_address'] = nodes.first('ipaddress').to_i
收到此错误
Recipe Compile Error in /root/.chef/local-mode-cache/cache/cookbooks/aem_dispatcher_cookbook/recipes/default.rb
================================================================================
TypeError --------- no implicit conversion of String into Integer
如果删除.to_i
,也会得到相同的结果。
数据的一层可能具有数组,但是您希望将其作为哈希值。
查看示例:
hash = { foo: [{ bar: "baz" }]}
=> hash[:foo][:bar]
TypeError: no implicit conversion of Symbol into Integer
hash = { foo: [{ bar: "baz" }]}
=> hash[:foo].first[:bar]
"baz"