Reputation: 23237
I'm getting an error message when chef_client is running recipes. As far, I've been able to figure out it's telling me that:
undefined method `platform_version'
I've tried to perform the recipes wit a centos/7, version: 1611.01
and 1703.01
. Here you can see the complete trace:
==> default: ================================================================================
==> default: Recipe Compile Error in /var/chef/cache/cookbooks/living-development/recipes/default.rb
==> default: ================================================================================
==> default:
==> default: NoMethodError
==> default: -------------
==> default: undefined method `platform_version' for #<Chef::Node::Attribute:0x00000004f4f480>
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default: /var/chef/cache/cookbooks/mongodb3/recipes/package_repo.rb:26:in `from_file'
==> default: /var/chef/cache/cookbooks/mongodb3/recipes/default.rb:20:in `from_file'
==> default: /var/chef/cache/cookbooks/living-development/recipes/mongodb.rb:9:in `from_file'
==> default: /var/chef/cache/cookbooks/living-development/recipes/default.rb:11:in `from_file'
==> default:
==> default: Relevant File Content:
==> default: ----------------------
==> default: /var/chef/cache/cookbooks/mongodb3/recipes/package_repo.rb:
==> default:
==> default: 19:
==> default: 20: pkg_major_version = node['mongodb3']['version'].to_f # eg. 3.0, 3.2
==> default: 21:
==> default: 22: # Setup default package version attribute to install
==> default: 23: pkg_version = node['mongodb3']['version']
==> default: 24: case node['platform_family']
==> default: 25: when 'rhel', 'fedora'
==> default: 26>> pkg_version = "#{node['mongodb3']['version']}-1.el#{node.platform_version.to_i}" # ~FC019
==> default: 27: if node['platform'] == 'amazon'
==> default: 28: pkg_version = "#{node['mongodb3']['version']}-1.amzn1" # ~FC019
==> default: 29: end
==> default: 30: end
==> default: 31:
==> default: 32: # Setup default package repo url attribute for each platform family or platform
==> default: 33: case node['platform']
==> default: 34: when 'redhat', 'oracle','centos', 'fedora' # ~FC024
==> default: 35: pkg_repo = "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/#{pkg_major_version}/#{node['kernel']['machine'] =~ /x86_64/ ? 'x86_64' : 'i686'}"
==> default:
==> default: System Info:
==> default: ------------
==> default: chef_version=13.0.118
==> default: platform=centos
==> default: platform_version=7.3.1611
==> default: ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
==> default: program_name=chef-client worker: ppid=12132;start=09:52:48;
==> default: executable=/opt/chef/bin/chef-client
==> default:
==> default: Running handlers:
==> default: [2017-04-24T09:53:06+00:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default: [2017-04-24T09:53:06+00:00] ERROR: Exception handlers complete
==> default: Chef Client failed. 0 resources updated in 18 seconds
==> default: [2017-04-24T09:53:06+00:00] INFO: Sending resource update report (run-id: 30b10346-fc52-4aac-86cd-f76ccd8e0576)
==> default: [2017-04-24T09:53:07+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2017-04-24T09:53:07+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> default: [2017-04-24T09:53:07+00:00] ERROR: undefined method `platform_version' for #<Chef::Node::Attribute:0x00000004f4f480>
==> default: [2017-04-24T09:53:07+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Any ideas?
WORK AROUND:
config.vm.provision "chef_client" do |chef|
...
chef.version = '12.19.36'
end
Upvotes: 1
Views: 4425
Reputation: 54211
We removed the method syntax for node attributes in Chef 13. The code needs to be updated to node["platform_version"]
.
Upvotes: 4