Recipe Compile Error in /var/chef/cache/cookbooks/ambari/recipes/blueprints.rb
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/ambari/recipes/blueprints.rb:54:in `block in from_file'
/var/chef/cache/cookbooks/ambari/recipes/blueprints.rb:53:in `from_file'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat /monkeypatches/chef/run_context.rb:347:in `load_recipe'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/ambari/recipes/blueprints.rb:
47: end
48: end
49:
50: basic_auth_parameters = "--user #{node['ambari']['admin_user']}:#{node['ambari']['admin_password']}"
51:
52:
53: file '/tmp/blueprint.json' do
54>> content Chef::JSONCompat.to_json_pretty(node['ambari']['blueprints']['blueprint_json'].to_hash)
55: end
56:
57: file '/tmp/cluster.json' do
58: content Chef::JSONCompat.to_json_pretty(node['ambari']['blueprints']['cluster_json'].to_hash)
59: end
60:
61: execute 'Init Blueprints' do
62: command "curl #{basic_auth_parameters} -H 'X-Requested-By:ambari-cookbook' --data @/tmp/blueprint.json #{ambari_server_fqdn}:8080/api/v1/blueprints/#{node['ambari']['blueprints']['blueprint_name']}"
63: end
Platform:
---------
x86_64-linux
Running handlers:
[2016-11-27T13:15:03-06:00] ERROR: Running exception handlers
Running handlers complete
[2016-11-27T13:15:03-06:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 09 seconds
[2016-11-27T13:15:03-06:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-11-27T13:15:03-06:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-11-27T13:15:03-06:00] ERROR: undefined method `[]' for nil:NilClass
[2016-11-27T13:15:03-06:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
答案 0 :(得分:2)
未设置node属性中的一个中间键。将缺省值放在cookbook的属性文件中,或者确保设置它。