菜谱的未定义方法“ poise_service_user”:newrelic-infra

时间:2019-08-28 19:56:43

标签: ruby vagrant chef erb chef-solo

我正在尝试使用厨师独奏为我的项目设置newrelic infra chef食谱。遵循其文档中列出的准则:Configure New Relic Infrastructure using Chef

目标:

在ubuntu框中启动newrelic-infra服务。

提到的步骤如下:

New Relic食谱可从公共Chef Supermarket获得。 要使用Chef安装和配置New Relic Infrastructure:

  1. 在您自己的Chef metadata.rb或Berksfile中添加newrelic-infra依赖项-完成

metadata.rb

depends 'newrelic-infra'
  1. 设置新的Relic许可证密钥属性。例如,将以下内容添加到您的食谱/default.rb中:-完成

newrelic-infra / attributes / default.rb

# New Relic infrastructure agent configuration options
default['newrelic_infra']['config'].tap do |conf|
  # Account license key
  conf['license_key'] = 'added my license key here'
  1. 通过使用include_recipe'newrelic-infra :: default'或通过将配方添加到运行列表中,来包括默认的New Relic配方。 -完成

新的文物基础食谱的依赖关系为poise-service和poise-archive v1.5.0: 因此,我已将所有三本食谱添加到运行列表中。流浪者文件看起来像这样:

Vagrant.configure('2') do |config|
config.vm.box = 'bento/ubuntu-18.04'
...
...
config.vm.provision 'shell', inline: <<~SHELL
wget -q -O /tmp/chefdk.deb  https://packages.chef.io/files/stable/chefdk/3.2.30/ubuntu/18.04/chefdk_3.2.30-1_amd64.deb
apt-get -q install -y /tmp/chefdk.deb
mkdir /tmp/cookbooks
  ...
rsync -av  /vagrant/infrastructure-agent-chef/ /tmp/cookbooks/newrelic-infra/
git clone https://github.com/poise/poise-service.git /tmp/cookbooks/poise-service
cd /tmp/cookbooks/poise-service && git checkout v1.5.0
git clone https://github.com/poise/poise-archive.git /tmp/cookbooks/poise-archive
cd /tmp/cookbooks/poise-archive && git checkout v1.5.0
echo '{"run_list":["recipe[newrelic-infra]", "recipe[poise-service]", "recipe[poise-archive]"]}' > /tmp/runlist.json
chef-solo -j /tmp/runlist.json --recipe-url /tmp/random.tar.gz 
SHELL
end

最后,当我使用流浪汉运行newrelic-infra服务时,看到以下错误:

default: Starting Chef Client, version 14.4.56 default: resolving cookbooks for run list: ["newrelic-infra", "poise-service", "poise-archive"] default: Synchronizing Cookbooks: default: - newrelic-infra (0.11.0) default: - poise-service (0.0.0) default: default: - poise-archive (0.0.0) default: Installing Cookbook Gems: default: Compiling Cookbooks... default: default: ================================================================================ default: Recipe Compile Error in /etc/chef/local-mode-cache/cache/cookbooks/newrelic-infra/recipes/default.rb default: ================================================================================ default: default: default: NoMethodError default: ------------- default: undefined method poise_service_user' for cookbook: newrelic-infra, recipe: agent_linux :Chef::Recipe
default:
default:
default: Cookbook Trace:
default: ---------------
default: /etc/chef/local-mode-cache/cache/cookbooks/newrelic-infra/recipes/agent_linux.rb:17:in from_file' default: default: /etc/chef/local-mode-cache/cache/cookbooks/newrelic-infra/recipes/default.rb:11:in from_file'
default:
default: Relevant File Content:
default: ----------------------
default: /etc/chef/local-mode-cache/cache/cookbooks/newrelic-infra/recipes/agent_linux.rb:
default:
default: 10: #
default: 11: node.default['newrelic_infra']['agent']['flags']['config'] = ::File.join(
default: 12: node['newrelic_infra']['agent']['directory']['path'],
default: 13: node['newrelic_infra']['agent']['config']['file']
default: 14: )
default: 15:
default: 16: # Setup a service account
default: 17>> poise_service_user node['newrelic_infra']['user']['name'] do
default: 18: group node['newrelic_infra']['group']['name']
default: 19: only_if { node['newrelic_infra']['features']['manage_service_account'] }
default: 20: end
default: 21:
default: 22: # Based on the Ohai attribute platform_family either an APT or YUM repository
default: 23: # will be created. The respective Chef resources are built using metaprogramming,
default: 24: # so that the configuration can be extended via attributes without having to
default: 25: # release a new version of the cookbook. Attributes that cannot be passed to the resource
default: 26: # are logged out as warnings in order to prevent potential failes from typos,
default:
default: System Info:
default: ------------
default: chef_version=14.4.56
default: platform=ubuntu
default: platform_version=18.04
default: ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
default: program_name=/usr/bin/chef-solo
default: executable=/opt/chefdk/bin/chef-solo
default:
default:
default: Running handlers:`

我花了数小时在GitHub上搜索菜谱源,但还没有走运,有人有想法或故障排除技巧吗?我是Chef还是ruby的新手,所以我非常感谢任何建议。

谢谢!

有用的链接:

1 个答案:

答案 0 :(得分:1)

我在GitHub上提出了一个问题,似乎不再维护poise-service Cookbook,而所有者在几个小时前将其归档。