summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Sargisson <edward@trailhunger.com>2012-08-27 19:57:51 -0700
committerBryan McLellan <btm@opscode.com>2012-10-24 12:23:09 -0700
commit68f9a21a8b8e44fd560ed4805730fb2feb6df933 (patch)
tree356f09712c5bd3154058de8ab002ac797ad3a825
parent6c6f277261f4dbdcff73fec2f2d7548597255c7a (diff)
downloadchef-68f9a21a8b8e44fd560ed4805730fb2feb6df933.tar.gz
knife site install cookbook on Windows nows completes successfully. 'Cannot open: I/O error' from tar no longer happens
-rw-r--r--chef/lib/chef/knife/cookbook_site_install.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/chef/lib/chef/knife/cookbook_site_install.rb b/chef/lib/chef/knife/cookbook_site_install.rb
index b2e0d84751..584735d8ff 100644
--- a/chef/lib/chef/knife/cookbook_site_install.rb
+++ b/chef/lib/chef/knife/cookbook_site_install.rb
@@ -107,6 +107,7 @@ class Chef
end
end
+
unless config[:no_deps]
md = Chef::Cookbook::Metadata.new
md.from_file(File.join(@install_path, @cookbook_name, "metadata.rb"))
@@ -143,13 +144,21 @@ class Chef
def extract_cookbook(upstream_file, version)
ui.info("Uncompressing #{@cookbook_name} version #{version}.")
- shell_out!("tar zxvf #{Shellwords.escape upstream_file}", :cwd => @install_path)
+ shell_out!("tar zxvf #{convert_path upstream_file}", :cwd => @install_path)
end
def clear_existing_files(cookbook_path)
ui.info("Removing pre-existing version.")
FileUtils.rmtree(cookbook_path) if File.directory?(cookbook_path)
end
+
+ def convert_path(upstream_file)
+ if ENV['MSYSTEM'] == 'MINGW32'
+ return upstream_file.sub(/^([[:alpha:]]):/, '/\1')
+ else
+ return Shellwords.escape upstream_file
+ end
+ end
end
end
end