0

I'm using the latest apache2 cookbook (v5.0.0) in a wrapper file. my wrapper recipe is just including the apache2 recipe so I'm not sure what is causing this error in my kitchen test when I try to setup the test suite???

Wrapper Recipe

   include_recipe 'apache2'

kitchen setup Error

   ...
   Synchronizing Cookbooks:
     - my-webapp (2.0.0)
     - apache2 (5.0.0)
   Installing Cookbook Gems:
   Compiling Cookbooks...

   ================================================================================
   Recipe Compile Error in /tmp/kitchen/cache/cookbooks/apache2/attributes/default.rb
   ================================================================================

   TypeError
   ---------
   no implicit conversion of String into Integer

   Cookbook Trace:
   ---------------
     /tmp/kitchen/cache/cookbooks/apache2/attributes/default.rb:90:in `from_file'

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cache/cookbooks/apache2/attributes/default.rb:

    83:    default['apache']['pid_file']    = '/var/run/httpd2.pid'
    84:    default['apache']['lib_dir']     = node['kernel']['machine'] =~ /^i[36]86$/ ? '/usr/lib/apache2' : '/usr/lib64/apache2'
    85:    default['apache']['libexec_dir'] = node['apache']['lib_dir']
    86:  when 'debian'
    87:    default['apache']['package']     = 'apache2'
    88:    default['apache']['perl_pkg']    = 'perl'
    89:    default['apache']['devel_package'] =
    90>>     if node['apache']['mpm'] == 'prefork'
    91:        'apache2-prefork-dev'
    92:      else
    93:        'apache2-dev'
    94:      end
    95:    default['apache']['apachectl']   = '/usr/sbin/apache2ctl'
    96:    default['apache']['dir']         = '/etc/apache2'
    97:    default['apache']['log_dir']     = '/var/log/apache2'
    98:    default['apache']['error_log']   = 'error.log'
    99:    default['apache']['access_log']  = 'access.log'

   System Info:
   ------------
   chef_version=13.0.118
   platform=ubuntu
   platform_version=16.04
   ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
   program_name=chef-client worker: ppid=3084;start=16:38:30;
   executable=/opt/chef/bin/chef-client
veilig
  • 5,085
  • 10
  • 48
  • 86
  • This error means that one of the intended `Hash`es e.g. either `node` or `node['apache']` is actually an `Array` (or maybe a `Fixnum`) instead of a `Hash` – engineersmnky Jul 18 '17 at 16:57

1 Answers1

2

As engineersmnky mentioned, check the override and normal level attributes (or defaults coming from roles/envs). The sneaky one is usually normal, check via knife node edit. The likely case is node['apache'] being set to an Array.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • this is in test kitchen, so its no roles or env causing an issue and I've commented out every line in my attributes/default.rb. Still not sure whats causing it? – veilig Jul 18 '17 at 20:03
  • Gist your attributes file. – coderanger Jul 18 '17 at 22:44
  • I think I see the problem. in my .kitchen.yml file I set an apache attribute so that must be affecting it. I don't get that error if comment thost .kitchen.yml lines out, I'll find another way to test that – veilig Jul 19 '17 at 14:27