Home Ask Login Register

Developers Planet

Your answer is one click away!

Saravanan G February 2016

windows_zipfile Chef resource failing due to 'rubyzip' gem file download

We are facing a situation, where end users Windows VM does not have internet connectivity, but only have access to file store.

We are using windows_zipfile resource in one of our recipe. So cookbook execution failed in Windows cookbook, due to the reason that, it is not able to download rubyzip from "rubygems.org" site.

We are thinking of solving the issue in either of these two ways,

  1. Replace the windows_zipfile code with powershell_script and implement the code using Powershell commands

  2. Load the rubyzip gem and its dependency in file store and install the gems before calling windows_zipfile resource.

Please provide suggestions to handle the scenario. Also let me know, is there any other way to solve the issue.


StephenKing February 2016

You should be able to install a chef_gem from a local path, after downloading it from a source inside your network (just replace the URL of https://rubygems.org):

{"httpclient" => "2.7.1", "rubyzip" => "1.1.7"}.each do |gem,version|
  filename = "#{gem}-#{version}.gem"
  remote_file File.join(Chef::Config[:file_cache_path], filename) do
    source "https://rubygems.org/downloads/#{filename}"

  chef_gem gem do
    source File.join(Chef::Config[:file_cache_path], filename)
    version version

As the Gem is used by Chef's ruby, make sure to use the chef_gem resource.

Post Status

Asked in February 2016
Viewed 2,801 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life