2016-08-26 7 views
0

私は残念ながら、私はレシピユーザ管理クックブックエラー

ERROR: undefined method each for nil:NilClass

を実行すると、エラーが第二から発信しているようで、このエラーを取得しておくgithubのからhttps://github.com/FFIN/user_management

を、次の料理を使用していますこのコードブロックからの行。それぞれが方法として認識されていないようです。なぜどんなアイデア?私のデータバッグは作者と同じですので、それは問題ではないでしょうか。

sudoer_users = Array.new() node['user_management']['users'].each do |user| user_management user['username'] do comment user['comment'] unless user['comment'].nil? create_home user['create_home'] shell user['shell'] unless user['shell'].nil? password user['password'] unless user['password'].nil? uid user['uid'] unless user['uid'].nil? gid user['gid'] unless user['gid'].nil? ssh_keys user['ssh_keys'] unless user['ssh_keys'].nil? delete_home_when_remove user['delete_home_when_remove'] unless user['delete_home_when_remove'].nil? if user['action'] == 'remove' then action :remove else action :create end end

EDIT

私は先に行って、私のデータ袋default['user_management']['users'] = chefusersを指すように、私の属性で['node']['user_management']['users']を定義しました。

私も

node['user_management']['users'].each_line do |user|

node['user_management']['users'].each do |user|を変更したが、今、私は

You must supply a name when declaring a user_management resourceエラーを取得しています。

コードブロックの3行目でエラーが発生しているようです。

答えて

0

おそらく問題はnode['user_management']['users']が設定されていないことです。あなたの役割やその属性を設定していると思っていることが何であれ実際に何かをしていることを再度確認してください。

+0

ありがとうございました。私はあなたの提案を説明するために質問を編集しました。 – jebjeb

関連する問題