Search code examples
rubyvagrantchef-infraerbchef-solo

undefined method `poise_service_user' for cookbook: newrelic-infra


I am trying to setup newrelic infra chef cookbook for my project using chef solo. Following the guidelines listed in their docs: Configure New Relic Infrastructure using Chef

Goal:

Start the newrelic-infra service in the ubuntu box.

The steps mentioned are the following:

The New Relic cookbook is available from the public Chef Supermarket . To install and configure New Relic Infrastructure using Chef:

  1. Add the newrelic-infra dependency in your own Chef metadata.rb or Berksfile - Done

metadata.rb

depends 'newrelic-infra'
  1. Set the New Relic license key attribute. For example, add the following to your 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 the default New Relic recipe by using include_recipe ‘newrelic-infra::default' or by adding the recipe to your run list. - Done

Dependencies for new relic infra cookbook are poise-service and poise-archive v1.5.0 : so I have added all three cookbooks to the runlist. The vagrant file looks like this:

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

finally when I run newrelic-infra service using vagrant up I see the following error:

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:`

I spent hours looking into the cookbook source in GitHub but no luck yet, Anyone have idea or troubleshooting tips? I am pretty new to Chef or ruby so I would really appreciate any suggestions.

Thanks!

Helpful links:


Solution

  • I raised an issue in GitHub and looks like the poise-service cookbook is no longer maintained and the owner archived it few hours ago.