summaryrefslogtreecommitdiff
path: root/lib/chef/application
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-08-02 16:36:05 -0700
committerNoah Kantrowitz <noah@coderanger.net>2016-08-02 16:36:05 -0700
commit0368df838c36fd5a54c75007aae3c2e28cbdba1b (patch)
treed89eac235ed3890c4628c59505299627a44508ca /lib/chef/application
parent16fbf0a9a81daa1e3418eca251e59b4545ae0b88 (diff)
parent767a45530b373bbd4818b93ab1efe5cd3c7da5ed (diff)
downloadchef-0368df838c36fd5a54c75007aae3c2e28cbdba1b.tar.gz
Merge branch 'master' into configoption
Diffstat (limited to 'lib/chef/application')
-rw-r--r--lib/chef/application/client.rb4
-rw-r--r--lib/chef/application/solo.rb11
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index cec47ac071..71bb300971 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -27,6 +27,7 @@ require "chef/handler/error_report"
require "chef/workstation_config_loader"
require "chef/mixin/shell_out"
require "chef-config/mixin/dot_d"
+require "mixlib/archive"
class Chef::Application::Client < Chef::Application
include Chef::Mixin::ShellOut
@@ -342,8 +343,7 @@ class Chef::Application::Client < Chef::Application
FileUtils.mkdir_p(Chef::Config.chef_repo_path)
tarball_path = File.join(Chef::Config.chef_repo_path, "recipes.tgz")
fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)
- result = shell_out!("tar zxvf #{tarball_path} -C #{Chef::Config.chef_repo_path}")
- Chef::Log.debug "#{result.stdout}"
+ Mixlib::Archive.new(tarball_path).extract(Chef::Config.chef_repo_path, perms: false, ignore: /^\.$/)
end
end
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index d38e97e82b..8bf381a975 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -29,6 +29,7 @@ require "fileutils"
require "chef/mixin/shell_out"
require "pathname"
require "chef-config/mixin/dot_d"
+require "mixlib/archive"
class Chef::Application::Solo < Chef::Application
include Chef::Mixin::ShellOut
@@ -249,6 +250,13 @@ class Chef::Application::Solo < Chef::Application
ARGV[dash_r] = "--recipe-url"
end
+ # For back compat reasons, we need to ensure that we try and use the cache_path as a repo first
+ Chef::Log.debug "Current chef_repo_path is #{Chef::Config.chef_repo_path}"
+
+ if !Chef::Config.has_key?(:cookbook_path) && !Chef::Config.has_key?(:chef_repo_path)
+ Chef::Config.chef_repo_path = Chef::Config.find_chef_repo_path(Chef::Config[:cache_path])
+ end
+
Chef::Config[:local_mode] = true
else
configure_legacy_mode!
@@ -274,8 +282,7 @@ class Chef::Application::Solo < Chef::Application
FileUtils.mkdir_p(recipes_path)
tarball_path = File.join(recipes_path, "recipes.tgz")
fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)
- result = shell_out!("tar zxvf #{tarball_path} -C #{recipes_path}")
- Chef::Log.debug "#{result.stdout}"
+ Mixlib::Archive.new(tarball_path).extract(Chef::Config.chef_repo_path, perms: false, ignore: /^\.$/)
end
# json_attribs shuld be fetched after recipe_url tarball is unpacked.