summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-02-06 13:51:57 -0800
committerGitHub <noreply@github.com>2020-02-06 13:51:57 -0800
commitcfed4c47bfa3001399593dded506f256970ceee7 (patch)
tree64600230fa3b1c0757dc9efc54f964e218eeadb0
parent4fe6ae94abdf253c2360a37e87d88ec62c962aa7 (diff)
parent06e2d1ce84de8a2eca3bbf1e433bd4ee4bd3ddab (diff)
downloadchef-cfed4c47bfa3001399593dded506f256970ceee7.tar.gz
Merge pull request #9344 from chef/better_knife_error
Expand the path in knife cookbook upload errors
-rw-r--r--lib/chef/knife/cookbook_upload.rb2
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index fe72e139a3..aa226a1fc1 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -108,7 +108,7 @@ class Chef
if cookbooks.empty?
cookbook_path = config[:cookbook_path].respond_to?(:join) ? config[:cookbook_path].join(", ") : config[:cookbook_path]
- ui.warn("Could not find any cookbooks in your cookbook path: #{cookbook_path}. Use --cookbook-path to specify the desired path.")
+ ui.warn("Could not find any cookbooks in your cookbook path: '#{File.expand_path(cookbook_path)}'. Use --cookbook-path to specify the desired path.")
else
begin
tmp_cl = Chef::CookbookLoader.copy_to_tmp_dir_from_array(cookbooks)
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index 6bbd6525da..ae8fbb4135 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -325,7 +325,7 @@ describe Chef::Knife::CookbookUpload do
it "should warn users that no cookbooks exist" do
knife.config[:cookbook_path] = ["/chef-repo/cookbooks", "/home/user/cookbooks"]
expect(knife.ui).to receive(:warn).with(
- /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path].join(', ')}\. Use --cookbook-path to specify the desired path\./
+ /Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path].join(', ')}'\. Use --cookbook-path to specify the desired path\./
)
knife.run
end
@@ -335,7 +335,7 @@ describe Chef::Knife::CookbookUpload do
it "should warn users that no cookbooks exist" do
knife.config[:cookbook_path] = "/chef-repo/cookbooks"
expect(knife.ui).to receive(:warn).with(
- /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path]}\. Use --cookbook-path to specify the desired path\./
+ /Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path]}'\. Use --cookbook-path to specify the desired path\./
)
knife.run
end