diff options
author | Tim Smith <tsmith@chef.io> | 2020-07-13 22:41:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 22:41:34 -0700 |
commit | 7049f9973804e14237f581c16c4f0c5ffcbe384b (patch) | |
tree | af16da74b15067d59280d268a1ab7360d923c481 | |
parent | 73af446179a1ef49c057788620e1d2c0fa5aa7f0 (diff) | |
parent | 217b5bbfaebafc5d6d5f70e3bb6bf077c6c76f09 (diff) | |
download | chef-7049f9973804e14237f581c16c4f0c5ffcbe384b.tar.gz |
Merge pull request #10146 from MsysTechnologiesllc/antima/203_windows_path_cookbook_upload_fixes
Fixed `knife cookbook upload -o` windows path issue
-rw-r--r-- | lib/chef/knife/cookbook_upload.rb | 8 | ||||
-rw-r--r-- | spec/integration/knife/cookbook_upload_spec.rb | 27 |
2 files changed, 31 insertions, 4 deletions
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb index 14e8419bec..5a46972b43 100644 --- a/lib/chef/knife/cookbook_upload.rb +++ b/lib/chef/knife/cookbook_upload.rb @@ -34,10 +34,10 @@ class Chef banner "knife cookbook upload [COOKBOOKS...] (options)" option :cookbook_path, - short: "-o PATH:PATH", - long: "--cookbook-path PATH:PATH", - description: "A colon-separated path to look for cookbooks in.", - proc: lambda { |o| o.split(":") } + short: "-o 'PATH:PATH'", + long: "--cookbook-path 'PATH:PATH'", + description: "A delimited path to search for cookbooks. On Unix the delimiter is ':', on Windows it is ';'.", + proc: lambda { |o| o.split(File::PATH_SEPARATOR) } option :freeze, long: "--freeze", diff --git a/spec/integration/knife/cookbook_upload_spec.rb b/spec/integration/knife/cookbook_upload_spec.rb index 79a9efbfb7..7139f0accd 100644 --- a/spec/integration/knife/cookbook_upload_spec.rb +++ b/spec/integration/knife/cookbook_upload_spec.rb @@ -97,5 +97,32 @@ describe "knife cookbook upload", :workstation do expect { knife("cookbook upload x -o #{cb_dir}") }.to raise_error(Chef::Exceptions::MetadataNotValid) end end + + when_the_repository "has cookbooks at multiple paths" do + + let(:cb_dir_first) do + File.join(@repository_dir, "cookbooks") + .gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR) + end + + let(:cb_dir_second) do + File.join(@repository_dir, "test_cookbooks") + .gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR) + end + + before(:each) do + file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0") + file "test_cookbooks/y/metadata.rb", cb_metadata("y", "1.0.0") + end + + it "knife cookbook upload with -o or --cookbook-path" do + knife("cookbook upload x y -o #{cb_dir_first}#{File::PATH_SEPARATOR}#{cb_dir_second}").should_succeed stderr: <<~EOM + Uploading x [1.0.0] + Uploading y [1.0.0] + Uploaded 2 cookbooks. + EOM + end + + end end end |