From 5588b9e7850778cf5b3235e8f76769eb33e7408e Mon Sep 17 00:00:00 2001 From: Bryan McLellan Date: Tue, 3 Apr 2012 15:00:16 -0700 Subject: [PATCH] update tests for knife cookbook site install on windows --- chef/lib/chef/knife/cookbook_site_install.rb | 2 +- chef/spec/unit/knife/cookbook_site_install_spec.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/chef/lib/chef/knife/cookbook_site_install.rb b/chef/lib/chef/knife/cookbook_site_install.rb index fe56a46ac7f..d1c198cdb04 100644 --- a/chef/lib/chef/knife/cookbook_site_install.rb +++ b/chef/lib/chef/knife/cookbook_site_install.rb @@ -130,7 +130,7 @@ def download_cookbook_to(download_path) def extract_cookbook(upstream_file, version) ui.info("Uncompressing #{@cookbook_name} version #{version}.") - shell_out!("tar zxvf '#{upstream_file}'", :cwd => @install_path) + shell_out!("tar zxvf #{Shellwords.escape upstream_file}", :cwd => @install_path) end def clear_existing_files(cookbook_path) diff --git a/chef/spec/unit/knife/cookbook_site_install_spec.rb b/chef/spec/unit/knife/cookbook_site_install_spec.rb index 6a0aec4c78a..1216445ed34 100644 --- a/chef/spec/unit/knife/cookbook_site_install_spec.rb +++ b/chef/spec/unit/knife/cookbook_site_install_spec.rb @@ -23,7 +23,11 @@ require 'chef/knife/core/cookbook_scm_repo' @knife = Chef::Knife::CookbookSiteInstall.new @knife.config = {} - @install_path = "/var/tmp/chef" + if Chef::Platform.windows? + @install_path = "C:\tmp\chef" + else + @install_path = "/var/tmp/chef" + end @knife.config[:cookbook_path] = [ @install_path ] @stdout = StringIO.new