I used to have the following code:
ssh_this_node = node[‘keys’][‘ssh’][‘host_rsa_public’]
Now i ran foodcritic and it says:
FC039: Node method cannot be accessed with key: cookbooks/ssh/recipes/default.rb:11
Following the example in http://www.foodcritic.io/#FC039, i changed the code to:
ssh_this_node = node.keys[‘ssh’][‘host_rsa_public’]
However, i get the error:
TypeError
no implicit conversion of String into Integer
Cookbook Trace:
/var/chef/cache/cookbooks/ssh/recipes/default.rb:14:in []' /var/chef/cache/cookbooks/ssh/recipes/default.rb:14:in
from_file’
Relevant File Content:
/var/chef/cache/cookbooks/ssh/recipes/default.rb:
14>> ssh_this_node = node.keys[‘ssh’][‘host_rsa_public’]
15: Chef::Log.debug “keys_ssh_host_rsa_public” + ssh_this_node