Chef infra 厨师长:未定义的方法`平台版';

Chef infra 厨师长:未定义的方法`平台版';,chef-infra,Chef Infra,当chef_客户端运行菜谱时,我收到一条错误消息。到目前为止,我已经发现它告诉我: 未定义的方法“平台版本” 我曾尝试使用centos/7版本执行这些配方:1611.01和1703.01。在这里您可以看到完整的跟踪: ==> default: ================================================================================ ==> default: Recipe Compile Error in /var

当chef_客户端运行菜谱时,我收到一条错误消息。到目前为止,我已经发现它告诉我:

未定义的方法“平台版本”

我曾尝试使用centos/7版本执行这些配方:
1611.01
1703.01
。在这里您可以看到完整的跟踪:

==> 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.

我们删除了Chef 13中节点属性的方法语法。代码需要更新到
节点[“平台版本”]

我们删除了Chef 13中节点属性的方法语法。代码需要更新到
节点[“platform_version”]

是否有解决方法?当然,返回到Chef 12。厨师长13是非常新的,并不是所有的社区食谱都有更新。我没有指定任何特别的厨师版本。我猜它是想得到最新的稳定版本。有什么方法可以指定它吗?在厨房中,将
require\u chef\u omnibus:12
添加到provisioner部分。对于生产,这取决于您如何更新内容。我使用的是vagrant:
config.vm.provision“chef_client”do | chef |……
现在有什么解决方法吗?当然,返回到chef 12。厨师长13是非常新的,并不是所有的社区食谱都有更新。我没有指定任何特别的厨师版本。我猜它是想得到最新的稳定版本。有什么方法可以指定它吗?在厨房中,将
require\u chef\u omnibus:12
添加到provisioner部分。我使用的是vagrant:
config.vm.provision“chef_client”do | chef |……
config.vm.provision "chef_client" do |chef|
    ...
    chef.version = '12.19.36'
end