sous-chefs / nginx

Development repository for the nginx cookbook
https://supermarket.chef.io/cookbooks/nginx
Apache License 2.0
551 stars 810 forks source link

NoMethodError - undefined method `pidfile_location' for Chef::Resource::Directory #603

Closed shireeshj closed 2 years ago

shireeshj commented 2 years ago

:speaking_head: Foreword

I am using chef-infra-client in local mode to install nginx on a newly launched ec2 instance. However, I get the error

NoMethodError - undefined method `pidfile_location' for Chef::Resource::Directory

I call nginx cookbook via a wrapper cookbook called _nginx. The relevant contents of this wrapper are

node.override['nginx']['repo_source']    = 'nginx'
node.override['nginx']['install_method'] = 'package'

nginx_install 'nginx' do
  source 'repo'
end

nginx_config 'nginx.conf' do
  worker_processes      node['nginx']['worker_processes']
  worker_connections    node['nginx']['worker_connections']
  sendfile              node['nginx']['sendfile']
  tcp_nopush            node['nginx']['tcp_nopush']
  tcp_nodelay           node['nginx']['tcp_nodelay']
  keepalive_timeout     node['nginx']['keepalive_timeout']
  default_site_enabled  node['nginx']['default_site_enabled']
  types_hash_max_size   node['nginx']['types_hash_max_size']
end

nginx_service 'nginx' do
  action :enable
  delayed_action :start
end

include_recipe 'nginx'

:ghost: Brief Description

While installing nginx using cookbook version 12.0.12, I am getting this error

FATAL: NoMethodError: directory[pid file directory] (nginx::commons_dir line 37) had an error: NoMethodError: undefined method `pidfile_location' for Chef::Resource::Directory

:pancakes: Cookbook version

12.0.12

:woman_cook: Chef-Infra Version

17.10.0

:tophat: Platform details

chef_version=17.10.0 platform=ubuntu platform_version=18.04 ruby=ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux] Cloud provider=aws

:police_car: Expected behavior

pidfile_location is not defined anywhere. I am a little clueless how this gets evaluated.

shireeshj commented 2 years ago

My bad.

My local copy of the nginx cookbook was all mixed up. I realised it when I saw that my local copy had the recipes folder where as version 12.0.12 should not have this folder. I guess berks update && berks vendor does not completely replace the older version with the newer version.