apache2 icon indicating copy to clipboard operation
apache2 copied to clipboard

Filebeat is overriding apache2 default_log_dir helper

Open KindAchmed opened this issue 6 years ago • 2 comments

Brief Description

The default_log_dir helper in the apache2 cookbook version 7.1.0 is overwritten by the same helper function in the filebeat cookbook, which has a different method signature.

Do we maybe need to rename the helper in order to fix this issue?

Cookbook version

apache2: 7.1.0 filebeat: 2.1.2

Chef-client version

14.13.11

Platform Details

CentOS 7.5.1804

Scenario

Create a apache config

Steps to Reproduce

Kitchen converge with apache2 and filebeat

Expected Result

Create apache site

Actual Result

ArgumentError

wrong number of arguments (given 0, expected 1)

   Cookbook Trace:
   ---------------
   /tmp/kitchen/cache/cookbooks/filebeat/libraries/helper.rb:66:in `default_log_dir'
   /tmp/kitchen/cache/cookbooks/apache2/resources/default_site.rb:56:in `block (2 levels) in class_from_file'
   /tmp/kitchen/cache/cookbooks/apache2/resources/default_site.rb:44:in `block in class_from_file'

   Resource Declaration:
   ---------------------
   # In /tmp/kitchen/cache/cookbooks/sxxxxxx-bxx/recipes/apache.rb

    80:   apache2_default_site 'bxx' do
    81:     default_site_name 'bxx'
    82:     template_source 'host.conf.erb'
    83:     action :enable
    84:   end
    85: end

   Compiled Resource:
   ------------------
   # Declared in /tmp/kitchen/cache/cookbooks/sxxxxxx-bxx/recipes/apache.rb:80:in `from_file'

   apache2_default_site("bxx") do
     action [:enable]
     default_guard_interpreter :default
     declared_type :apache2_default_site
     cookbook_name "sxxxxxx-bxx"
     recipe_name "apache"
     default_site_name "bxx"
     template_source "host.conf.erb"
     apache_root_group "root"
     log_dir "/var/log/httpd"
   end

   System Info:
   ------------
   chef_version=14.11.21
   platform=centos
   platform_version=7.5.1804
   ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
   program_name=/opt/chef/bin/chef-solo
   executable=/opt/chef/bin/chef-solo

 * ruby_block[purge_prospectors_dir] action run (skipped due to only_if)

Running handlers: [2019-06-03T10:26:21+00:00] ERROR: Running exception handlers Running handlers complete [2019-06-03T10:26:21+00:00] ERROR: Exception handlers complete Chef Client failed. 12 resources updated in 21 seconds [2019-06-03T10:26:21+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out [2019-06-03T10:26:21+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2019-06-03T10:26:21+00:00] FATAL: ArgumentError: apache2_default_site[bxx] (sxxxxxx-bxx::apache

KindAchmed avatar Jul 19 '19 12:07 KindAchmed

This is a combination of doing libraries wrong (cc @tas50) and someone else copying our pattern without thinking.

If you can open an issue there to track this on both repos that would be great. Until we can get some guidance from Chef on how to do this, this is going to stay open.

Thanks Dan

damacus avatar Aug 25 '19 17:08 damacus

There is a similar issue with the memcached cookbook, it overrides the lock_dir helper, leading to apache2.conf containing "/var/lock" as lock_dir instead of "/var/lock/apache2".

jharbott avatar Mar 24 '20 09:03 jharbott