Search code examples
chef-infracookbook

Chef zero can't find cookbook during kitchen test run


This is driving me crazy, I just started using chef on a fresh image (win10), and for some reason when using kitchen to test a cookbook it can not find the cookbook? tried the response to this question: Chef solo can't find cookbook during kitchen test run and it throws an error saying "Your Berksfile contains multiple entries named 'printserver'. Please remove duplicate dependencies, or put them in different groups.] on default-win-2012r2-standard-amd64-nocm" Kitchen version 1.17.0

----> Converging <default-win-2012r2-standard-amd64-nocm>...
   Preparing files for transfer
   Preparing dna.json
   Resolving cookbook dependencies with Berkshelf 6.3.1...
   Removing non-cookbook files before transfer
   Preparing validation.pem
   Preparing client.rb
 -----> Chef Omnibus installation detected (install only if missing)
   Transferring files to <default-win-2012r2-standard-amd64-nocm>
   Starting Chef Client, version 13.4.24
   resolving cookbooks for run list: ["printserver"]

   ================================================================================
   Error Resolving Cookbooks for Run List:
   ================================================================================

   Missing Cookbooks:
   ------------------
   No such cookbook: printserver

   Expanded Run List:
   ------------------
   * printserver

   System Info:
   ------------
   chef_version=13.4.24
   platform=windows
   platform_version=6.3.9600
   ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32]
   program_name=C:/opscode/chef/bin/chef-client
   executable=C:/opscode/chef/bin/chef-client


   Running handlers:
   [2017-09-20T13:38:53-07:00] ERROR: Running exception handlers
   Running handlers complete
   [2017-09-20T13:38:53-07:00] ERROR: Exception handlers complete
   Chef Client failed. 0 resources updated in 03 seconds
   [2017-09-20T13:38:53-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
   [2017-09-20T13:38:53-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
   [2017-09-20T13:38:53-07:00] FATAL: Net::HTTPServerException: 412 "Precondition Failed"
 ------Exception-------
Class: Kitchen::ActionFailed
Message: 1 actions failed.
 Converge failed on instance <default-win-2012r2-standard-amd64-nocm>.  
Please see .kitchen/logs/default-win-2012r2-standard-amd64-nocm.log for more details
 Please see .kitchen/logs/kitchen.log for more details
Also try running `kitchen diagnose --all` for configuration

Solution

  • What I ended up doing in order:

    • Took cookbook from work laptop to home PC and tested, worked as expected.
    • Uninstalled chef, vagrant and virtual box and reinstalled with same versions on home PC, still same problem.
    • At this point was annoyed with how much time I had spent trying to fix this so I re-imaged the laptop and re installed everything again (newest versions) and it now works correctly as it should.

    What went wrong in the first place? I have no clue.

    On a side note if anyone has any good references for creating a windows 2012 print server with chef, would be very helpful.