[chef] Chefspec filter recipe eval, or stub include_recipe?


Chronological Thread 
  • From: Eric Wolfe < >
  • To:
  • Subject: [chef] Chefspec filter recipe eval, or stub include_recipe?
  • Date: Wed, 30 Apr 2014 11:24:36 -0400

So I am trying to Chefspec some branching logic in a baseline cookbook.  The recipe chef-client::delete_validation is throwing up an exception on line 28 where it checks for the existence of Chef::Config[:client_key] (https://github.com/opscode-cookbooks/chef-client/blob/master/recipes/delete_validation.rb#L28).  I get several errors like so:

  14) mu-baseline::default On Centos 6.4 as a VMWare guest does include recipe mu-baseline::zenoss_register
     Failure/Error: end.converge(described_recipe)
     TypeError:
       no implicit conversion of nil into String
     # /tmp/d20140430-13074-1bq5osr/cookbooks/chef-client/recipes/delete_validation.rb:28:in `exists?'
     # /tmp/d20140430-13074-1bq5osr/cookbooks/chef-client/recipes/delete_validation.rb:28:in `block (2 levels) in from_file'
     # ./spec/default_spec.rb:43:in `block (3 levels) in <top (required)>'
     # ./spec/default_spec.rb:48:in `block (4 levels) in <top (required)>'

If I just remove `include_recipe 'chef-client::delete_validation'` those test(s) pass.  Is there a way I can filter that recipe's evaluation, or something I can stub, to get past this exception?



Archive powered by MHonArc 2.6.16.

§