Using Test Kitchen with Berkshelf in an offline/air gapped environment

Hi, I am pretty new to Chef and I work in an environment that is not connected to the Internet. I am wondering if anyone else has had success in the process with using berkshelf and importing community cookbooks.

I am using Hyper-V as my provider and have gotten kitchen to install the client from my local webserver and even run stand alone custom recipes.

However, when I add community recipes and update my berksfile to look at my local system for the cookbooks, my converge hangs at “Compiling Cookbooks…”

In the debug log I see:

[WinRM] retrying receive request after timeout

Looking to see if anyone else has tried and succeeded at a similar process.

@gator do you have a chefignore file that excludes .kitchen* (like this)? Otherwise, Berkshelf will try to package up the differencing disk and vm config files (and usually errors around there since Hyper-V has handles open to them).

That doesn’t address the air-gapped scenario, but may be one of the possible problems you are hitting.

Do you have an internal supermarket or chef server with those cookbooks available? If you have them locally, you can point the berksfile to their local file system path as well.

Just a note that when you see repeating debug log entries of [WinRM] retrying receive request after timeout that means that a remote command being run from the kitchen host to the test instance was successfully invoked but its output is taking a long time to come back. WinRM is polling the instance for output and the command is either taking a long time or is in a hung state on the instance.

It sounds like its having problems talking to chef-zero. It talks via http but its a local call usually on port 8889.

What I would try just to rule out test-kitchen and winrm is to RDP on to the instance, cd to $env:temp\kitchen and then run:

chef-client -z -j dna.json

This runs chef-client in chef-zero mode and uses the dna.json node file kitchen created. See if this produces the same result or gets you further.

Matt, thanks for that info on the WinRM bit.

So, I have done as you said and ran the command from the node and it seems like you may have eliminated kitchen as being the issue.

I get similar output where it resolves the cookbook list -> synchronizing cookbooks -> Install Cookbook gems: Compiling Cookbooks…
c:/opscode…/dl.so: warning: already initialized constant DL::RUBY_FREE
C:/opscode/…/pageant.rb:16: warning: previous definition of RUBY_FREE was here
DL is deprecated, please use Fiddle

and it seems to hang there… which seems lineup with what I see from the kitchen converge side as well.

Steven, I do have the .kitchen* in my chefignore file along with many other entries.

Putting a local path to the cookbooks in my berksfile is what I am currently doing. It got me past the point of resolving the dependencies with berkshelf in the converge run.

my berksfile looks as follow:

# source 'https://supermarket.chef.io
cookbook ‘sql_server’, path: '…/sql_server’
cookbook ‘windows’, path: '…/windows’
cookbook ‘chef_handler’, path: '…/chef_handler’
metadata

@Matt_Wrock @Steven_Murawski - Let me apologize for wasting your time.

@Matt_Wrock, you led me down the right path with the chef-client run from within the node. Once I did that and enabled debug logging I could see that it was hanging up on one of my attribute files. After following that I found that I had a syntax error in a method defined in that attribute file that was running an infinite loop due to some errant regex that would never have been matched to anything.

I am sorry about that, but thank you for the assistance!

Hey we are all on this Journey together :slight_smile:

1 Like