gpt4 book ai didi

ruby - Recipe : newrelic-infra 的未定义方法 `poise_service_user'

转载 作者:太空宇宙 更新时间:2023-11-03 16:12:40 29 4
gpt4 key购买 nike

我正在尝试设置 newrelic infra chef我使用 Chef Solo 的项目的 Recipe 。遵循其文档中列出的指南:Configure New Relic Infrastructure using Chef

目标:

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

提到的步骤如下:

New Relic Recipe 可从公共(public) Chef Supermarket 获得。使用 Chef 安装和配置 New Relic Infrastructure:

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

元数据.rb

depends 'newrelic-infra'
  1. 设置 New Relic 许可证 key 属性。例如,将以下内容添加到您的 recipes/default.rb:- Done

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 配方。 - 完成

new relic infra cookbook 的依赖项是 poise-service 和 poise-archive v1.5.0:所以我已将所有三本 Recipe 添加到列表中。 vagrant 文件如下所示:

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

最后,当我使用 vagrant up 运行 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 中的 Recipe 源代码,但还没有成功,有人有想法或故障排除技巧吗?我对 Chef 或 ruby​​ 还很陌生,所以我非常感谢任何建议。

谢谢!

有用的链接:

最佳答案

我在 GitHub 中提出了一个问题,看起来 poise-service cookbook 不再维护,所有者在几个小时前将其存档。

关于ruby - Recipe : newrelic-infra 的未定义方法 `poise_service_user',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57699274/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com