diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:27:03 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:27:03 -0700 |
commit | dcac6762380d011f73cf53a50476d31dab0025ee (patch) | |
tree | 294fef3e2b4fea273c4bb11a086061872ed51598 /spec/integration | |
parent | 35603c7ce1bd3ccf35334ed65152140f0ecaf080 (diff) | |
download | chef-dcac6762380d011f73cf53a50476d31dab0025ee.tar.gz |
fix Layout/IndentHeredoc
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/integration')
51 files changed, 4410 insertions, 4410 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 3c4d43aac5..4408c00b23 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -54,18 +54,18 @@ describe "chef-client" do before { file "cookbooks/x/recipes/default.rb", "" } it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) end it "should complete successfully with no other environment variables", skip: (Chef::Platform.windows?) do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM begin @@ -79,9 +79,9 @@ EOM end it "should complete successfully with --no-listen" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} --no-listen -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) @@ -123,9 +123,9 @@ EOM end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) @@ -134,42 +134,42 @@ EOM context "and a private key" do before do - file "mykey.pem", <<EOM ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf -0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk -NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn -0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O -AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP -HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom -8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB -zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx -k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb -i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ -G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV -ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL -awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK -7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns -g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr -Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy -HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 -V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO -fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN -lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr -c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo -fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV -YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL -syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T -+vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= ------END RSA PRIVATE KEY----- + file "mykey.pem", <<~EOM + -----BEGIN RSA PRIVATE KEY----- + MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf + 0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk + NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn + 0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O + AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP + HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom + 8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB + zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx + k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb + i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ + G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV + ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL + awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK + 7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns + g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr + Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy + HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 + V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO + fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN + lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr + c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo + fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV + YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL + syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T + +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= + -----END RSA PRIVATE KEY----- EOM end it "should complete with success even with a client key" do - file "config/client.rb", <<EOM -local_mode true -client_key #{path_to('mykey.pem').inspect} -cookbook_path #{path_to('cookbooks').inspect} + file "config/client.rb", <<~EOM + local_mode true + client_key #{path_to('mykey.pem').inspect} + cookbook_path #{path_to('cookbooks').inspect} EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) @@ -177,22 +177,22 @@ EOM end it "should run recipes specified directly on the command line" do - file "config/client.rb", <<EOM -local_mode true -client_key #{path_to('mykey.pem').inspect} -cookbook_path #{path_to('cookbooks').inspect} + file "config/client.rb", <<~EOM + local_mode true + client_key #{path_to('mykey.pem').inspect} + cookbook_path #{path_to('cookbooks').inspect} EOM - file "arbitrary.rb", <<EOM -file #{path_to('tempfile.txt').inspect} do - content '1' -end + file "arbitrary.rb", <<~EOM + file #{path_to('tempfile.txt').inspect} do + content '1' + end EOM - file "arbitrary2.rb", <<EOM -file #{path_to('tempfile2.txt').inspect} do - content '2' -end + file "arbitrary2.rb", <<~EOM + file #{path_to('tempfile2.txt').inspect} do + content '2' + end EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", cwd: chef_dir) @@ -203,16 +203,16 @@ EOM end it "should run recipes specified as relative paths directly on the command line" do - file "config/client.rb", <<EOM -local_mode true -client_key #{path_to('mykey.pem').inspect} -cookbook_path #{path_to('cookbooks').inspect} + file "config/client.rb", <<~EOM + local_mode true + client_key #{path_to('mykey.pem').inspect} + cookbook_path #{path_to('cookbooks').inspect} EOM - file "arbitrary.rb", <<EOM -file #{path_to('tempfile.txt').inspect} do - content '1' -end + file "arbitrary.rb", <<~EOM + file #{path_to('tempfile.txt').inspect} do + content '1' + end EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", cwd: path_to("")) @@ -222,21 +222,21 @@ EOM end it "should run recipes specified directly on the command line AFTER recipes in the run list" do - file "config/client.rb", <<EOM -local_mode true -client_key #{path_to('mykey.pem').inspect} -cookbook_path #{path_to('cookbooks').inspect} + file "config/client.rb", <<~EOM + local_mode true + client_key #{path_to('mykey.pem').inspect} + cookbook_path #{path_to('cookbooks').inspect} EOM - file "cookbooks/x/recipes/constant_definition.rb", <<EOM -class ::Blah - THECONSTANT = '1' -end + file "cookbooks/x/recipes/constant_definition.rb", <<~EOM + class ::Blah + THECONSTANT = '1' + end EOM - file "arbitrary.rb", <<EOM -file #{path_to('tempfile.txt').inspect} do - content ::Blah::THECONSTANT -end + file "arbitrary.rb", <<~EOM + file #{path_to('tempfile.txt').inspect} do + content ::Blah::THECONSTANT + end EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", cwd: path_to("")) @@ -248,9 +248,9 @@ EOM end it "should complete with success when passed the -z flag" do - file "config/client.rb", <<EOM -chef_server_url 'http://omg.com/blah' -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + chef_server_url 'http://omg.com/blah' + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) @@ -258,9 +258,9 @@ EOM end it "should complete with success when passed the --local-mode flag" do - file "config/client.rb", <<EOM -chef_server_url 'http://omg.com/blah' -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + chef_server_url 'http://omg.com/blah' + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir) @@ -268,9 +268,9 @@ EOM end it "should not print SSL warnings when running in local-mode" do - file "config/client.rb", <<EOM -chef_server_url 'http://omg.com/blah' -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + chef_server_url 'http://omg.com/blah' + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir) @@ -279,9 +279,9 @@ EOM end it "should complete with success when passed -z and --chef-zero-port" do - file "config/client.rb", <<EOM -chef_server_url 'http://omg.com/blah' -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + chef_server_url 'http://omg.com/blah' + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) @@ -289,9 +289,9 @@ EOM end it "should complete with success when setting the run list with -r" do - file "config/client.rb", <<EOM -chef_server_url 'http://omg.com/blah' -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + chef_server_url 'http://omg.com/blah' + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -r 'x::default' -z -l info", cwd: chef_dir) @@ -301,9 +301,9 @@ EOM end it "should complete with success when using --profile-ruby and output a profile file", :not_supported_on_aix do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir) result.error! @@ -311,9 +311,9 @@ EOM end it "doesn't produce a profile when --profile-ruby is not present" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) result.error! @@ -324,14 +324,14 @@ EOM when_the_repository "has a cookbook that should fail chef_version checks" do before do file "cookbooks/x/recipes/default.rb", "" - file "cookbooks/x/metadata.rb", <<EOM -name 'x' -version '0.0.1' -chef_version '~> 999.99' + file "cookbooks/x/metadata.rb", <<~EOM + name 'x' + version '0.0.1' + chef_version '~> 999.99' EOM - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM end it "should fail the chef client run" do @@ -405,12 +405,12 @@ EOM end it "should output each deprecation warning only once, at the end of the run" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -# Mimick what happens when you are on the console -formatters << :doc -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + # Mimick what happens when you are on the console + formatters << :doc + log_level :warn EOM ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS") @@ -430,20 +430,20 @@ EOM when_the_repository "has a cookbook with only an audit recipe" do before do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -audit_mode :enabled + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + audit_mode :enabled EOM end it "should exit with a zero code when there is not an audit failure" do - file "cookbooks/audit_test/recipes/succeed.rb", <<-RECIPE -control_group "control group without top level control" do - it "should succeed" do - expect(2 - 2).to eq(0) - end -end + file "cookbooks/audit_test/recipes/succeed.rb", <<~RECIPE + control_group "control group without top level control" do + it "should succeed" do + expect(2 - 2).to eq(0) + end + end RECIPE result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::succeed' -l info", cwd: chef_dir) @@ -452,12 +452,12 @@ end end it "should exit with a non-zero code when there is an audit failure" do - file "cookbooks/audit_test/recipes/fail.rb", <<-RECIPE -control_group "control group without top level control" do - it "should fail" do - expect(2 - 2).to eq(1) - end -end + file "cookbooks/audit_test/recipes/fail.rb", <<~RECIPE + control_group "control group without top level control" do + it "should fail" do + expect(2 - 2).to eq(1) + end + end RECIPE result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::fail'", cwd: chef_dir) @@ -468,24 +468,24 @@ end when_the_repository "has a cookbook that deploys a file" do before do - file "cookbooks/x/recipes/default.rb", <<-RECIPE -cookbook_file #{path_to('tempfile.txt').inspect} do - source "my_file" -end + file "cookbooks/x/recipes/default.rb", <<~RECIPE + cookbook_file #{path_to('tempfile.txt').inspect} do + source "my_file" + end RECIPE - file "cookbooks/x/files/my_file", <<-FILE -this is my file + file "cookbooks/x/files/my_file", <<~FILE + this is my file FILE end [true, false].each do |lazy| context "with no_lazy_load set to #{lazy}" do it "should create the file" do - file "config/client.rb", <<EOM -no_lazy_load #{lazy} -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + no_lazy_load #{lazy} + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) result.error! @@ -498,10 +498,10 @@ EOM when_the_repository "has a cookbook with an ohai plugin" do before do - file "cookbooks/x/recipes/default.rb", <<-RECIPE -file #{path_to('tempfile.txt').inspect} do - content node["english"]["version"] -end + file "cookbooks/x/recipes/default.rb", <<~RECIPE + file #{path_to('tempfile.txt').inspect} do + content node["english"]["version"] + end RECIPE file "cookbooks/x/ohai/english.rb", <<-OHAI @@ -515,9 +515,9 @@ end end OHAI - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM end @@ -542,8 +542,8 @@ EOM let(:tmp_dir) { Dir.mktmpdir("recipe-url") } it "should complete with success when passed -z and --recipe-url" do - file "config/client.rb", <<EOM -chef_repo_path "#{tmp_dir}" + file "config/client.rb", <<~EOM + chef_repo_path "#{tmp_dir}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", cwd: tmp_dir) result.error! @@ -564,21 +564,21 @@ EOM when_the_repository "has a cookbook with broken metadata.rb, but has metadata.json" do before do file "cookbooks/x/recipes/default.rb", "" - file "cookbooks/x/metadata.rb", <<EOM -name 'x' -version '0.0.1' -raise "TEH SADNESS" + file "cookbooks/x/metadata.rb", <<~EOM + name 'x' + version '0.0.1' + raise "TEH SADNESS" EOM - file "cookbooks/x/metadata.json", <<EOM -{ - "name": "x", - "version": "0.0.1" -} + file "cookbooks/x/metadata.json", <<~EOM + { + "name": "x", + "version": "0.0.1" + } EOM - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM end @@ -600,9 +600,9 @@ EOM level :info end EOM - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM end @@ -636,9 +636,9 @@ EOM file "cookbooks/x/recipes/default.rb", <<~EOM puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK" EOM - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM end @@ -684,10 +684,10 @@ EOM file "cookbooks/x/recipes/default.rb", <<~EOM puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK" EOM - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -client_fork true + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + client_fork true EOM end @@ -709,10 +709,10 @@ EOM file "cookbooks/x/recipes/default.rb", <<~EOM puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK" EOM - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -client_fork false + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + client_fork false EOM end diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb index 939f5ad5b7..7352863dbf 100644 --- a/spec/integration/client/exit_code_spec.rb +++ b/spec/integration/client/exit_code_spec.rb @@ -28,17 +28,17 @@ describe "chef-client" do when_the_repository "uses RFC 062 defined exit codes" do def setup_client_rb - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" EOM end def setup_client_rb_with_audit_mode - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -audit_mode :audit_only + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + audit_mode :audit_only EOM end @@ -66,12 +66,12 @@ EOM context "with an audit recipe" do context "which fails" do before do - file "cookbooks/x/recipes/default.rb", <<-RECIPE -control_group "control group without top level control" do - it "should fail" do - expect(4 - 4).to eq(1) - end -end + file "cookbooks/x/recipes/default.rb", <<~RECIPE + control_group "control group without top level control" do + it "should fail" do + expect(4 - 4).to eq(1) + end + end RECIPE end @@ -112,8 +112,8 @@ RECIPE context "when a reboot exception is raised (like from the reboot resource)" do before do - file "cookbooks/x/recipes/default.rb", <<EOM -raise Chef::Exceptions::Reboot.new + file "cookbooks/x/recipes/default.rb", <<~EOM + raise Chef::Exceptions::Reboot.new EOM end @@ -125,8 +125,8 @@ EOM context "when an attempt to reboot fails (like from the reboot resource)" do before do - file "cookbooks/x/recipes/default.rb", <<EOM -raise Chef::Exceptions::RebootFailed.new + file "cookbooks/x/recipes/default.rb", <<~EOM + raise Chef::Exceptions::RebootFailed.new EOM end diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb index b6e08e842f..c3cb73e4fa 100644 --- a/spec/integration/client/ipv6_spec.rb +++ b/spec/integration/client/ipv6_spec.rb @@ -25,34 +25,34 @@ describe "chef-client" do let(:chef_zero_opts) { { host: "::1" } } let(:validation_pem) do - <<-END_VALIDATION_PEM ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf -0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk -NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn -0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O -AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP -HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom -8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB -zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx -k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb -i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ -G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV -ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL -awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK -7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns -g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr -Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy -HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 -V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO -fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN -lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr -c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo -fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV -YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL -syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T -+vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= ------END RSA PRIVATE KEY----- + <<~END_VALIDATION_PEM + -----BEGIN RSA PRIVATE KEY----- + MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf + 0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk + NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn + 0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O + AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP + HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom + 8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB + zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx + k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb + i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ + G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV + ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL + awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK + 7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns + g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr + Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy + HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 + V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO + fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN + lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr + c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo + fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV + YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL + syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T + +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= + -----END RSA PRIVATE KEY----- END_VALIDATION_PEM end @@ -61,11 +61,11 @@ END_VALIDATION_PEM end let(:basic_config_file) do - <<-END_CLIENT_RB -chef_server_url "http://[::1]:8900" -validation_key '#{path_to('config/validator.pem')}' -cache_path '#{cache_path}' -client_key '#{cache_path}/client.pem' + <<~END_CLIENT_RB + chef_server_url "http://[::1]:8900" + validation_key '#{path_to('config/validator.pem')}' + cache_path '#{cache_path}' + client_key '#{cache_path}/client.pem' END_CLIENT_RB end diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb index 1e9d1c65b4..79b0307e0d 100644 --- a/spec/integration/knife/chef_fs_data_store_spec.rb +++ b/spec/integration/knife/chef_fs_data_store_spec.rb @@ -54,59 +54,59 @@ describe "ChefFSDataStore tests", :workstation do context "GET /TYPE" do it "knife list -z -R returns everything" do - knife("list -z -Rfp /").should_succeed <<EOM -/acls/ -/acls/clients/ -/acls/clients/x.json -/acls/containers/ -/acls/containers/x.json -/acls/cookbook_artifacts/ -/acls/cookbook_artifacts/x.json -/acls/cookbooks/ -/acls/cookbooks/x.json -/acls/data_bags/ -/acls/data_bags/x.json -/acls/environments/ -/acls/environments/x.json -/acls/groups/ -/acls/groups/x.json -/acls/nodes/ -/acls/nodes/x.json -/acls/organization.json -/acls/policies/ -/acls/policies/x.json -/acls/policy_groups/ -/acls/policy_groups/x.json -/acls/roles/ -/acls/roles/x.json -/clients/ -/clients/x.json -/containers/ -/containers/x.json -/cookbook_artifacts/ -/cookbook_artifacts/x-111/ -/cookbook_artifacts/x-111/metadata.rb -/cookbooks/ -/cookbooks/x/ -/cookbooks/x/metadata.rb -/data_bags/ -/data_bags/x/ -/data_bags/x/y.json -/environments/ -/environments/x.json -/groups/ -/groups/x.json -/invitations.json -/members.json -/nodes/ -/nodes/x.json -/org.json -/policies/ -/policies/x-111.json -/policy_groups/ -/policy_groups/x.json -/roles/ -/roles/x.json + knife("list -z -Rfp /").should_succeed <<~EOM + /acls/ + /acls/clients/ + /acls/clients/x.json + /acls/containers/ + /acls/containers/x.json + /acls/cookbook_artifacts/ + /acls/cookbook_artifacts/x.json + /acls/cookbooks/ + /acls/cookbooks/x.json + /acls/data_bags/ + /acls/data_bags/x.json + /acls/environments/ + /acls/environments/x.json + /acls/groups/ + /acls/groups/x.json + /acls/nodes/ + /acls/nodes/x.json + /acls/organization.json + /acls/policies/ + /acls/policies/x.json + /acls/policy_groups/ + /acls/policy_groups/x.json + /acls/roles/ + /acls/roles/x.json + /clients/ + /clients/x.json + /containers/ + /containers/x.json + /cookbook_artifacts/ + /cookbook_artifacts/x-111/ + /cookbook_artifacts/x-111/metadata.rb + /cookbooks/ + /cookbooks/x/ + /cookbooks/x/metadata.rb + /data_bags/ + /data_bags/x/ + /data_bags/x/y.json + /environments/ + /environments/x.json + /groups/ + /groups/x.json + /invitations.json + /members.json + /nodes/ + /nodes/x.json + /org.json + /policies/ + /policies/x-111.json + /policy_groups/ + /policy_groups/x.json + /roles/ + /roles/x.json EOM end end @@ -190,9 +190,9 @@ EOM end it "knife cookbook upload works" do - knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed stderr: <<EOM -Uploading x [1.0.0] -Uploaded 1 cookbook. + knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed stderr: <<~EOM + Uploading x [1.0.0] + Uploaded 1 cookbook. EOM knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/x/\n/cookbooks/x/metadata.rb\n" end @@ -220,11 +220,11 @@ EOM it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty", skip: (RUBY_VERSION < "1.9") do knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ ) - expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip -{ - "name": "x", - "description": "hi there" -} + expect(IO.read(path_to("roles/x.json"))).to eq <<~EOM.strip + { + "name": "x", + "description": "hi there" + } EOM end end @@ -247,9 +247,9 @@ EOM end it "knife cookbook upload works" do - knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed stderr: <<EOM -Uploading z [1.0.0] -Uploaded 1 cookbook. + knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed stderr: <<~EOM + Uploading z [1.0.0] + Uploaded 1 cookbook. EOM knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/z/\n/cookbooks/z/metadata.rb\n" end @@ -283,44 +283,44 @@ EOM it "After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty", skip: (RUBY_VERSION < "1.9") do knife("raw -z -i #{path_to('rolestuff.json')} -m POST /roles").should_succeed( /uri/ ) - expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip -{ - "name": "x", - "description": "hi there" -} + expect(IO.read(path_to("roles/x.json"))).to eq <<~EOM.strip + { + "name": "x", + "description": "hi there" + } EOM end end it "knife list -z -R returns nothing" do - knife("list -z -Rfp /").should_succeed <<EOM -/acls/ -/acls/clients/ -/acls/containers/ -/acls/cookbook_artifacts/ -/acls/cookbooks/ -/acls/data_bags/ -/acls/environments/ -/acls/groups/ -/acls/nodes/ -/acls/organization.json -/acls/policies/ -/acls/policy_groups/ -/acls/roles/ -/clients/ -/containers/ -/cookbook_artifacts/ -/cookbooks/ -/data_bags/ -/environments/ -/groups/ -/invitations.json -/members.json -/nodes/ -/org.json -/policies/ -/policy_groups/ -/roles/ + knife("list -z -Rfp /").should_succeed <<~EOM + /acls/ + /acls/clients/ + /acls/containers/ + /acls/cookbook_artifacts/ + /acls/cookbooks/ + /acls/data_bags/ + /acls/environments/ + /acls/groups/ + /acls/nodes/ + /acls/organization.json + /acls/policies/ + /acls/policy_groups/ + /acls/roles/ + /clients/ + /containers/ + /cookbook_artifacts/ + /cookbooks/ + /data_bags/ + /environments/ + /groups/ + /invitations.json + /members.json + /nodes/ + /org.json + /policies/ + /policy_groups/ + /roles/ EOM end @@ -442,23 +442,23 @@ EOM context "GET /TYPE" do it "knife list -z -R returns everything" do - knife("list -z -Rfp /").should_succeed <<EOM -/clients/ -/clients/x.json -/cookbooks/ -/cookbooks/x/ -/cookbooks/x/metadata.rb -/data_bags/ -/data_bags/x/ -/data_bags/x/y.json -/environments/ -/environments/x.json -/nodes/ -/nodes/x.json -/roles/ -/roles/x.json -/users/ -/users/x.json + knife("list -z -Rfp /").should_succeed <<~EOM + /clients/ + /clients/x.json + /cookbooks/ + /cookbooks/x/ + /cookbooks/x/metadata.rb + /data_bags/ + /data_bags/x/ + /data_bags/x/y.json + /environments/ + /environments/x.json + /nodes/ + /nodes/x.json + /roles/ + /roles/x.json + /users/ + /users/x.json EOM end end @@ -491,11 +491,11 @@ EOM it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty", skip: (RUBY_VERSION < "1.9") do knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ ) - expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip -{ - "name": "x", - "description": "hi there" -} + expect(IO.read(path_to("roles/x.json"))).to eq <<~EOM.strip + { + "name": "x", + "description": "hi there" + } EOM end end @@ -519,14 +519,14 @@ EOM end it "knife list -z -R returns nothing" do - knife("list -z -Rfp /").should_succeed <<EOM -/clients/ -/cookbooks/ -/data_bags/ -/environments/ -/nodes/ -/roles/ -/users/ + knife("list -z -Rfp /").should_succeed <<~EOM + /clients/ + /cookbooks/ + /data_bags/ + /environments/ + /nodes/ + /roles/ + /users/ EOM end diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb index 9cb093c178..f1ab02dceb 100644 --- a/spec/integration/knife/chef_repo_path_spec.rb +++ b/spec/integration/knife/chef_repo_path_spec.rb @@ -59,92 +59,92 @@ describe "chef_repo_path tests", :workstation do it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do Chef::Config.delete(:chef_repo_path) - knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<EOM -/clients/ -/clients/client3.json -/cookbooks/ -/cookbooks/cookbook3/ -/cookbooks/cookbook3/metadata.rb -/data_bags/ -/data_bags/bag3/ -/data_bags/bag3/item3.json -/environments/ -/environments/env3.json -/nodes/ -/nodes/node3.json -/roles/ -/roles/role3.json -/users/ -/users/user3.json + knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<~EOM + /clients/ + /clients/client3.json + /cookbooks/ + /cookbooks/cookbook3/ + /cookbooks/cookbook3/metadata.rb + /data_bags/ + /data_bags/bag3/ + /data_bags/bag3/item3.json + /environments/ + /environments/env3.json + /nodes/ + /nodes/node3.json + /roles/ + /roles/role3.json + /users/ + /users/user3.json EOM end it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do Chef::Config.delete(:chef_repo_path) - knife("list --local -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<EOM -/clients/ -/clients/client3.json -/cookbooks/ -/cookbooks/cookbook3/ -/cookbooks/cookbook3/metadata.rb -/data_bags/ -/data_bags/bag3/ -/data_bags/bag3/item3.json -/environments/ -/environments/env3.json -/nodes/ -/nodes/node3.json -/roles/ -/roles/role3.json -/users/ -/users/user3.json + knife("list --local -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<~EOM + /clients/ + /clients/client3.json + /cookbooks/ + /cookbooks/cookbook3/ + /cookbooks/cookbook3/metadata.rb + /data_bags/ + /data_bags/bag3/ + /data_bags/bag3/item3.json + /environments/ + /environments/env3.json + /nodes/ + /nodes/node3.json + /roles/ + /roles/role3.json + /users/ + /users/user3.json EOM end it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do Chef::Config.delete(:chef_repo_path) - knife("list -z -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<EOM -/acls/ -/acls/clients/ -/acls/clients/client3.json -/acls/containers/ -/acls/cookbook_artifacts/ -/acls/cookbooks/ -/acls/cookbooks/cookbook3.json -/acls/data_bags/ -/acls/data_bags/bag3.json -/acls/environments/ -/acls/environments/env3.json -/acls/groups/ -/acls/nodes/ -/acls/nodes/node3.json -/acls/organization.json -/acls/policies/ -/acls/policy_groups/ -/acls/roles/ -/acls/roles/role3.json -/clients/ -/clients/client3.json -/containers/ -/cookbook_artifacts/ -/cookbooks/ -/cookbooks/cookbook3/ -/cookbooks/cookbook3/metadata.rb -/data_bags/ -/data_bags/bag3/ -/data_bags/bag3/item3.json -/environments/ -/environments/env3.json -/groups/ -/invitations.json -/members.json -/nodes/ -/nodes/node3.json -/org.json -/policies/ -/policy_groups/ -/roles/ -/roles/role3.json + knife("list -z -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<~EOM + /acls/ + /acls/clients/ + /acls/clients/client3.json + /acls/containers/ + /acls/cookbook_artifacts/ + /acls/cookbooks/ + /acls/cookbooks/cookbook3.json + /acls/data_bags/ + /acls/data_bags/bag3.json + /acls/environments/ + /acls/environments/env3.json + /acls/groups/ + /acls/nodes/ + /acls/nodes/node3.json + /acls/organization.json + /acls/policies/ + /acls/policy_groups/ + /acls/roles/ + /acls/roles/role3.json + /clients/ + /clients/client3.json + /containers/ + /cookbook_artifacts/ + /cookbooks/ + /cookbooks/cookbook3/ + /cookbooks/cookbook3/metadata.rb + /data_bags/ + /data_bags/bag3/ + /data_bags/bag3/item3.json + /environments/ + /environments/env3.json + /groups/ + /invitations.json + /members.json + /nodes/ + /nodes/node3.json + /org.json + /policies/ + /policy_groups/ + /roles/ + /roles/role3.json EOM end @@ -157,23 +157,23 @@ EOM end it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do - knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<EOM -/clients/ -/clients/client3.json -/cookbooks/ -/cookbooks/cookbook3/ -/cookbooks/cookbook3/metadata.rb -/data_bags/ -/data_bags/bag3/ -/data_bags/bag3/item3.json -/environments/ -/environments/env3.json -/nodes/ -/nodes/node3.json -/roles/ -/roles/role3.json -/users/ -/users/user3.json + knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<~EOM + /clients/ + /clients/client3.json + /cookbooks/ + /cookbooks/cookbook3/ + /cookbooks/cookbook3/metadata.rb + /data_bags/ + /data_bags/bag3/ + /data_bags/bag3/item3.json + /environments/ + /environments/env3.json + /nodes/ + /nodes/node3.json + /roles/ + /roles/role3.json + /users/ + /users/user3.json EOM end @@ -194,23 +194,23 @@ EOM context "when cwd is inside chef_repo2" do before { cwd "chef_repo2" } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client2.json -cookbooks/ -cookbooks/cookbook2/ -cookbooks/cookbook2/metadata.rb -data_bags/ -data_bags/bag2/ -data_bags/bag2/item2.json -environments/ -environments/env2.json -nodes/ -nodes/node2.json -roles/ -roles/role2.json -users/ -users/user2.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client2.json + cookbooks/ + cookbooks/cookbook2/ + cookbooks/cookbook2/metadata.rb + data_bags/ + data_bags/bag2/ + data_bags/bag2/item2.json + environments/ + environments/env2.json + nodes/ + nodes/node2.json + roles/ + roles/role2.json + users/ + users/user2.json EOM end end @@ -218,9 +218,9 @@ EOM context "when cwd is inside data_bags2" do before { cwd "data_bags2" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag2/ -bag2/item2.json + knife("list --local -Rfp").should_succeed <<~EOM + bag2/ + bag2/item2.json EOM end it "knife list --local -Rfp ../roles lists roles" do @@ -239,23 +239,23 @@ EOM context "when cwd is at the top level" do before { cwd "." } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client2.json -cookbooks/ -cookbooks/cookbook2/ -cookbooks/cookbook2/metadata.rb -data_bags/ -data_bags/bag2/ -data_bags/bag2/item2.json -environments/ -environments/env2.json -nodes/ -nodes/node2.json -roles/ -roles/role2.json -users/ -users/user2.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client2.json + cookbooks/ + cookbooks/cookbook2/ + cookbooks/cookbook2/metadata.rb + data_bags/ + data_bags/bag2/ + data_bags/bag2/item2.json + environments/ + environments/env2.json + nodes/ + nodes/node2.json + roles/ + roles/role2.json + users/ + users/user2.json EOM end end @@ -277,9 +277,9 @@ EOM context "when cwd is inside data_bags2" do before { cwd "data_bags2" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag2/ -bag2/item2.json + knife("list --local -Rfp").should_succeed <<~EOM + bag2/ + bag2/item2.json EOM end end @@ -310,23 +310,23 @@ EOM context "when cwd is inside chef_repo2" do before { cwd "chef_repo2" } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client3.json -cookbooks/ -cookbooks/cookbook3/ -cookbooks/cookbook3/metadata.rb -data_bags/ -data_bags/bag3/ -data_bags/bag3/item3.json -environments/ -environments/env3.json -nodes/ -nodes/node3.json -roles/ -roles/role3.json -users/ -users/user3.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client3.json + cookbooks/ + cookbooks/cookbook3/ + cookbooks/cookbook3/metadata.rb + data_bags/ + data_bags/bag3/ + data_bags/bag3/item3.json + environments/ + environments/env3.json + nodes/ + nodes/node3.json + roles/ + roles/role3.json + users/ + users/user3.json EOM end end @@ -334,9 +334,9 @@ EOM context "when cwd is inside chef_repo2/data_bags" do before { cwd "chef_repo2/data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag3/ -bag3/item3.json + knife("list --local -Rfp").should_succeed <<~EOM + bag3/ + bag3/item3.json EOM end end @@ -359,11 +359,11 @@ EOM file "clients2/blah.json", {} end it "knife show /clients/blah.json succeeds" do - knife("show --local /clients/blah.json").should_succeed <<EOM -/clients/blah.json: -{ - -} + knife("show --local /clients/blah.json").should_succeed <<~EOM + /clients/blah.json: + { + + } EOM end end @@ -374,13 +374,13 @@ EOM file "cookbooks2/blah/metadata.rb", "" end it "knife list -Rfp cookbooks shows files in blah" do - knife("list --local -Rfp /cookbooks").should_succeed <<EOM -/cookbooks/blah/ -/cookbooks/blah/metadata.rb -/cookbooks/cookbook1/ -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/ -/cookbooks/cookbook2/metadata.rb + knife("list --local -Rfp /cookbooks").should_succeed <<~EOM + /cookbooks/blah/ + /cookbooks/blah/metadata.rb + /cookbooks/cookbook1/ + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/ + /cookbooks/cookbook2/metadata.rb EOM end end @@ -391,13 +391,13 @@ EOM file "cookbooks2/blah/metadata.rb", "" end it "knife list -Rfp cookbooks shows files in blah" do - knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, stderr: "WARN: Cookbook 'blah' is empty or entirely chefignored at #{Chef::Config.cookbook_path[0]}/blah\n") -/cookbooks/blah/ -/cookbooks/blah/metadata.rb -/cookbooks/cookbook1/ -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/ -/cookbooks/cookbook2/metadata.rb + knife("list --local -Rfp /cookbooks").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'blah' is empty or entirely chefignored at #{Chef::Config.cookbook_path[0]}/blah\n") + /cookbooks/blah/ + /cookbooks/blah/metadata.rb + /cookbooks/cookbook1/ + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/ + /cookbooks/cookbook2/metadata.rb EOM end end @@ -408,13 +408,13 @@ EOM file "cookbooks2/blah/metadata.rb", "" end it "knife list -Rfp cookbooks shows files in the first cookbook and not the second" do - knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, stderr: "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.cookbook_path[0]}/blah and #{Chef::Config.cookbook_path[1]}/blah\n") -/cookbooks/blah/ -/cookbooks/blah/metadata.json -/cookbooks/cookbook1/ -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/ -/cookbooks/cookbook2/metadata.rb + knife("list --local -Rfp /cookbooks").should_succeed(<<~EOM, stderr: "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.cookbook_path[0]}/blah and #{Chef::Config.cookbook_path[1]}/blah\n") + /cookbooks/blah/ + /cookbooks/blah/metadata.json + /cookbooks/cookbook1/ + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/ + /cookbooks/cookbook2/metadata.rb EOM end end @@ -425,13 +425,13 @@ EOM file "data_bags2/blah/item.json", "" end it "knife list -Rfp data_bags shows files in blah" do - knife("list --local -Rfp /data_bags").should_succeed <<EOM -/data_bags/bag/ -/data_bags/bag/item.json -/data_bags/bag2/ -/data_bags/bag2/item2.json -/data_bags/blah/ -/data_bags/blah/item.json + knife("list --local -Rfp /data_bags").should_succeed <<~EOM + /data_bags/bag/ + /data_bags/bag/item.json + /data_bags/bag2/ + /data_bags/bag2/item2.json + /data_bags/blah/ + /data_bags/blah/item.json EOM end end @@ -442,13 +442,13 @@ EOM file "data_bags2/blah/item2.json", "" end it "knife list -Rfp data_bags shows only items in data_bags1" do - knife("list --local -Rfp /data_bags").should_succeed(<<EOM, stderr: "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.data_bag_path[0]}/blah and #{Chef::Config.data_bag_path[1]}/blah\n") -/data_bags/bag/ -/data_bags/bag/item.json -/data_bags/bag2/ -/data_bags/bag2/item2.json -/data_bags/blah/ -/data_bags/blah/item1.json + knife("list --local -Rfp /data_bags").should_succeed(<<~EOM, stderr: "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.data_bag_path[0]}/blah and #{Chef::Config.data_bag_path[1]}/blah\n") + /data_bags/bag/ + /data_bags/bag/item.json + /data_bags/bag2/ + /data_bags/bag2/item2.json + /data_bags/blah/ + /data_bags/blah/item1.json EOM end end @@ -459,11 +459,11 @@ EOM file "environments2/blah.json", {} end it "knife show /environments/blah.json succeeds" do - knife("show --local /environments/blah.json").should_succeed <<EOM -/environments/blah.json: -{ - -} + knife("show --local /environments/blah.json").should_succeed <<~EOM + /environments/blah.json: + { + + } EOM end end @@ -474,11 +474,11 @@ EOM file "nodes2/blah.json", {} end it "knife show /nodes/blah.json succeeds" do - knife("show --local /nodes/blah.json").should_succeed <<EOM -/nodes/blah.json: -{ - -} + knife("show --local /nodes/blah.json").should_succeed <<~EOM + /nodes/blah.json: + { + + } EOM end end @@ -489,11 +489,11 @@ EOM file "roles2/blah.json", {} end it "knife show /roles/blah.json succeeds" do - knife("show --local /roles/blah.json").should_succeed <<EOM -/roles/blah.json: -{ - -} + knife("show --local /roles/blah.json").should_succeed <<~EOM + /roles/blah.json: + { + + } EOM end end @@ -504,11 +504,11 @@ EOM file "users2/blah.json", {} end it "knife show /users/blah.json succeeds" do - knife("show --local /users/blah.json").should_succeed <<EOM -/users/blah.json: -{ - -} + knife("show --local /users/blah.json").should_succeed <<~EOM + /users/blah.json: + { + + } EOM end end @@ -523,11 +523,11 @@ EOM context "when cwd is inside the data_bags directory" do before { cwd "data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json -bag2/ -bag2/item2.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json + bag2/ + bag2/item2.json EOM end end @@ -535,32 +535,32 @@ EOM context "when cwd is inside chef_repo2" do before { cwd "chef_repo2" } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client1.json -clients/client2.json -cookbooks/ -cookbooks/cookbook1/ -cookbooks/cookbook1/metadata.rb -cookbooks/cookbook2/ -cookbooks/cookbook2/metadata.rb -data_bags/ -data_bags/bag/ -data_bags/bag/item.json -data_bags/bag2/ -data_bags/bag2/item2.json -environments/ -environments/env1.json -environments/env2.json -nodes/ -nodes/node1.json -nodes/node2.json -roles/ -roles/role1.json -roles/role2.json -users/ -users/user1.json -users/user2.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client1.json + clients/client2.json + cookbooks/ + cookbooks/cookbook1/ + cookbooks/cookbook1/metadata.rb + cookbooks/cookbook2/ + cookbooks/cookbook2/metadata.rb + data_bags/ + data_bags/bag/ + data_bags/bag/item.json + data_bags/bag2/ + data_bags/bag2/item2.json + environments/ + environments/env1.json + environments/env2.json + nodes/ + nodes/node1.json + nodes/node2.json + roles/ + roles/role1.json + roles/role2.json + users/ + users/user1.json + users/user2.json EOM end end @@ -568,11 +568,11 @@ EOM context "when cwd is inside data_bags2" do before { cwd "data_bags2" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json -bag2/ -bag2/item2.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json + bag2/ + bag2/item2.json EOM end end @@ -592,32 +592,32 @@ EOM context "when cwd is at the top level" do before { cwd "." } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client1.json -clients/client3.json -cookbooks/ -cookbooks/cookbook1/ -cookbooks/cookbook1/metadata.rb -cookbooks/cookbook3/ -cookbooks/cookbook3/metadata.rb -data_bags/ -data_bags/bag/ -data_bags/bag/item.json -data_bags/bag3/ -data_bags/bag3/item3.json -environments/ -environments/env1.json -environments/env3.json -nodes/ -nodes/node1.json -nodes/node3.json -roles/ -roles/role1.json -roles/role3.json -users/ -users/user1.json -users/user3.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client1.json + clients/client3.json + cookbooks/ + cookbooks/cookbook1/ + cookbooks/cookbook1/metadata.rb + cookbooks/cookbook3/ + cookbooks/cookbook3/metadata.rb + data_bags/ + data_bags/bag/ + data_bags/bag/item.json + data_bags/bag3/ + data_bags/bag3/item3.json + environments/ + environments/env1.json + environments/env3.json + nodes/ + nodes/node1.json + nodes/node3.json + roles/ + roles/role1.json + roles/role3.json + users/ + users/user1.json + users/user3.json EOM end end @@ -625,11 +625,11 @@ EOM context "when cwd is inside the data_bags directory" do before { cwd "data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json -bag3/ -bag3/item3.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json + bag3/ + bag3/item3.json EOM end end @@ -637,32 +637,32 @@ EOM context "when cwd is inside chef_repo2" do before { cwd "chef_repo2" } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client1.json -clients/client3.json -cookbooks/ -cookbooks/cookbook1/ -cookbooks/cookbook1/metadata.rb -cookbooks/cookbook3/ -cookbooks/cookbook3/metadata.rb -data_bags/ -data_bags/bag/ -data_bags/bag/item.json -data_bags/bag3/ -data_bags/bag3/item3.json -environments/ -environments/env1.json -environments/env3.json -nodes/ -nodes/node1.json -nodes/node3.json -roles/ -roles/role1.json -roles/role3.json -users/ -users/user1.json -users/user3.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client1.json + clients/client3.json + cookbooks/ + cookbooks/cookbook1/ + cookbooks/cookbook1/metadata.rb + cookbooks/cookbook3/ + cookbooks/cookbook3/metadata.rb + data_bags/ + data_bags/bag/ + data_bags/bag/item.json + data_bags/bag3/ + data_bags/bag3/item3.json + environments/ + environments/env1.json + environments/env3.json + nodes/ + nodes/node1.json + nodes/node3.json + roles/ + roles/role1.json + roles/role3.json + users/ + users/user1.json + users/user3.json EOM end end @@ -670,11 +670,11 @@ EOM context "when cwd is inside chef_repo2/data_bags" do before { cwd "chef_repo2/data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json -bag3/ -bag3/item3.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json + bag3/ + bag3/item3.json EOM end end @@ -706,23 +706,23 @@ EOM context "when cwd is inside chef_repo2" do before { cwd "chef_repo2" } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client3.json -cookbooks/ -cookbooks/cookbook3/ -cookbooks/cookbook3/metadata.rb -data_bags/ -data_bags/bag3/ -data_bags/bag3/item3.json -environments/ -environments/env3.json -nodes/ -nodes/node3.json -roles/ -roles/role3.json -users/ -users/user3.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client3.json + cookbooks/ + cookbooks/cookbook3/ + cookbooks/cookbook3/metadata.rb + data_bags/ + data_bags/bag3/ + data_bags/bag3/item3.json + environments/ + environments/env3.json + nodes/ + nodes/node3.json + roles/ + roles/role3.json + users/ + users/user3.json EOM end end @@ -730,9 +730,9 @@ EOM context "when cwd is inside chef_repo2/data_bags" do before { cwd "chef_repo2/data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag3/ -bag3/item3.json + knife("list --local -Rfp").should_succeed <<~EOM + bag3/ + bag3/item3.json EOM end end @@ -753,32 +753,32 @@ EOM context "when cwd is at the top level" do before { cwd "." } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client1.json -clients/client3.json -cookbooks/ -cookbooks/cookbook1/ -cookbooks/cookbook1/metadata.rb -cookbooks/cookbook3/ -cookbooks/cookbook3/metadata.rb -data_bags/ -data_bags/bag/ -data_bags/bag/item.json -data_bags/bag3/ -data_bags/bag3/item3.json -environments/ -environments/env1.json -environments/env3.json -nodes/ -nodes/node1.json -nodes/node3.json -roles/ -roles/role1.json -roles/role3.json -users/ -users/user1.json -users/user3.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client1.json + clients/client3.json + cookbooks/ + cookbooks/cookbook1/ + cookbooks/cookbook1/metadata.rb + cookbooks/cookbook3/ + cookbooks/cookbook3/metadata.rb + data_bags/ + data_bags/bag/ + data_bags/bag/item.json + data_bags/bag3/ + data_bags/bag3/item3.json + environments/ + environments/env1.json + environments/env3.json + nodes/ + nodes/node1.json + nodes/node3.json + roles/ + roles/role1.json + roles/role3.json + users/ + users/user1.json + users/user3.json EOM end end @@ -786,11 +786,11 @@ EOM context "when cwd is inside the data_bags directory" do before { cwd "data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json -bag3/ -bag3/item3.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json + bag3/ + bag3/item3.json EOM end end @@ -798,32 +798,32 @@ EOM context "when cwd is inside chef_repo2" do before { cwd "chef_repo2" } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client1.json -clients/client3.json -cookbooks/ -cookbooks/cookbook1/ -cookbooks/cookbook1/metadata.rb -cookbooks/cookbook3/ -cookbooks/cookbook3/metadata.rb -data_bags/ -data_bags/bag/ -data_bags/bag/item.json -data_bags/bag3/ -data_bags/bag3/item3.json -environments/ -environments/env1.json -environments/env3.json -nodes/ -nodes/node1.json -nodes/node3.json -roles/ -roles/role1.json -roles/role3.json -users/ -users/user1.json -users/user3.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client1.json + clients/client3.json + cookbooks/ + cookbooks/cookbook1/ + cookbooks/cookbook1/metadata.rb + cookbooks/cookbook3/ + cookbooks/cookbook3/metadata.rb + data_bags/ + data_bags/bag/ + data_bags/bag/item.json + data_bags/bag3/ + data_bags/bag3/item3.json + environments/ + environments/env1.json + environments/env3.json + nodes/ + nodes/node1.json + nodes/node3.json + roles/ + roles/role1.json + roles/role3.json + users/ + users/user1.json + users/user3.json EOM end end @@ -831,11 +831,11 @@ EOM context "when cwd is inside chef_repo2/data_bags" do before { cwd "chef_repo2/data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json -bag3/ -bag3/item3.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json + bag3/ + bag3/item3.json EOM end end @@ -860,9 +860,9 @@ EOM context "when cwd is inside the data_bags directory" do before { cwd "data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json EOM end end @@ -870,23 +870,23 @@ EOM context "when cwd is inside chef_repo2" do before { cwd "chef_repo2" } it "knife list --local -Rfp lists everything" do - knife("list --local -Rfp").should_succeed <<EOM -clients/ -clients/client3.json -cookbooks/ -cookbooks/cookbook3/ -cookbooks/cookbook3/metadata.rb -data_bags/ -data_bags/bag/ -data_bags/bag/item.json -environments/ -environments/env3.json -nodes/ -nodes/node3.json -roles/ -roles/role3.json -users/ -users/user3.json + knife("list --local -Rfp").should_succeed <<~EOM + clients/ + clients/client3.json + cookbooks/ + cookbooks/cookbook3/ + cookbooks/cookbook3/metadata.rb + data_bags/ + data_bags/bag/ + data_bags/bag/item.json + environments/ + environments/env3.json + nodes/ + nodes/node3.json + roles/ + roles/role3.json + users/ + users/user3.json EOM end end @@ -911,26 +911,26 @@ EOM end it "knife list --local -Rfp / lists data bags" do - knife("list --local -Rfp /").should_succeed <<EOM -/data_bags/ -/data_bags/bag/ -/data_bags/bag/item.json + knife("list --local -Rfp /").should_succeed <<~EOM + /data_bags/ + /data_bags/bag/ + /data_bags/bag/item.json EOM end it "knife list --local -Rfp /data_bags lists data bags" do - knife("list --local -Rfp /data_bags").should_succeed <<EOM -/data_bags/bag/ -/data_bags/bag/item.json + knife("list --local -Rfp /data_bags").should_succeed <<~EOM + /data_bags/bag/ + /data_bags/bag/item.json EOM end context "when cwd is inside the data_bags directory" do before { cwd "data_bags" } it "knife list --local -Rfp lists data bags" do - knife("list --local -Rfp").should_succeed <<EOM -bag/ -bag/item.json + knife("list --local -Rfp").should_succeed <<~EOM + bag/ + bag/item.json EOM end end diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb index c9aa787bbe..538d6c5a63 100644 --- a/spec/integration/knife/chef_repository_file_system_spec.rb +++ b/spec/integration/knife/chef_repository_file_system_spec.rb @@ -32,11 +32,11 @@ describe "General chef_repo file system checks", :workstation do end it "knife list --local -Rfp / returns them" do - knife("list --local -Rfp /").should_succeed <<EOM -/data_bags/ -/data_bags/bag1/ -/environments/ -/roles/ + knife("list --local -Rfp /").should_succeed <<~EOM + /data_bags/ + /data_bags/bag1/ + /environments/ + /roles/ EOM end end @@ -53,8 +53,8 @@ EOM before { directory "cookbooks/cookbook1" } it "knife list --local -Rfp / does not return it" do - knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") -/cookbooks/ + knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") + /cookbooks/ EOM end end @@ -63,8 +63,8 @@ EOM before { directory "cookbooks/cookbook1/recipes" } it "knife list --local -Rfp / does not return it" do - knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") -/cookbooks/ + knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") + /cookbooks/ EOM end end @@ -76,12 +76,12 @@ EOM end it "knife list --local -Rfp / does not return the empty ones" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/templates/ -/cookbooks/cookbook1/templates/default/ -/cookbooks/cookbook1/templates/default/x.txt + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/templates/ + /cookbooks/cookbook1/templates/default/ + /cookbooks/cookbook1/templates/default/x.txt EOM end end @@ -90,8 +90,8 @@ EOM before { directory "cookbooks/cookbook1/templates/default" } it "knife list --local -Rfp / does not return it" do - knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") -/cookbooks/ + knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") + /cookbooks/ EOM end end @@ -104,12 +104,12 @@ EOM end it "knife list --local -Rfp / does not return the empty ones" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/templates/ -/cookbooks/cookbook1/templates/default/ -/cookbooks/cookbook1/templates/default/x.txt + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/templates/ + /cookbooks/cookbook1/templates/default/ + /cookbooks/cookbook1/templates/default/x.txt EOM end end @@ -146,14 +146,14 @@ EOM end it "knife list --local -Rfp / should NOT return them" do - knife("list --local -Rfp /").should_succeed <<EOM -/data_bags/ -/data_bags/bag1/ -/data_bags/bag1/item1.json -/environments/ -/environments/environment1.json -/roles/ -/roles/role1.json + knife("list --local -Rfp /").should_succeed <<~EOM + /data_bags/ + /data_bags/bag1/ + /data_bags/bag1/item1.json + /environments/ + /environments/environment1.json + /roles/ + /roles/role1.json EOM end end @@ -161,8 +161,8 @@ EOM when_the_repository "has a file in cookbooks/" do before { file "cookbooks/file", "" } it "does not show up in list -Rfp" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ EOM end end @@ -170,8 +170,8 @@ EOM when_the_repository "has a file in data_bags/" do before { file "data_bags/file", "" } it "does not show up in list -Rfp" do - knife("list --local -Rfp /").should_succeed <<EOM -/data_bags/ + knife("list --local -Rfp /").should_succeed <<~EOM + /data_bags/ EOM end end diff --git a/spec/integration/knife/chefignore_spec.rb b/spec/integration/knife/chefignore_spec.rb index e3f1e18f7e..eb36f4675f 100644 --- a/spec/integration/knife/chefignore_spec.rb +++ b/spec/integration/knife/chefignore_spec.rb @@ -45,17 +45,17 @@ describe "chefignore tests", :workstation do it "matching files and directories get ignored" do # NOTE: many of the "chefignore" files should probably not show up # themselves, but we have other tests that talk about that - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/chefignore -/data_bags/ -/data_bags/bag1/ -/data_bags/bag1/x.json -/environments/ -/environments/x.json -/roles/ -/roles/x.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/chefignore + /data_bags/ + /data_bags/bag1/ + /data_bags/bag1/x.json + /environments/ + /environments/x.json + /roles/ + /roles/x.json EOM end end @@ -69,8 +69,8 @@ EOM end it "the cookbook is not listed" do - knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") -/cookbooks/ + knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") + /cookbooks/ EOM end end @@ -87,12 +87,12 @@ EOM before { file "cookbooks/chefignore", "x.json\n" } it "matching files and directories get ignored in all cookbooks" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/y.json -/cookbooks/cookbook2/ -/cookbooks/cookbook2/y.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/y.json + /cookbooks/cookbook2/ + /cookbooks/cookbook2/y.json EOM end end @@ -104,12 +104,12 @@ EOM end it "matching files and directories get ignored in all cookbooks" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/y.json -/cookbooks/cookbook2/ -/cookbooks/cookbook2/y.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/y.json + /cookbooks/cookbook2/ + /cookbooks/cookbook2/y.json EOM end end @@ -122,16 +122,16 @@ EOM end it "matching directories get ignored" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/x.json -/cookbooks/cookbook1/y.json -/cookbooks/cookbook2/ -/cookbooks/cookbook2/recipes/ -/cookbooks/cookbook2/recipes/y.rb -/cookbooks/cookbook2/x.json -/cookbooks/cookbook2/y.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/x.json + /cookbooks/cookbook1/y.json + /cookbooks/cookbook2/ + /cookbooks/cookbook2/recipes/ + /cookbooks/cookbook2/recipes/y.rb + /cookbooks/cookbook2/x.json + /cookbooks/cookbook2/y.json EOM end end @@ -143,16 +143,16 @@ EOM end it "matching directories do NOT get ignored" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/recipes/ -/cookbooks/cookbook1/recipes/y.rb -/cookbooks/cookbook1/x.json -/cookbooks/cookbook1/y.json -/cookbooks/cookbook2/ -/cookbooks/cookbook2/x.json -/cookbooks/cookbook2/y.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/recipes/ + /cookbooks/cookbook1/recipes/y.rb + /cookbooks/cookbook1/x.json + /cookbooks/cookbook1/y.json + /cookbooks/cookbook2/ + /cookbooks/cookbook2/x.json + /cookbooks/cookbook2/y.json EOM end end @@ -165,14 +165,14 @@ EOM end it "ignores the subdirectory entirely" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/x.json -/cookbooks/cookbook1/y.json -/cookbooks/cookbook2/ -/cookbooks/cookbook2/x.json -/cookbooks/cookbook2/y.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/x.json + /cookbooks/cookbook1/y.json + /cookbooks/cookbook2/ + /cookbooks/cookbook2/x.json + /cookbooks/cookbook2/y.json EOM end end @@ -183,14 +183,14 @@ EOM end it "nothing is ignored" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/x.json -/cookbooks/cookbook1/y.json -/cookbooks/cookbook2/ -/cookbooks/cookbook2/x.json -/cookbooks/cookbook2/y.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/x.json + /cookbooks/cookbook1/y.json + /cookbooks/cookbook2/ + /cookbooks/cookbook2/x.json + /cookbooks/cookbook2/y.json EOM end end @@ -201,12 +201,12 @@ EOM end it "matching files and directories get ignored in all cookbooks" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/y.json -/cookbooks/cookbook2/ -/cookbooks/cookbook2/y.json + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/y.json + /cookbooks/cookbook2/ + /cookbooks/cookbook2/y.json EOM end end @@ -233,12 +233,12 @@ EOM file "cookbooks2/chefignore", "x.json\n" end it "chefignores apply only to the directories they are in" do - knife("list --local -Rfp /").should_succeed <<EOM -/cookbooks/ -/cookbooks/mycookbook/ -/cookbooks/mycookbook/x.json -/cookbooks/yourcookbook/ -/cookbooks/yourcookbook/metadata.rb + knife("list --local -Rfp /").should_succeed <<~EOM + /cookbooks/ + /cookbooks/mycookbook/ + /cookbooks/mycookbook/x.json + /cookbooks/yourcookbook/ + /cookbooks/yourcookbook/metadata.rb EOM end @@ -251,13 +251,13 @@ EOM end it "chefignores apply only to the winning cookbook" do - knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Child with name 'yourcookbook' found in multiple directories: #{Chef::Config.chef_repo_path}/cookbooks1/yourcookbook and #{Chef::Config.chef_repo_path}/cookbooks2/yourcookbook\n") -/cookbooks/ -/cookbooks/mycookbook/ -/cookbooks/mycookbook/x.json -/cookbooks/yourcookbook/ -/cookbooks/yourcookbook/onlyincookbooks1.rb -/cookbooks/yourcookbook/x.json + knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Child with name 'yourcookbook' found in multiple directories: #{Chef::Config.chef_repo_path}/cookbooks1/yourcookbook and #{Chef::Config.chef_repo_path}/cookbooks2/yourcookbook\n") + /cookbooks/ + /cookbooks/mycookbook/ + /cookbooks/mycookbook/x.json + /cookbooks/yourcookbook/ + /cookbooks/yourcookbook/onlyincookbooks1.rb + /cookbooks/yourcookbook/x.json EOM end end @@ -269,9 +269,9 @@ EOM file "cookbooks/chefignore/metadata.rb", {} end it "knife list -Rfp /cookbooks shows it" do - knife("list --local -Rfp /cookbooks").should_succeed <<EOM -/cookbooks/chefignore/ -/cookbooks/chefignore/metadata.rb + knife("list --local -Rfp /cookbooks").should_succeed <<~EOM + /cookbooks/chefignore/ + /cookbooks/chefignore/metadata.rb EOM end end @@ -289,11 +289,11 @@ EOM ] end it "knife list -Rfp /cookbooks shows the chefignore cookbook" do - knife("list --local -Rfp /cookbooks").should_succeed <<EOM -/cookbooks/blah/ -/cookbooks/blah/metadata.rb -/cookbooks/chefignore/ -/cookbooks/chefignore/metadata.rb + knife("list --local -Rfp /cookbooks").should_succeed <<~EOM + /cookbooks/blah/ + /cookbooks/blah/metadata.rb + /cookbooks/chefignore/ + /cookbooks/chefignore/metadata.rb EOM end end diff --git a/spec/integration/knife/client_bulk_delete_spec.rb b/spec/integration/knife/client_bulk_delete_spec.rb index a422401af6..336852c0b8 100644 --- a/spec/integration/knife/client_bulk_delete_spec.rb +++ b/spec/integration/knife/client_bulk_delete_spec.rb @@ -33,40 +33,40 @@ describe "knife client bulk delete", :workstation do end it "deletes all matching clients" do - knife("client bulk delete ^ca.*", input: "Y").should_succeed <<EOM -The following clients will be deleted: - -car cat - -Are you sure you want to delete these clients? (Y/N) Deleted client car -Deleted client cat + knife("client bulk delete ^ca.*", input: "Y").should_succeed <<~EOM + The following clients will be deleted: + + car cat + + Are you sure you want to delete these clients? (Y/N) Deleted client car + Deleted client cat EOM - knife("client list").should_succeed <<EOM -cdr -chef-validator -chef-webui -concat -cons + knife("client list").should_succeed <<~EOM + cdr + chef-validator + chef-webui + concat + cons EOM end it "deletes all matching clients when unanchored" do - knife("client bulk delete ca.*", input: "Y").should_succeed <<EOM -The following clients will be deleted: - -car cat concat - -Are you sure you want to delete these clients? (Y/N) Deleted client car -Deleted client cat -Deleted client concat + knife("client bulk delete ca.*", input: "Y").should_succeed <<~EOM + The following clients will be deleted: + + car cat concat + + Are you sure you want to delete these clients? (Y/N) Deleted client car + Deleted client cat + Deleted client concat EOM - knife("client list").should_succeed <<EOM -cdr -chef-validator -chef-webui -cons + knife("client list").should_succeed <<~EOM + cdr + chef-validator + chef-webui + cons EOM end end @@ -81,49 +81,49 @@ EOM end it "refuses to delete a validator normally" do - knife("client bulk delete ^ca.*", input: "Y").should_succeed <<EOM -The following clients are validators and will not be deleted: - -car-validator - -You must specify --delete-validators to delete the validator clients -The following clients will be deleted: - -car cat - -Are you sure you want to delete these clients? (Y/N) Deleted client car -Deleted client cat + knife("client bulk delete ^ca.*", input: "Y").should_succeed <<~EOM + The following clients are validators and will not be deleted: + + car-validator + + You must specify --delete-validators to delete the validator clients + The following clients will be deleted: + + car cat + + Are you sure you want to delete these clients? (Y/N) Deleted client car + Deleted client cat EOM - knife("client list").should_succeed <<EOM -car-validator -cdr -chef-validator -chef-webui -cons + knife("client list").should_succeed <<~EOM + car-validator + cdr + chef-validator + chef-webui + cons EOM end it "deletes a validator when told to" do - knife("client bulk delete ^ca.* -D", input: "Y\nY").should_succeed <<EOM -The following validators will be deleted: - -car-validator - -Are you sure you want to delete these validators? (Y/N) Deleted client car-validator -The following clients will be deleted: - -car cat - -Are you sure you want to delete these clients? (Y/N) Deleted client car -Deleted client cat + knife("client bulk delete ^ca.* -D", input: "Y\nY").should_succeed <<~EOM + The following validators will be deleted: + + car-validator + + Are you sure you want to delete these validators? (Y/N) Deleted client car-validator + The following clients will be deleted: + + car cat + + Are you sure you want to delete these clients? (Y/N) Deleted client car + Deleted client cat EOM - knife("client list").should_succeed <<EOM -cdr -chef-validator -chef-webui -cons + knife("client list").should_succeed <<~EOM + cdr + chef-validator + chef-webui + cons EOM end end diff --git a/spec/integration/knife/client_create_spec.rb b/spec/integration/knife/client_create_spec.rb index 10172833c8..d24755a48a 100644 --- a/spec/integration/knife/client_create_spec.rb +++ b/spec/integration/knife/client_create_spec.rb @@ -33,11 +33,11 @@ describe "knife client create", :workstation do it "creates a new validator client" do knife("client create -k --validator bah").should_succeed stderr: out - knife("client show bah").should_succeed <<EOM -admin: false -chef_type: client -name: bah -validator: true + knife("client show bah").should_succeed <<~EOM + admin: false + chef_type: client + name: bah + validator: true EOM end diff --git a/spec/integration/knife/client_delete_spec.rb b/spec/integration/knife/client_delete_spec.rb index d135dd0a5b..914827cb46 100644 --- a/spec/integration/knife/client_delete_spec.rb +++ b/spec/integration/knife/client_delete_spec.rb @@ -33,29 +33,29 @@ describe "knife client delete", :workstation do end it "deletes a client" do - knife("client delete car", input: "Y").should_succeed <<EOM -Do you really want to delete car? (Y/N) Deleted client[car] + knife("client delete car", input: "Y").should_succeed <<~EOM + Do you really want to delete car? (Y/N) Deleted client[car] EOM - knife("client list").should_succeed <<EOM -car-validator -cat -cdr -chef-validator -chef-webui -cons + knife("client list").should_succeed <<~EOM + car-validator + cat + cdr + chef-validator + chef-webui + cons EOM end it "refuses to delete a validator normally" do - knife("client delete car-validator", input: "Y").should_fail exit_code: 2, stdout: "Do you really want to delete car-validator? (Y/N) ", stderr: <<EOM -FATAL: You must specify --delete-validators to delete the validator client car-validator + knife("client delete car-validator", input: "Y").should_fail exit_code: 2, stdout: "Do you really want to delete car-validator? (Y/N) ", stderr: <<~EOM + FATAL: You must specify --delete-validators to delete the validator client car-validator EOM end it "deletes a validator correctly" do - knife("client delete car-validator -D", input: "Y").should_succeed <<EOM -Do you really want to delete car-validator? (Y/N) Deleted client[car-validator] + knife("client delete car-validator -D", input: "Y").should_succeed <<~EOM + Do you really want to delete car-validator? (Y/N) Deleted client[car-validator] EOM end diff --git a/spec/integration/knife/client_key_delete_spec.rb b/spec/integration/knife/client_key_delete_spec.rb index d5827aa545..061a3fea76 100644 --- a/spec/integration/knife/client_key_delete_spec.rb +++ b/spec/integration/knife/client_key_delete_spec.rb @@ -31,8 +31,8 @@ describe "knife client key delete", :workstation do it "deletes a client" do out = "Do you really want to delete the key named new for the client named car? (Y/N) " knife("client key create -k new car") - knife("client key delete car new", input: "Y").should_succeed stdout: out, stderr: <<EOM -Deleted key named new for the client named car + knife("client key delete car new", input: "Y").should_succeed stdout: out, stderr: <<~EOM + Deleted key named new for the client named car EOM knife("client key list car").should_succeed "" diff --git a/spec/integration/knife/client_key_list_spec.rb b/spec/integration/knife/client_key_list_spec.rb index de9894622e..0969d5fb98 100644 --- a/spec/integration/knife/client_key_list_spec.rb +++ b/spec/integration/knife/client_key_list_spec.rb @@ -41,10 +41,10 @@ describe "knife client key list", :workstation do end it "shows detailed output" do - knife("client key list -w cons").should_succeed <<EOM -expired: http://127.0.0.1:8900/clients/cons/keys/expired (expired) -new: http://127.0.0.1:8900/clients/cons/keys/new -next_month: http://127.0.0.1:8900/clients/cons/keys/next_month + knife("client key list -w cons").should_succeed <<~EOM + expired: http://127.0.0.1:8900/clients/cons/keys/expired (expired) + new: http://127.0.0.1:8900/clients/cons/keys/new + next_month: http://127.0.0.1:8900/clients/cons/keys/next_month EOM end diff --git a/spec/integration/knife/client_list_spec.rb b/spec/integration/knife/client_list_spec.rb index 4159df73f1..41cf8dcbb6 100644 --- a/spec/integration/knife/client_list_spec.rb +++ b/spec/integration/knife/client_list_spec.rb @@ -33,14 +33,14 @@ describe "knife client list", :workstation do end it "lists the clients" do - knife("client list").should_succeed <<EOM -car -car-validator -cat -cdr -chef-validator -chef-webui -cons + knife("client list").should_succeed <<~EOM + car + car-validator + cat + cdr + chef-validator + chef-webui + cons EOM end diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb index 0b090f170e..e0622eb801 100644 --- a/spec/integration/knife/common_options_spec.rb +++ b/spec/integration/knife/common_options_spec.rb @@ -67,34 +67,34 @@ describe "knife common options", :workstation do context "and there is a private key" do before do - file "mykey.pem", <<EOM ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf -0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk -NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn -0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O -AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP -HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom -8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB -zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx -k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb -i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ -G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV -ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL -awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK -7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns -g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr -Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy -HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 -V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO -fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN -lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr -c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo -fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV -YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL -syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T -+vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= ------END RSA PRIVATE KEY----- + file "mykey.pem", <<~EOM + -----BEGIN RSA PRIVATE KEY----- + MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf + 0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk + NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn + 0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O + AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP + HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom + 8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB + zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx + k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb + i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ + G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV + ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL + awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK + 7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns + g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr + Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy + HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 + V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO + fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN + lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr + c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo + fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV + YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL + syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T + +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= + -----END RSA PRIVATE KEY----- EOM end diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb index 434210c01e..8c2b0208ae 100644 --- a/spec/integration/knife/cookbook_api_ipv6_spec.rb +++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb @@ -26,34 +26,34 @@ describe "Knife cookbook API integration with IPv6", :workstation, :not_supporte let(:chef_zero_opts) { { host: "::1" } } let(:client_key) do - <<-END_VALIDATION_PEM ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf -0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk -NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn -0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O -AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP -HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom -8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB -zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx -k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb -i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ -G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV -ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL -awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK -7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns -g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr -Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy -HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 -V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO -fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN -lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr -c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo -fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV -YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL -syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T -+vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= ------END RSA PRIVATE KEY----- + <<~END_VALIDATION_PEM + -----BEGIN RSA PRIVATE KEY----- + MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf + 0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk + NftHhTgO9/RFvCbmKZ1RKNob1YzLrFpxBHaSh9po+DGWhApcd+I+op+ZzvDgXhNn + 0nauZu3rZmApI/r7EEAOjFedAXs7VPNXhhtZAiLSAVIrwU3ZajtSzgXOxbNzgj5O + AAAMmThK+71qPdffAdO4J198H6/MY04qgtFo7vumzCq0UCaGZfmeI1UNE4+xQWwP + HJ3pDAP61C6Ebx2snI2kAd9QMx9Y78nIedRHPwIDAQABAoIBAHssRtPM1GacWsom + 8zfeN6ZbI4KDlbetZz0vhnqDk9NVrpijWlcOP5dwZXVNitnB/HaqCqFvyPDY9JNB + zI/pEFW4QH59FVDP42mVEt0keCTP/1wfiDDGh1vLqVBYl/ZphscDcNgDTzNkuxMx + k+LFVxKnn3w7rGc59lALSkpeGvbbIDjp3LUMlUeCF8CIFyYZh9ZvXe4OCxYdyjxb + i8tnMLKvJ4Psbh5jMapsu3rHQkfPdqzztQUz8vs0NYwP5vWge46FUyk+WNm/IhbJ + G3YM22nwUS8Eu2bmTtADSJolATbCSkOwQ1D+Fybz/4obfYeGaCdOqB05ttubhenV + ShsAb7ECgYEA20ecRVxw2S7qA7sqJ4NuYOg9TpfGooptYNA1IP971eB6SaGAelEL + awYkGNuu2URmm5ElZpwJFFTDLGA7t2zB2xI1FeySPPIVPvJGSiZoFQOVlIg9WQzK + 7jTtFQ/tOMrF+bigEUJh5bP1/7HzqSpuOsPjEUb2aoCTp+tpiRGL7TUCgYEAwtns + g3ysrSEcTzpSv7fQRJRk1lkBhatgNd0oc+ikzf74DaVLhBg1jvSThDhiDCdB59mr + Jh41cnR1XqE8jmdQbCDRiFrI1Pq6TPaDZFcovDVE1gue9x86v3FOH2ukPG4d2/Xy + HevXjThtpMMsWFi0JYXuzXuV5HOvLZiP8sN3lSMCgYANpdxdGM7RRbE9ADY0dWK2 + V14ReTLcxP7fyrWz0xLzEeCqmomzkz3BsIUoouu0DCTSw+rvAwExqcDoDylIVlWO + fAifz7SeZHbcDxo+3TsXK7zwnLYsx7YNs2+aIv6hzUUbMNmNmXMcZ+IEwx+mRMTN + lYmZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr + c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo + fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV + YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL + syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T + +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= + -----END RSA PRIVATE KEY----- END_VALIDATION_PEM end @@ -74,12 +74,12 @@ END_VALIDATION_PEM when_the_repository "has the cookbook to be uploaded" do let(:knife_rb_content) do - <<-END_CLIENT_RB -chef_server_url "http://[::1]:8900" -syntax_check_cache_path '#{cache_path}' -client_key '#{path_to('config/knifeuser.pem')}' -node_name 'whoisthisis' -cookbook_path '#{CHEF_SPEC_DATA}/cookbooks' + <<~END_CLIENT_RB + chef_server_url "http://[::1]:8900" + syntax_check_cache_path '#{cache_path}' + client_key '#{path_to('config/knifeuser.pem')}' + node_name 'whoisthisis' + cookbook_path '#{CHEF_SPEC_DATA}/cookbooks' END_CLIENT_RB end diff --git a/spec/integration/knife/cookbook_bulk_delete_spec.rb b/spec/integration/knife/cookbook_bulk_delete_spec.rb index 912bd3bed5..d3180c788f 100644 --- a/spec/integration/knife/cookbook_bulk_delete_spec.rb +++ b/spec/integration/knife/cookbook_bulk_delete_spec.rb @@ -36,26 +36,26 @@ describe "knife cookbook bulk delete", :workstation do # rubocop:disable Layout/TrailingWhitespace it "knife cookbook bulk delete deletes all matching cookbooks" do - stdout = <<EOM -All versions of the following cookbooks will be deleted: - -foo fox - -Do you really want to delete these cookbooks? (Y/N) + stdout = <<~EOM + All versions of the following cookbooks will be deleted: + + foo fox + + Do you really want to delete these cookbooks? (Y/N) EOM - stderr = <<EOM -Deleted cookbook foo [1.0.0] -Deleted cookbook foo [0.6.5] -Deleted cookbook fox [0.6.5] -Deleted cookbook fox [0.6.0] + stderr = <<~EOM + Deleted cookbook foo [1.0.0] + Deleted cookbook foo [0.6.5] + Deleted cookbook fox [0.6.5] + Deleted cookbook fox [0.6.0] EOM knife("cookbook bulk delete ^fo.*", input: "Y").should_succeed(stderr: stderr, stdout: stdout) - knife("cookbook list -a").should_succeed <<EOM -fax 0.6.0 -zfa 0.6.5 + knife("cookbook list -a").should_succeed <<~EOM + fax 0.6.0 + zfa 0.6.5 EOM end # rubocop:enable Layout/TrailingWhitespace diff --git a/spec/integration/knife/cookbook_download_spec.rb b/spec/integration/knife/cookbook_download_spec.rb index 2e64cac133..57174a1548 100644 --- a/spec/integration/knife/cookbook_download_spec.rb +++ b/spec/integration/knife/cookbook_download_spec.rb @@ -33,18 +33,18 @@ describe "knife cookbook download", :workstation do end it "knife cookbook download downloads the latest version" do - knife("cookbook download -d #{tmpdir} x").should_succeed stderr: <<EOM -Downloading x cookbook version 1.0.1 -Downloading root_files -Cookbook downloaded to #{tmpdir}/x-1.0.1 + knife("cookbook download -d #{tmpdir} x").should_succeed stderr: <<~EOM + Downloading x cookbook version 1.0.1 + Downloading root_files + Cookbook downloaded to #{tmpdir}/x-1.0.1 EOM end it "knife cookbook download with a version downloads the specified version" do - knife("cookbook download -d #{tmpdir} x 1.0.1").should_succeed stderr: <<EOM -Downloading x cookbook version 1.0.1 -Downloading root_files -Cookbook downloaded to #{tmpdir}/x-1.0.1 + knife("cookbook download -d #{tmpdir} x 1.0.1").should_succeed stderr: <<~EOM + Downloading x cookbook version 1.0.1 + Downloading root_files + Cookbook downloaded to #{tmpdir}/x-1.0.1 EOM end @@ -60,10 +60,10 @@ EOM end it "knife cookbook download with no version prompts" do - knife("cookbook download -d #{tmpdir} x", input: "2\n").should_succeed(stderr: <<EOM, stdout: "Which version do you want to download?\n1. x 1.0.0\n2. x 1.0.1\n\n" -Downloading x cookbook version 1.0.1 -Downloading root_files -Cookbook downloaded to #{tmpdir}/x-1.0.1 + knife("cookbook download -d #{tmpdir} x", input: "2\n").should_succeed(stderr: <<~EOM, stdout: "Which version do you want to download?\n1. x 1.0.0\n2. x 1.0.1\n\n" + Downloading x cookbook version 1.0.1 + Downloading root_files + Cookbook downloaded to #{tmpdir}/x-1.0.1 EOM ) end diff --git a/spec/integration/knife/cookbook_list_spec.rb b/spec/integration/knife/cookbook_list_spec.rb index 65578696f2..afea745bce 100644 --- a/spec/integration/knife/cookbook_list_spec.rb +++ b/spec/integration/knife/cookbook_list_spec.rb @@ -35,18 +35,18 @@ describe "knife cookbook list", :workstation do end it "knife cookbook list shows all the cookbooks" do - knife("cookbook list").should_succeed <<EOM -x 1.0.0 -y 0.6.5 -z 0.6.5 + knife("cookbook list").should_succeed <<~EOM + x 1.0.0 + y 0.6.5 + z 0.6.5 EOM end it "knife cookbook list -a shows all the versions of all the cookbooks" do - knife("cookbook list -a").should_succeed <<EOM -x 1.0.0 0.6.5 0.6.0 -y 0.6.5 0.6.0 -z 0.6.5 + knife("cookbook list -a").should_succeed <<~EOM + x 1.0.0 0.6.5 0.6.0 + y 0.6.5 0.6.0 + z 0.6.5 EOM end diff --git a/spec/integration/knife/cookbook_show_spec.rb b/spec/integration/knife/cookbook_show_spec.rb index b89a26198a..fe7e6fa930 100644 --- a/spec/integration/knife/cookbook_show_spec.rb +++ b/spec/integration/knife/cookbook_show_spec.rb @@ -36,95 +36,95 @@ describe "knife cookbook show", :workstation do # rubocop:disable Layout/TrailingWhitespace it "knife cookbook show x 1.0.0 shows the correct version" do - knife("cookbook show x 1.0.0").should_succeed <<EOM -cookbook_name: x -frozen?: false -metadata: - attributes: - chef_versions: - dependencies: - description: - gems: - issues_url: - license: All rights reserved - long_description: - maintainer: - maintainer_email: - name: x - ohai_versions: - platforms: - privacy: false - providing: - x: >= 0.0.0 - x::x: >= 0.0.0 - recipes: - x: - x::x: - source_url: - version: 1.0.0 -name: x-1.0.0 -recipes: - checksum: 4631b34cf58de10c5ef1304889941b2e - name: recipes/default.rb - path: recipes/default.rb - specificity: default - url: http://127.0.0.1:8900/file_store/checksums/4631b34cf58de10c5ef1304889941b2e - - checksum: d41d8cd98f00b204e9800998ecf8427e - name: recipes/x.rb - path: recipes/x.rb - specificity: default - url: http://127.0.0.1:8900/file_store/checksums/d41d8cd98f00b204e9800998ecf8427e -root_files: - checksum: 8226671f751ba102dea6a6b6bd32fa8d - name: metadata.rb - path: metadata.rb - specificity: default - url: http://127.0.0.1:8900/file_store/checksums/8226671f751ba102dea6a6b6bd32fa8d -version: 1.0.0 + knife("cookbook show x 1.0.0").should_succeed <<~EOM + cookbook_name: x + frozen?: false + metadata: + attributes: + chef_versions: + dependencies: + description: + gems: + issues_url: + license: All rights reserved + long_description: + maintainer: + maintainer_email: + name: x + ohai_versions: + platforms: + privacy: false + providing: + x: >= 0.0.0 + x::x: >= 0.0.0 + recipes: + x: + x::x: + source_url: + version: 1.0.0 + name: x-1.0.0 + recipes: + checksum: 4631b34cf58de10c5ef1304889941b2e + name: recipes/default.rb + path: recipes/default.rb + specificity: default + url: http://127.0.0.1:8900/file_store/checksums/4631b34cf58de10c5ef1304889941b2e + + checksum: d41d8cd98f00b204e9800998ecf8427e + name: recipes/x.rb + path: recipes/x.rb + specificity: default + url: http://127.0.0.1:8900/file_store/checksums/d41d8cd98f00b204e9800998ecf8427e + root_files: + checksum: 8226671f751ba102dea6a6b6bd32fa8d + name: metadata.rb + path: metadata.rb + specificity: default + url: http://127.0.0.1:8900/file_store/checksums/8226671f751ba102dea6a6b6bd32fa8d + version: 1.0.0 EOM end it "knife cookbook show x 1.0.0 metadata shows the metadata" do - knife("cookbook show x 1.0.0 metadata").should_succeed <<EOM -attributes: -chef_versions: -dependencies: -description: -gems: -issues_url: -license: All rights reserved -long_description: -maintainer: -maintainer_email: -name: x -ohai_versions: -platforms: -privacy: false -providing: - x: >= 0.0.0 - x::x: >= 0.0.0 -recipes: - x: - x::x: -source_url: -version: 1.0.0 + knife("cookbook show x 1.0.0 metadata").should_succeed <<~EOM + attributes: + chef_versions: + dependencies: + description: + gems: + issues_url: + license: All rights reserved + long_description: + maintainer: + maintainer_email: + name: x + ohai_versions: + platforms: + privacy: false + providing: + x: >= 0.0.0 + x::x: >= 0.0.0 + recipes: + x: + x::x: + source_url: + version: 1.0.0 EOM end it "knife cookbook show x 1.0.0 recipes shows all the recipes" do - knife("cookbook show x 1.0.0 recipes").should_succeed <<EOM -checksum: 4631b34cf58de10c5ef1304889941b2e -name: recipes/default.rb -path: recipes/default.rb -specificity: default -url: http://127.0.0.1:8900/file_store/checksums/4631b34cf58de10c5ef1304889941b2e - -checksum: d41d8cd98f00b204e9800998ecf8427e -name: recipes/x.rb -path: recipes/x.rb -specificity: default -url: http://127.0.0.1:8900/file_store/checksums/d41d8cd98f00b204e9800998ecf8427e + knife("cookbook show x 1.0.0 recipes").should_succeed <<~EOM + checksum: 4631b34cf58de10c5ef1304889941b2e + name: recipes/default.rb + path: recipes/default.rb + specificity: default + url: http://127.0.0.1:8900/file_store/checksums/4631b34cf58de10c5ef1304889941b2e + + checksum: d41d8cd98f00b204e9800998ecf8427e + name: recipes/x.rb + path: recipes/x.rb + specificity: default + url: http://127.0.0.1:8900/file_store/checksums/d41d8cd98f00b204e9800998ecf8427e EOM end # rubocop:enable Layout/TrailingWhitespace diff --git a/spec/integration/knife/cookbook_upload_spec.rb b/spec/integration/knife/cookbook_upload_spec.rb index a0de725603..e96884e786 100644 --- a/spec/integration/knife/cookbook_upload_spec.rb +++ b/spec/integration/knife/cookbook_upload_spec.rb @@ -33,24 +33,24 @@ describe "knife cookbook upload", :workstation do end it "knife cookbook upload uploads the cookbook" do - knife("cookbook upload x -o #{cb_dir}").should_succeed stderr: <<EOM -Uploading x [1.0.0] -Uploaded 1 cookbook. + knife("cookbook upload x -o #{cb_dir}").should_succeed stderr: <<~EOM + Uploading x [1.0.0] + Uploaded 1 cookbook. EOM end it "knife cookbook upload --freeze uploads and freezes the cookbook" do - knife("cookbook upload x -o #{cb_dir} --freeze").should_succeed stderr: <<EOM -Uploading x [1.0.0] -Uploaded 1 cookbook. + knife("cookbook upload x -o #{cb_dir} --freeze").should_succeed stderr: <<~EOM + Uploading x [1.0.0] + Uploaded 1 cookbook. EOM # Modify the file, attempt to reupload file "cookbooks/x/metadata.rb", 'name "x"; version "1.0.0"#different' - knife("cookbook upload x -o #{cb_dir} --freeze").should_fail stderr: <<EOM -Uploading x [1.0.0] -ERROR: Version 1.0.0 of cookbook x is frozen. Use --force to override. -WARNING: Not updating version constraints for x in the environment as the cookbook is frozen. -ERROR: Failed to upload 1 cookbook. + knife("cookbook upload x -o #{cb_dir} --freeze").should_fail stderr: <<~EOM + Uploading x [1.0.0] + ERROR: Version 1.0.0 of cookbook x is frozen. Use --force to override. + WARNING: Not updating version constraints for x in the environment as the cookbook is frozen. + ERROR: Failed to upload 1 cookbook. EOM end end @@ -62,27 +62,27 @@ EOM end it "knife cookbook upload --include-dependencies uploads both cookbooks" do - knife("cookbook upload --include-dependencies x -o #{cb_dir}").should_succeed stderr: <<EOM -Uploading x [1.0.0] -Uploading y [1.0.0] -Uploaded 2 cookbooks. + knife("cookbook upload --include-dependencies x -o #{cb_dir}").should_succeed stderr: <<~EOM + Uploading x [1.0.0] + Uploading y [1.0.0] + Uploaded 2 cookbooks. EOM end it "knife cookbook upload fails due to missing dependencies" do - knife("cookbook upload x -o #{cb_dir}").should_fail stderr: <<EOM -Uploading x [1.0.0] -ERROR: Cookbook x depends on cookbooks which are not currently -ERROR: being uploaded and cannot be found on the server. -ERROR: The missing cookbook(s) are: 'y' version '>= 0.0.0' + knife("cookbook upload x -o #{cb_dir}").should_fail stderr: <<~EOM + Uploading x [1.0.0] + ERROR: Cookbook x depends on cookbooks which are not currently + ERROR: being uploaded and cannot be found on the server. + ERROR: The missing cookbook(s) are: 'y' version '>= 0.0.0' EOM end it "knife cookbook upload -a uploads both cookbooks" do - knife("cookbook upload -a -o #{cb_dir}").should_succeed stderr: <<EOM -Uploading x [1.0.0] -Uploading y [1.0.0] -Uploaded all cookbooks. + knife("cookbook upload -a -o #{cb_dir}").should_succeed stderr: <<~EOM + Uploading x [1.0.0] + Uploading y [1.0.0] + Uploaded all cookbooks. EOM end end diff --git a/spec/integration/knife/data_bag_delete_spec.rb b/spec/integration/knife/data_bag_delete_spec.rb index 96345b0d2b..f0ca05a3e4 100644 --- a/spec/integration/knife/data_bag_delete_spec.rb +++ b/spec/integration/knife/data_bag_delete_spec.rb @@ -32,26 +32,26 @@ describe "knife data bag delete", :workstation do end it "with an empty data bag" do - knife("data bag delete canteloupe", input: "y").should_succeed <<EOM -Do you really want to delete canteloupe? (Y/N) Deleted data_bag[canteloupe] + knife("data bag delete canteloupe", input: "y").should_succeed <<~EOM + Do you really want to delete canteloupe? (Y/N) Deleted data_bag[canteloupe] EOM end it "with a bag with some items" do - knife("data bag delete rocket", input: "y").should_succeed <<EOM -Do you really want to delete rocket? (Y/N) Deleted data_bag[rocket] + knife("data bag delete rocket", input: "y").should_succeed <<~EOM + Do you really want to delete rocket? (Y/N) Deleted data_bag[rocket] EOM end it "with a single item" do - knife("data bag delete rocket falcon9", input: "y").should_succeed <<EOM -Do you really want to delete falcon9? (Y/N) Deleted data_bag_item[falcon9] + knife("data bag delete rocket falcon9", input: "y").should_succeed <<~EOM + Do you really want to delete falcon9? (Y/N) Deleted data_bag_item[falcon9] EOM end it "choosing not to delete" do - knife("data bag delete rocket falcon9", input: "n").should_succeed <<EOM, exit_code: 3 -Do you really want to delete falcon9? (Y/N) You said no, so I'm done here. + knife("data bag delete rocket falcon9", input: "n").should_succeed <<~EOM, exit_code: 3 + Do you really want to delete falcon9? (Y/N) You said no, so I'm done here. EOM end end diff --git a/spec/integration/knife/data_bag_from_file_spec.rb b/spec/integration/knife/data_bag_from_file_spec.rb index ca8f743487..afaafc1e6b 100644 --- a/spec/integration/knife/data_bag_from_file_spec.rb +++ b/spec/integration/knife/data_bag_from_file_spec.rb @@ -37,76 +37,76 @@ describe "knife data bag from file", :workstation do file "data_bags/foo/bzr.json", { "id" => "bzr", "foo" => "bar " } file "data_bags/foo/cat.json", { "id" => "cat", "foo" => "bar " } file "data_bags/foo/dog.json", { "id" => "dog", "foo" => "bar " } - file "data_bags/foo/encrypted.json", <<EOM -{ - "id": "encrypted", - "password": { - "encrypted_data": "H6ab5RY9a9JAkS8A0RCMspXtOJh0ai8cNeA4Q3gLO8s=\\n", - "iv": "uWKKKxrJgtELlGMCOLJdkA==\\n", - "version": 1, - "cipher": "aes-256-cbc" - } -} + file "data_bags/foo/encrypted.json", <<~EOM + { + "id": "encrypted", + "password": { + "encrypted_data": "H6ab5RY9a9JAkS8A0RCMspXtOJh0ai8cNeA4Q3gLO8s=\\n", + "iv": "uWKKKxrJgtELlGMCOLJdkA==\\n", + "version": 1, + "cipher": "aes-256-cbc" + } + } EOM - file "data_bags/bar/round_trip.json", <<EOM -{ - "name": "data_bag_item_bar_round_trip", - "json_class": "Chef::DataBagItem", - "chef_type": "data_bag_item", - "data_bag": "bar", - "raw_data": { - "id": "round_trip", - "root_password": { - "encrypted_data": "noDOsTpsTAZlTU5sprhmYZzUDfr8du7hH/zRDOjRAmoTJHTZyfYoR221EOOW\\nXJ1D\\n", - "iv": "Bnqhfy6n0Hx1wCe9pxHLoA==\\n", - "version": 1, - "cipher": "aes-256-cbc" - }, - "admin_password": { - "encrypted_data": "TcC7dU1gx6OnE5Ab4i/k42UEf0Nnr7cAyuTHId/LNjNOwpNf7XZc27DQSjuy\\nHPlt\\n", - "iv": "+TAWJuPWCI2+WB8lGJAyvw==\\n", - "version": 1, - "cipher": "aes-256-cbc" - } - } -} + file "data_bags/bar/round_trip.json", <<~EOM + { + "name": "data_bag_item_bar_round_trip", + "json_class": "Chef::DataBagItem", + "chef_type": "data_bag_item", + "data_bag": "bar", + "raw_data": { + "id": "round_trip", + "root_password": { + "encrypted_data": "noDOsTpsTAZlTU5sprhmYZzUDfr8du7hH/zRDOjRAmoTJHTZyfYoR221EOOW\\nXJ1D\\n", + "iv": "Bnqhfy6n0Hx1wCe9pxHLoA==\\n", + "version": 1, + "cipher": "aes-256-cbc" + }, + "admin_password": { + "encrypted_data": "TcC7dU1gx6OnE5Ab4i/k42UEf0Nnr7cAyuTHId/LNjNOwpNf7XZc27DQSjuy\\nHPlt\\n", + "iv": "+TAWJuPWCI2+WB8lGJAyvw==\\n", + "version": 1, + "cipher": "aes-256-cbc" + } + } + } EOM end it "uploads a single file" do - knife("data bag from file foo #{db_dir}/foo/bar.json").should_succeed stderr: <<EOM -Updated data_bag_item[foo::bar] + knife("data bag from file foo #{db_dir}/foo/bar.json").should_succeed stderr: <<~EOM + Updated data_bag_item[foo::bar] EOM end it "uploads a single encrypted file" do - knife("data bag from file foo #{db_dir}/foo/encrypted.json").should_succeed stderr: <<EOM -Updated data_bag_item[foo::encrypted] + knife("data bag from file foo #{db_dir}/foo/encrypted.json").should_succeed stderr: <<~EOM + Updated data_bag_item[foo::encrypted] EOM end it "uploads a file in chef's internal format" do pending "chef/chef#4815" - knife("data bag from file bar #{db_dir}/bar/round_trip.json").should_succeed stderr: <<EOM -Updated data_bag_item[bar::round_trip] + knife("data bag from file bar #{db_dir}/bar/round_trip.json").should_succeed stderr: <<~EOM + Updated data_bag_item[bar::round_trip] EOM end it "uploads many files" do - knife("data bag from file foo #{db_dir}/foo/bar.json #{db_dir}/foo/bzr.json").should_succeed stderr: <<EOM -Updated data_bag_item[foo::bar] -Updated data_bag_item[foo::bzr] + knife("data bag from file foo #{db_dir}/foo/bar.json #{db_dir}/foo/bzr.json").should_succeed stderr: <<~EOM + Updated data_bag_item[foo::bar] + Updated data_bag_item[foo::bzr] EOM end it "uploads a whole directory" do knife("data bag from file foo #{db_dir}/foo") - knife("data bag show foo").should_succeed <<EOM -bar -bzr -cat -dog -encrypted + knife("data bag show foo").should_succeed <<~EOM + bar + bzr + cat + dog + encrypted EOM end diff --git a/spec/integration/knife/data_bag_list_spec.rb b/spec/integration/knife/data_bag_list_spec.rb index 7db9638660..4a2b740937 100644 --- a/spec/integration/knife/data_bag_list_spec.rb +++ b/spec/integration/knife/data_bag_list_spec.rb @@ -32,10 +32,10 @@ describe "knife data bag list", :workstation do end it "knife data bag list shows all the cookbooks" do - knife("data bag list").should_succeed <<EOM -canteloupe -rocket -x + knife("data bag list").should_succeed <<~EOM + canteloupe + rocket + x EOM end diff --git a/spec/integration/knife/data_bag_show_spec.rb b/spec/integration/knife/data_bag_show_spec.rb index 38dfd8730d..5fefec5266 100644 --- a/spec/integration/knife/data_bag_show_spec.rb +++ b/spec/integration/knife/data_bag_show_spec.rb @@ -36,17 +36,17 @@ describe "knife data bag show", :workstation do end it "with a bag with some items" do - knife("data bag show rocket").should_succeed <<EOM -ariane -atlas -falcon9 + knife("data bag show rocket").should_succeed <<~EOM + ariane + atlas + falcon9 EOM end it "with a single item" do - knife("data bag show rocket falcon9").should_succeed <<EOM -heavy: true -id: falcon9 + knife("data bag show rocket falcon9").should_succeed <<~EOM + heavy: true + id: falcon9 EOM end end diff --git a/spec/integration/knife/delete_spec.rb b/spec/integration/knife/delete_spec.rb index 9e0b46fd81..2e3efcf693 100644 --- a/spec/integration/knife/delete_spec.rb +++ b/spec/integration/knife/delete_spec.rb @@ -25,76 +25,76 @@ describe "knife delete", :workstation do include KnifeSupport let :everything do - <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end let :server_everything do - <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json + <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json EOM end let :server_nothing do - <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/cookbooks -/data_bags -/environments -/environments/_default.json -/nodes -/roles -/users -/users/admin.json + <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /cookbooks + /data_bags + /environments + /environments/_default.json + /nodes + /roles + /users + /users/admin.json EOM end let :nothing do - <<EOM -/clients -/cookbooks -/data_bags -/environments -/nodes -/roles -/users + <<~EOM + /clients + /cookbooks + /data_bags + /environments + /nodes + /roles + /users EOM end @@ -122,9 +122,9 @@ EOM end it "knife delete --both /cookbooks/x fails" do - knife("delete --both /cookbooks/x").should_fail <<EOM -ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete. -ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete. + knife("delete --both /cookbooks/x").should_fail <<~EOM + ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete. + ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete. EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything @@ -132,88 +132,88 @@ EOM it "knife delete --both -r /cookbooks/x deletes x" do knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json -EOM - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json +EOM + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end it "knife delete -r --local /cookbooks/x deletes x locally but not remotely" do knife("delete -r --local /cookbooks/x").should_succeed "Deleted /cookbooks/x\n" knife("list -Rf /").should_succeed server_everything - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end it "knife delete -r /cookbooks/x deletes x remotely but not locally" do knife("delete -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json EOM knife("list -Rf --local /").should_succeed everything end @@ -226,60 +226,60 @@ EOM end it "knife delete --both /data_bags/empty fails but deletes local version" do - knife("delete --both /data_bags/empty").should_fail <<EOM -ERROR: /data_bags/empty (remote) must be deleted recursively! Pass -r to knife delete. -ERROR: /data_bags/empty (local) must be deleted recursively! Pass -r to knife delete. -EOM - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/empty -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json -EOM - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/empty -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("delete --both /data_bags/empty").should_fail <<~EOM + ERROR: /data_bags/empty (remote) must be deleted recursively! Pass -r to knife delete. + ERROR: /data_bags/empty (local) must be deleted recursively! Pass -r to knife delete. +EOM + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/empty + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json +EOM + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/empty + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end end it "knife delete --both /data_bags/x fails" do - knife("delete --both /data_bags/x").should_fail <<EOM -ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete. -ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete. + knife("delete --both /data_bags/x").should_fail <<~EOM + ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete. + ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete. EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything @@ -287,151 +287,151 @@ EOM it "knife delete --both -r /data_bags/x deletes x" do knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json -EOM - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json +EOM + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end it "knife delete --both /environments/x.json deletes x" do knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json -EOM - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json +EOM + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end it "knife delete --both /roles/x.json deletes x" do knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/users -/users/admin.json -/users/x.json -EOM - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/users -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /users + /users/admin.json + /users/x.json +EOM + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /users + /users/x.json EOM end it "knife delete --both /environments/_default.json fails but still deletes the local copy" do knife("delete --both /environments/_default.json").should_fail stderr: "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", stdout: "Deleted /environments/_default.json\n" knife("list -Rf /").should_succeed server_everything - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end @@ -442,32 +442,32 @@ EOM end it "knife delete --both / fails" do - knife("delete --both /").should_fail <<EOM -ERROR: / (remote) cannot be deleted. -ERROR: / (local) cannot be deleted. + knife("delete --both /").should_fail <<~EOM + ERROR: / (remote) cannot be deleted. + ERROR: / (local) cannot be deleted. EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything end it "knife delete --both -r /* fails" do - knife("delete --both -r /*").should_fail <<EOM -ERROR: / (remote) cannot be deleted. -ERROR: / (local) cannot be deleted. -ERROR: /clients (remote) cannot be deleted. -ERROR: /clients (local) cannot be deleted. -ERROR: /cookbooks (remote) cannot be deleted. -ERROR: /cookbooks (local) cannot be deleted. -ERROR: /data_bags (remote) cannot be deleted. -ERROR: /data_bags (local) cannot be deleted. -ERROR: /environments (remote) cannot be deleted. -ERROR: /environments (local) cannot be deleted. -ERROR: /nodes (remote) cannot be deleted. -ERROR: /nodes (local) cannot be deleted. -ERROR: /roles (remote) cannot be deleted. -ERROR: /roles (local) cannot be deleted. -ERROR: /users (remote) cannot be deleted. -ERROR: /users (local) cannot be deleted. + knife("delete --both -r /*").should_fail <<~EOM + ERROR: / (remote) cannot be deleted. + ERROR: / (local) cannot be deleted. + ERROR: /clients (remote) cannot be deleted. + ERROR: /clients (local) cannot be deleted. + ERROR: /cookbooks (remote) cannot be deleted. + ERROR: /cookbooks (local) cannot be deleted. + ERROR: /data_bags (remote) cannot be deleted. + ERROR: /data_bags (local) cannot be deleted. + ERROR: /environments (remote) cannot be deleted. + ERROR: /environments (local) cannot be deleted. + ERROR: /nodes (remote) cannot be deleted. + ERROR: /nodes (local) cannot be deleted. + ERROR: /roles (remote) cannot be deleted. + ERROR: /roles (local) cannot be deleted. + ERROR: /users (remote) cannot be deleted. + ERROR: /users (local) cannot be deleted. EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything @@ -493,25 +493,25 @@ EOM it "knife delete --both -r /cookbooks/x deletes x" do knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json EOM knife("list -Rf --local /").should_succeed nothing end @@ -524,77 +524,77 @@ EOM it "knife delete --both -r /data_bags/x deletes x" do knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json EOM knife("list -Rf --local /").should_succeed nothing end it "knife delete --both /environments/x.json deletes x" do knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/admin.json -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/admin.json + /users/x.json EOM knife("list -Rf --local /").should_succeed nothing end it "knife delete --both /roles/x.json deletes x" do knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n" - knife("list -Rf /").should_succeed <<EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/users -/users/admin.json -/users/x.json + knife("list -Rf /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /users + /users/admin.json + /users/x.json EOM knife("list -Rf --local /").should_succeed nothing end @@ -612,23 +612,23 @@ EOM end it "knife delete --both -r /* fails" do - knife("delete --both -r /*").should_fail <<EOM -ERROR: / (remote) cannot be deleted. -ERROR: / (local) cannot be deleted. -ERROR: /clients (remote) cannot be deleted. -ERROR: /clients (local) cannot be deleted. -ERROR: /cookbooks (remote) cannot be deleted. -ERROR: /cookbooks (local) cannot be deleted. -ERROR: /data_bags (remote) cannot be deleted. -ERROR: /data_bags (local) cannot be deleted. -ERROR: /environments (remote) cannot be deleted. -ERROR: /environments (local) cannot be deleted. -ERROR: /nodes (remote) cannot be deleted. -ERROR: /nodes (local) cannot be deleted. -ERROR: /roles (remote) cannot be deleted. -ERROR: /roles (local) cannot be deleted. -ERROR: /users (remote) cannot be deleted. -ERROR: /users (local) cannot be deleted. + knife("delete --both -r /*").should_fail <<~EOM + ERROR: / (remote) cannot be deleted. + ERROR: / (local) cannot be deleted. + ERROR: /clients (remote) cannot be deleted. + ERROR: /clients (local) cannot be deleted. + ERROR: /cookbooks (remote) cannot be deleted. + ERROR: /cookbooks (local) cannot be deleted. + ERROR: /data_bags (remote) cannot be deleted. + ERROR: /data_bags (local) cannot be deleted. + ERROR: /environments (remote) cannot be deleted. + ERROR: /environments (local) cannot be deleted. + ERROR: /nodes (remote) cannot be deleted. + ERROR: /nodes (local) cannot be deleted. + ERROR: /roles (remote) cannot be deleted. + ERROR: /roles (local) cannot be deleted. + ERROR: /users (remote) cannot be deleted. + ERROR: /users (local) cannot be deleted. EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed nothing @@ -644,36 +644,36 @@ EOM before { cwd "." } it "knife delete fails" do knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", stdout: /USAGE/ - knife("list -Rf /").should_succeed <<EOM -clients -clients/chef-validator.json -clients/chef-webui.json -clients/x.json -cookbooks -cookbooks/x -cookbooks/x/metadata.rb -data_bags -data_bags/x -data_bags/x/y.json -environments -environments/_default.json -environments/x.json -nodes -nodes/x.json -roles -roles/x.json -users -users/admin.json -users/x.json -EOM - knife("list -Rf --local /").should_succeed <<EOM -clients -cookbooks -data_bags -environments -nodes -roles -users + knife("list -Rf /").should_succeed <<~EOM + clients + clients/chef-validator.json + clients/chef-webui.json + clients/x.json + cookbooks + cookbooks/x + cookbooks/x/metadata.rb + data_bags + data_bags/x + data_bags/x/y.json + environments + environments/_default.json + environments/x.json + nodes + nodes/x.json + roles + roles/x.json + users + users/admin.json + users/x.json +EOM + knife("list -Rf --local /").should_succeed <<~EOM + clients + cookbooks + data_bags + environments + nodes + roles + users EOM end end @@ -702,22 +702,22 @@ EOM it "knife delete --both -r /cookbooks/x deletes x" do knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n" knife("list -Rf /").should_succeed server_nothing - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end @@ -730,91 +730,91 @@ EOM it "knife delete --both -r /data_bags/x deletes x" do knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n" knife("list -Rf /").should_succeed server_nothing - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end it "knife delete --both /environments/x.json deletes x" do knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n" knife("list -Rf /").should_succeed server_nothing - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end it "knife delete --both /roles/x.json deletes x" do knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n" knife("list -Rf /").should_succeed server_nothing - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/_default.json -/environments/x.json -/nodes -/nodes/x.json -/roles -/users -/users/x.json + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/_default.json + /environments/x.json + /nodes + /nodes/x.json + /roles + /users + /users/x.json EOM end it "knife delete --both /environments/_default.json fails but still deletes the local copy" do knife("delete --both /environments/_default.json").should_fail stderr: "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", stdout: "Deleted /environments/_default.json\n" knife("list -Rf /").should_succeed server_nothing - knife("list -Rf --local /").should_succeed <<EOM -/clients -/clients/x.json -/cookbooks -/cookbooks/x -/cookbooks/x/metadata.rb -/data_bags -/data_bags/x -/data_bags/x/y.json -/environments -/environments/x.json -/nodes -/nodes/x.json -/roles -/roles/x.json -/users -/users/x.json + knife("list -Rf --local /").should_succeed <<~EOM + /clients + /clients/x.json + /cookbooks + /cookbooks/x + /cookbooks/x/metadata.rb + /data_bags + /data_bags/x + /data_bags/x/y.json + /environments + /environments/x.json + /nodes + /nodes/x.json + /roles + /roles/x.json + /users + /users/x.json EOM end @@ -825,23 +825,23 @@ EOM end it "knife delete --both -r /* fails" do - knife("delete --both -r /*").should_fail <<EOM -ERROR: / (remote) cannot be deleted. -ERROR: / (local) cannot be deleted. -ERROR: /clients (remote) cannot be deleted. -ERROR: /clients (local) cannot be deleted. -ERROR: /cookbooks (remote) cannot be deleted. -ERROR: /cookbooks (local) cannot be deleted. -ERROR: /data_bags (remote) cannot be deleted. -ERROR: /data_bags (local) cannot be deleted. -ERROR: /environments (remote) cannot be deleted. -ERROR: /environments (local) cannot be deleted. -ERROR: /nodes (remote) cannot be deleted. -ERROR: /nodes (local) cannot be deleted. -ERROR: /roles (remote) cannot be deleted. -ERROR: /roles (local) cannot be deleted. -ERROR: /users (remote) cannot be deleted. -ERROR: /users (local) cannot be deleted. + knife("delete --both -r /*").should_fail <<~EOM + ERROR: / (remote) cannot be deleted. + ERROR: / (local) cannot be deleted. + ERROR: /clients (remote) cannot be deleted. + ERROR: /clients (local) cannot be deleted. + ERROR: /cookbooks (remote) cannot be deleted. + ERROR: /cookbooks (local) cannot be deleted. + ERROR: /data_bags (remote) cannot be deleted. + ERROR: /data_bags (local) cannot be deleted. + ERROR: /environments (remote) cannot be deleted. + ERROR: /environments (local) cannot be deleted. + ERROR: /nodes (remote) cannot be deleted. + ERROR: /nodes (local) cannot be deleted. + ERROR: /roles (remote) cannot be deleted. + ERROR: /roles (local) cannot be deleted. + ERROR: /users (remote) cannot be deleted. + ERROR: /users (local) cannot be deleted. EOM knife("list -Rf /").should_succeed server_nothing knife("list -Rf --local /").should_succeed everything @@ -857,37 +857,37 @@ EOM before { cwd "." } it "knife delete fails" do knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", stdout: /USAGE/ - knife("list -Rf /").should_succeed <<EOM -clients -clients/chef-validator.json -clients/chef-webui.json -cookbooks -data_bags -environments -environments/_default.json -nodes -roles -users -users/admin.json -EOM - knife("list -Rf --local /").should_succeed <<EOM -clients -clients/x.json -cookbooks -cookbooks/x -cookbooks/x/metadata.rb -data_bags -data_bags/x -data_bags/x/y.json -environments -environments/_default.json -environments/x.json -nodes -nodes/x.json -roles -roles/x.json -users -users/x.json + knife("list -Rf /").should_succeed <<~EOM + clients + clients/chef-validator.json + clients/chef-webui.json + cookbooks + data_bags + environments + environments/_default.json + nodes + roles + users + users/admin.json +EOM + knife("list -Rf --local /").should_succeed <<~EOM + clients + clients/x.json + cookbooks + cookbooks/x + cookbooks/x/metadata.rb + data_bags + data_bags/x + data_bags/x/y.json + environments + environments/_default.json + environments/x.json + nodes + nodes/x.json + roles + roles/x.json + users + users/x.json EOM end end diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb index b8ab6e719c..b7eafcbd1c 100644 --- a/spec/integration/knife/deps_spec.rb +++ b/spec/integration/knife/deps_spec.rb @@ -41,11 +41,11 @@ describe "knife deps", :workstation do file "cookbooks/soup/recipes/chicken.rb", "" end it "knife deps reports all dependencies" do - knife("deps /roles/starring.json").should_succeed <<EOM -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json + knife("deps /roles/starring.json").should_succeed <<~EOM + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json EOM end end @@ -60,11 +60,11 @@ EOM file "cookbooks/soup/recipes/chicken.rb", "" end it "knife deps reports all dependencies" do - knife("deps /roles/starring.json").should_succeed <<EOM -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json + knife("deps /roles/starring.json").should_succeed <<~EOM + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json EOM end end @@ -94,11 +94,11 @@ EOM file "nodes/mort.json", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } end it "knife deps reports just the node" do - knife("deps /nodes/mort.json").should_succeed <<EOM -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/nodes/mort.json + knife("deps /nodes/mort.json").should_succeed <<~EOM + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /nodes/mort.json EOM end end @@ -148,56 +148,56 @@ depends "kettle"' end it "knife deps reports all dependencies" do - knife("deps /nodes/mort.json").should_succeed <<EOM -/environments/desert.json -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json -/nodes/mort.json + knife("deps /nodes/mort.json").should_succeed <<~EOM + /environments/desert.json + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json + /nodes/mort.json EOM end it "knife deps * reports all dependencies of all things" do - knife("deps /nodes/*").should_succeed <<EOM -/roles/minor.json -/nodes/bart.json -/environments/desert.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json -/nodes/mort.json + knife("deps /nodes/*").should_succeed <<~EOM + /roles/minor.json + /nodes/bart.json + /environments/desert.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json + /nodes/mort.json EOM end it "knife deps a b reports all dependencies of a and b" do - knife("deps /nodes/bart.json /nodes/mort.json").should_succeed <<EOM -/roles/minor.json -/nodes/bart.json -/environments/desert.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json -/nodes/mort.json + knife("deps /nodes/bart.json /nodes/mort.json").should_succeed <<~EOM + /roles/minor.json + /nodes/bart.json + /environments/desert.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json + /nodes/mort.json EOM end it "knife deps --tree /* shows dependencies in a tree" do - knife("deps --tree /nodes/*").should_succeed <<EOM -/nodes/bart.json - /roles/minor.json -/nodes/mort.json - /environments/desert.json - /roles/starring.json - /roles/minor.json - /cookbooks/quiche - /cookbooks/soup + knife("deps --tree /nodes/*").should_succeed <<~EOM + /nodes/bart.json + /roles/minor.json + /nodes/mort.json + /environments/desert.json + /roles/starring.json + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup EOM end it "knife deps --tree --no-recurse shows only the first level of dependencies" do - knife("deps --tree --no-recurse /nodes/*").should_succeed <<EOM -/nodes/bart.json - /roles/minor.json -/nodes/mort.json - /environments/desert.json - /roles/starring.json + knife("deps --tree --no-recurse /nodes/*").should_succeed <<~EOM + /nodes/bart.json + /roles/minor.json + /nodes/mort.json + /environments/desert.json + /roles/starring.json EOM end end @@ -232,11 +232,11 @@ depends "foo"' file "roles/self.json", { "run_list" => [ "role[self]" ] } end it "knife deps prints each once" do - knife("deps /roles/foo.json /roles/self.json").should_succeed <<EOM -/roles/baz.json -/roles/bar.json -/roles/foo.json -/roles/self.json + knife("deps /roles/foo.json /roles/self.json").should_succeed <<~EOM + /roles/baz.json + /roles/bar.json + /roles/foo.json + /roles/self.json EOM end it "knife deps --tree prints each once" do @@ -378,11 +378,11 @@ EOM cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } } end it "knife deps reports all dependencies" do - knife("deps --remote /roles/starring.json").should_succeed <<EOM -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json + knife("deps --remote /roles/starring.json").should_succeed <<~EOM + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json EOM end end @@ -395,11 +395,11 @@ EOM cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } } end it "knife deps reports all dependencies" do - knife("deps --remote /roles/starring.json").should_succeed <<EOM -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json + knife("deps --remote /roles/starring.json").should_succeed <<~EOM + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json EOM end end @@ -427,11 +427,11 @@ EOM node "mort", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } end it "knife deps reports just the node" do - knife("deps --remote /nodes/mort.json").should_succeed <<EOM -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/nodes/mort.json + knife("deps --remote /nodes/mort.json").should_succeed <<~EOM + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /nodes/mort.json EOM end end @@ -477,56 +477,56 @@ depends "kettle"', "recipes" => { "default.rb" => "" } } end it "knife deps reports all dependencies" do - knife("deps --remote /nodes/mort.json").should_succeed <<EOM -/environments/desert.json -/roles/minor.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json -/nodes/mort.json + knife("deps --remote /nodes/mort.json").should_succeed <<~EOM + /environments/desert.json + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json + /nodes/mort.json EOM end it "knife deps * reports all dependencies of all things" do - knife("deps --remote /nodes/*").should_succeed <<EOM -/roles/minor.json -/nodes/bart.json -/environments/desert.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json -/nodes/mort.json + knife("deps --remote /nodes/*").should_succeed <<~EOM + /roles/minor.json + /nodes/bart.json + /environments/desert.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json + /nodes/mort.json EOM end it "knife deps a b reports all dependencies of a and b" do - knife("deps --remote /nodes/bart.json /nodes/mort.json").should_succeed <<EOM -/roles/minor.json -/nodes/bart.json -/environments/desert.json -/cookbooks/quiche -/cookbooks/soup -/roles/starring.json -/nodes/mort.json + knife("deps --remote /nodes/bart.json /nodes/mort.json").should_succeed <<~EOM + /roles/minor.json + /nodes/bart.json + /environments/desert.json + /cookbooks/quiche + /cookbooks/soup + /roles/starring.json + /nodes/mort.json EOM end it "knife deps --tree /* shows dependencies in a tree" do - knife("deps --remote --tree /nodes/*").should_succeed <<EOM -/nodes/bart.json - /roles/minor.json -/nodes/mort.json - /environments/desert.json - /roles/starring.json - /roles/minor.json - /cookbooks/quiche - /cookbooks/soup + knife("deps --remote --tree /nodes/*").should_succeed <<~EOM + /nodes/bart.json + /roles/minor.json + /nodes/mort.json + /environments/desert.json + /roles/starring.json + /roles/minor.json + /cookbooks/quiche + /cookbooks/soup EOM end it "knife deps --tree --no-recurse shows only the first level of dependencies" do - knife("deps --remote --tree --no-recurse /nodes/*").should_succeed <<EOM -/nodes/bart.json - /roles/minor.json -/nodes/mort.json - /environments/desert.json - /roles/starring.json + knife("deps --remote --tree --no-recurse /nodes/*").should_succeed <<~EOM + /nodes/bart.json + /roles/minor.json + /nodes/mort.json + /environments/desert.json + /roles/starring.json EOM end end @@ -544,21 +544,21 @@ depends "foo"' } depends "self"' } end it "knife deps prints each once" do - knife("deps --remote /cookbooks/foo /cookbooks/self").should_succeed <<EOM -/cookbooks/baz -/cookbooks/bar -/cookbooks/foo -/cookbooks/self + knife("deps --remote /cookbooks/foo /cookbooks/self").should_succeed <<~EOM + /cookbooks/baz + /cookbooks/bar + /cookbooks/foo + /cookbooks/self EOM end it "knife deps --tree prints each once" do - knife("deps --remote --tree /cookbooks/foo /cookbooks/self").should_succeed <<EOM -/cookbooks/foo - /cookbooks/bar - /cookbooks/baz - /cookbooks/foo -/cookbooks/self - /cookbooks/self + knife("deps --remote --tree /cookbooks/foo /cookbooks/self").should_succeed <<~EOM + /cookbooks/foo + /cookbooks/bar + /cookbooks/baz + /cookbooks/foo + /cookbooks/self + /cookbooks/self EOM end end @@ -570,11 +570,11 @@ EOM role "self", { "run_list" => [ "role[self]" ] } end it "knife deps prints each once" do - knife("deps --remote /roles/foo.json /roles/self.json").should_succeed <<EOM -/roles/baz.json -/roles/bar.json -/roles/foo.json -/roles/self.json + knife("deps --remote /roles/foo.json /roles/self.json").should_succeed <<~EOM + /roles/baz.json + /roles/bar.json + /roles/foo.json + /roles/self.json EOM end it "knife deps --tree prints each once" do diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb index 839dcafe49..9e54558300 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -46,18 +46,18 @@ describe "knife diff", :workstation do end it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients/chef-validator.json -D\t/clients/chef-webui.json -D\t/clients/x.json -D\t/cookbooks/x -D\t/data_bags/x -D\t/environments/_default.json -D\t/environments/x.json -D\t/nodes/x.json -D\t/roles/x.json -D\t/users/admin.json -D\t/users/x.json + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients/chef-validator.json + D\t/clients/chef-webui.json + D\t/clients/x.json + D\t/cookbooks/x + D\t/data_bags/x + D\t/environments/_default.json + D\t/environments/x.json + D\t/nodes/x.json + D\t/roles/x.json + D\t/users/admin.json + D\t/users/x.json EOM end end @@ -92,16 +92,16 @@ EOM context "except the role file" do before do - file "roles/x.json", <<EOM -{ - "foo": "bar" -} + file "roles/x.json", <<~EOM + { + "foo": "bar" + } EOM end it "knife diff reports the role as different" do - knife("diff --name-status /").should_succeed <<EOM -M\t/roles/x.json + knife("diff --name-status /").should_succeed <<~EOM + M\t/roles/x.json EOM end end @@ -120,31 +120,31 @@ EOM end it "knife diff reports the new files as added" do - knife("diff --name-status /").should_succeed <<EOM -A\t/clients/y.json -A\t/cookbooks/x/blah.rb -A\t/cookbooks/y -A\t/data_bags/x/z.json -A\t/data_bags/y -A\t/environments/y.json -A\t/nodes/y.json -A\t/roles/y.json -A\t/users/y.json + knife("diff --name-status /").should_succeed <<~EOM + A\t/clients/y.json + A\t/cookbooks/x/blah.rb + A\t/cookbooks/y + A\t/data_bags/x/z.json + A\t/data_bags/y + A\t/environments/y.json + A\t/nodes/y.json + A\t/roles/y.json + A\t/users/y.json EOM end context "when cwd is the data_bags directory" do before { cwd "data_bags" } it "knife diff reports different data bags" do - knife("diff --name-status").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end it "knife diff * reports different data bags" do - knife("diff --name-status *").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status *").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end end @@ -153,14 +153,14 @@ EOM when_the_repository "is empty" do it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end end @@ -179,17 +179,17 @@ EOM end it "knife diff /cookbooks/x shows differences" do - knife("diff --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end it "knife diff --diff-filter=MAT does not show deleted files" do - knife("diff --diff-filter=MAT --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --diff-filter=MAT --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -210,10 +210,10 @@ EOM end it "knife diff /cookbooks/x shows the differences" do - knife("diff --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -224,10 +224,10 @@ EOM end it "knife diff /cookbooks/x shows the differences" do - knife("diff --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin0.9.9.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin0.9.9.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -341,18 +341,18 @@ EOM end it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients/chef-validator.json -D\t/clients/chef-webui.json -D\t/clients/x.json -D\t/cookbooks/x-1.0.0 -D\t/data_bags/x -D\t/environments/_default.json -D\t/environments/x.json -D\t/nodes/x.json -D\t/roles/x.json -D\t/users/admin.json -D\t/users/x.json + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients/chef-validator.json + D\t/clients/chef-webui.json + D\t/clients/x.json + D\t/cookbooks/x-1.0.0 + D\t/data_bags/x + D\t/environments/_default.json + D\t/environments/x.json + D\t/nodes/x.json + D\t/roles/x.json + D\t/users/admin.json + D\t/users/x.json EOM end end @@ -386,16 +386,16 @@ EOM context "except the role file" do before do - file "roles/x.json", <<EOM -{ - "foo": "bar" -} + file "roles/x.json", <<~EOM + { + "foo": "bar" + } EOM end it "knife diff reports the role as different" do - knife("diff --name-status /").should_succeed <<EOM -M\t/roles/x.json + knife("diff --name-status /").should_succeed <<~EOM + M\t/roles/x.json EOM end end @@ -415,32 +415,32 @@ EOM end it "knife diff reports the new files as added" do - knife("diff --name-status /").should_succeed <<EOM -A\t/clients/y.json -A\t/cookbooks/x-1.0.0/blah.rb -A\t/cookbooks/x-2.0.0 -A\t/cookbooks/y-1.0.0 -A\t/data_bags/x/z.json -A\t/data_bags/y -A\t/environments/y.json -A\t/nodes/y.json -A\t/roles/y.json -A\t/users/y.json + knife("diff --name-status /").should_succeed <<~EOM + A\t/clients/y.json + A\t/cookbooks/x-1.0.0/blah.rb + A\t/cookbooks/x-2.0.0 + A\t/cookbooks/y-1.0.0 + A\t/data_bags/x/z.json + A\t/data_bags/y + A\t/environments/y.json + A\t/nodes/y.json + A\t/roles/y.json + A\t/users/y.json EOM end context "when cwd is the data_bags directory" do before { cwd "data_bags" } it "knife diff reports different data bags" do - knife("diff --name-status").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end it "knife diff * reports different data bags" do - knife("diff --name-status *").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status *").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end end @@ -449,14 +449,14 @@ EOM when_the_repository "is empty" do it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end end @@ -475,8 +475,8 @@ EOM end it "knife diff /cookbooks shows differences" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-1.0.1 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-1.0.1 EOM end @@ -501,9 +501,9 @@ EOM end it "knife diff /cookbooks shows the differences" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-1.0.1 -A\t/cookbooks/x-1.0.0 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-1.0.1 + A\t/cookbooks/x-1.0.0 EOM end end @@ -514,9 +514,9 @@ EOM end it "knife diff /cookbooks shows the differences" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-0.9.9 -A\t/cookbooks/x-1.0.0 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-0.9.9 + A\t/cookbooks/x-1.0.0 EOM end end diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index 68762ec58e..12e14fce04 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -48,20 +48,20 @@ describe "knife download", :workstation do end it "knife download downloads everything" do - knife("download /").should_succeed <<EOM -Created /clients/chef-validator.json -Created /clients/chef-webui.json -Created /clients/x.json -Created /cookbooks/x -Created /cookbooks/x/metadata.rb -Created /data_bags/x -Created /data_bags/x/y.json -Created /environments/_default.json -Created /environments/x.json -Created /nodes/x.json -Created /roles/x.json -Created /users/admin.json -Created /users/x.json + knife("download /").should_succeed <<~EOM + Created /clients/chef-validator.json + Created /clients/chef-webui.json + Created /clients/x.json + Created /cookbooks/x + Created /cookbooks/x/metadata.rb + Created /data_bags/x + Created /data_bags/x/y.json + Created /environments/_default.json + Created /environments/x.json + Created /nodes/x.json + Created /roles/x.json + Created /users/admin.json + Created /users/x.json EOM knife("diff --name-status /").should_succeed "" end @@ -94,22 +94,22 @@ EOM context "except the role file" do before do - file "roles/x.json", <<EOM -{ - "chef_type": "role", - "default_attributes": { - }, - "description": "blarghle", - "env_run_lists": { - }, - "json_class": "Chef::Role", - "name": "x", - "override_attributes": { - }, - "run_list": [ - - ] -} + file "roles/x.json", <<~EOM + { + "chef_type": "role", + "default_attributes": { + }, + "description": "blarghle", + "env_run_lists": { + }, + "json_class": "Chef::Role", + "name": "x", + "override_attributes": { + }, + "run_list": [ + + ] + } EOM end @@ -126,22 +126,22 @@ EOM context "except the role file is textually different, but not ACTUALLY different" do before do - file "roles/x.json", <<EOM -{ - "chef_type": "role", - "default_attributes": { - }, - "env_run_lists": { - }, - "json_class": "Chef::Role", - "name": "x", - "description": "", - "override_attributes": { - }, - "run_list": [ - - ] -} + file "roles/x.json", <<~EOM + { + "chef_type": "role", + "default_attributes": { + }, + "env_run_lists": { + }, + "json_class": "Chef::Role", + "name": "x", + "description": "", + "override_attributes": { + }, + "run_list": [ + + ] + } EOM end @@ -166,30 +166,30 @@ EOM it "knife download does nothing" do knife("download /").should_succeed "" - knife("diff --name-status /").should_succeed <<EOM -A\t/clients/y.json -A\t/cookbooks/x/blah.rb -A\t/cookbooks/y -A\t/data_bags/x/z.json -A\t/data_bags/y -A\t/environments/y.json -A\t/nodes/y.json -A\t/roles/y.json -A\t/users/y.json + knife("diff --name-status /").should_succeed <<~EOM + A\t/clients/y.json + A\t/cookbooks/x/blah.rb + A\t/cookbooks/y + A\t/data_bags/x/z.json + A\t/data_bags/y + A\t/environments/y.json + A\t/nodes/y.json + A\t/roles/y.json + A\t/users/y.json EOM end it "knife download --purge deletes the extra files" do - knife("download --purge /").should_succeed <<EOM -Deleted extra entry /clients/y.json (purge is on) -Deleted extra entry /cookbooks/x/blah.rb (purge is on) -Deleted extra entry /cookbooks/y (purge is on) -Deleted extra entry /data_bags/x/z.json (purge is on) -Deleted extra entry /data_bags/y (purge is on) -Deleted extra entry /environments/y.json (purge is on) -Deleted extra entry /nodes/y.json (purge is on) -Deleted extra entry /roles/y.json (purge is on) -Deleted extra entry /users/y.json (purge is on) + knife("download --purge /").should_succeed <<~EOM + Deleted extra entry /clients/y.json (purge is on) + Deleted extra entry /cookbooks/x/blah.rb (purge is on) + Deleted extra entry /cookbooks/y (purge is on) + Deleted extra entry /data_bags/x/z.json (purge is on) + Deleted extra entry /data_bags/y (purge is on) + Deleted extra entry /environments/y.json (purge is on) + Deleted extra entry /nodes/y.json (purge is on) + Deleted extra entry /roles/y.json (purge is on) + Deleted extra entry /users/y.json (purge is on) EOM knife("diff --name-status /").should_succeed "" end @@ -198,53 +198,53 @@ EOM when_the_repository "is empty" do it "knife download creates the extra files" do - knife("download /").should_succeed <<EOM -Created /clients -Created /clients/chef-validator.json -Created /clients/chef-webui.json -Created /clients/x.json -Created /cookbooks -Created /cookbooks/x -Created /cookbooks/x/metadata.rb -Created /data_bags -Created /data_bags/x -Created /data_bags/x/y.json -Created /environments -Created /environments/_default.json -Created /environments/x.json -Created /nodes -Created /nodes/x.json -Created /roles -Created /roles/x.json -Created /users -Created /users/admin.json -Created /users/x.json + knife("download /").should_succeed <<~EOM + Created /clients + Created /clients/chef-validator.json + Created /clients/chef-webui.json + Created /clients/x.json + Created /cookbooks + Created /cookbooks/x + Created /cookbooks/x/metadata.rb + Created /data_bags + Created /data_bags/x + Created /data_bags/x/y.json + Created /environments + Created /environments/_default.json + Created /environments/x.json + Created /nodes + Created /nodes/x.json + Created /roles + Created /roles/x.json + Created /users + Created /users/admin.json + Created /users/x.json EOM knife("diff --name-status /").should_succeed "" end it "knife download --no-diff creates the extra files" do - knife("download --no-diff /").should_succeed <<EOM -Created /clients -Created /clients/chef-validator.json -Created /clients/chef-webui.json -Created /clients/x.json -Created /cookbooks -Created /cookbooks/x -Created /cookbooks/x/metadata.rb -Created /data_bags -Created /data_bags/x -Created /data_bags/x/y.json -Created /environments -Created /environments/_default.json -Created /environments/x.json -Created /nodes -Created /nodes/x.json -Created /roles -Created /roles/x.json -Created /users -Created /users/admin.json -Created /users/x.json + knife("download --no-diff /").should_succeed <<~EOM + Created /clients + Created /clients/chef-validator.json + Created /clients/chef-webui.json + Created /clients/x.json + Created /cookbooks + Created /cookbooks/x + Created /cookbooks/x/metadata.rb + Created /data_bags + Created /data_bags/x + Created /data_bags/x/y.json + Created /environments + Created /environments/_default.json + Created /environments/x.json + Created /nodes + Created /nodes/x.json + Created /roles + Created /roles/x.json + Created /users + Created /users/admin.json + Created /users/x.json EOM knife("diff --name-status /").should_succeed "" end @@ -269,22 +269,22 @@ EOM end it "knife download of one data bag item itself succeeds" do - knife("download /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags -Created /data_bags/x -Created /data_bags/x/y.json + knife("download /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags + Created /data_bags/x + Created /data_bags/x/y.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/z.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/z.json EOM end it "knife download /data_bags/x /data_bags/x/y.json downloads x once" do - knife("download /data_bags/x /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags -Created /data_bags/x -Created /data_bags/x/y.json -Created /data_bags/x/z.json + knife("download /data_bags/x /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags + Created /data_bags/x + Created /data_bags/x/y.json + Created /data_bags/x/z.json EOM end end @@ -292,20 +292,20 @@ EOM when_the_repository "has three data bag items" do before do - file "data_bags/x/deleted.json", <<EOM -{ - "id": "deleted" -} + file "data_bags/x/deleted.json", <<~EOM + { + "id": "deleted" + } EOM - file "data_bags/x/modified.json", <<EOM -{ - "id": "modified" -} + file "data_bags/x/modified.json", <<~EOM + { + "id": "modified" + } EOM - file "data_bags/x/unmodified.json", <<EOM -{ - "id": "unmodified" -} + file "data_bags/x/unmodified.json", <<~EOM + { + "id": "unmodified" + } EOM end @@ -319,62 +319,62 @@ EOM end it "knife download of the modified file succeeds" do - knife("download /data_bags/x/modified.json").should_succeed <<EOM -Updated /data_bags/x/modified.json + knife("download /data_bags/x/modified.json").should_succeed <<~EOM + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + A\t/data_bags/x/deleted.json EOM end it "knife download of the unmodified file does nothing" do knife("download /data_bags/x/unmodified.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/deleted.json EOM end it "knife download of the added file succeeds" do - knife("download /data_bags/x/added.json").should_succeed <<EOM -Created /data_bags/x/added.json + knife("download /data_bags/x/added.json").should_succeed <<~EOM + Created /data_bags/x/added.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -M\t/data_bags/x/modified.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + M\t/data_bags/x/modified.json + A\t/data_bags/x/deleted.json EOM end it "knife download of the deleted file does nothing" do knife("download /data_bags/x/deleted.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/deleted.json EOM end it "knife download --purge of the deleted file deletes it" do - knife("download --purge /data_bags/x/deleted.json").should_succeed <<EOM -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("download --purge /data_bags/x/deleted.json").should_succeed <<~EOM + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -M\t/data_bags/x/modified.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + M\t/data_bags/x/modified.json EOM end it "knife download of the entire data bag downloads everything" do - knife("download /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json + knife("download /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + A\t/data_bags/x/deleted.json EOM end it "knife download --purge of the entire data bag downloads everything" do - knife("download --purge /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("download --purge /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -386,18 +386,18 @@ EOM knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", stdout: /USAGE/ end it "knife download --purge . downloads everything" do - knife("download --purge .").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("download --purge .").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife download --purge * downloads everything" do - knife("download --purge *").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("download --purge *").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -418,47 +418,47 @@ EOM it "knife download of a modified file succeeds" do knife("download /cookbooks/x/metadata.rb").should_succeed "Updated /cookbooks/x/metadata.rb\n" - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x/y.rb -A\t/cookbooks/x/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x/y.rb + A\t/cookbooks/x/z.rb EOM end it "knife download of a deleted file does nothing" do knife("download /cookbooks/x/z.rb").should_succeed "" - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/y.rb -A\t/cookbooks/x/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/y.rb + A\t/cookbooks/x/z.rb EOM end it "knife download --purge of a deleted file succeeds" do knife("download --purge /cookbooks/x/z.rb").should_succeed "Deleted extra entry /cookbooks/x/z.rb (purge is on)\n" - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/y.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/y.rb EOM end it "knife download of an added file succeeds" do knife("download /cookbooks/x/y.rb").should_succeed "Created /cookbooks/x/y.rb\n" - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -A\t/cookbooks/x/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + A\t/cookbooks/x/z.rb EOM end it "knife download of the cookbook itself succeeds" do - knife("download /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/y.rb + knife("download /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x/metadata.rb + Created /cookbooks/x/y.rb EOM - knife("diff --name-status /cookbooks").should_succeed <<EOM -A\t/cookbooks/x/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + A\t/cookbooks/x/z.rb EOM end it "knife download --purge of the cookbook itself succeeds" do - knife("download --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/y.rb -Deleted extra entry /cookbooks/x/z.rb (purge is on) + knife("download --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x/metadata.rb + Created /cookbooks/x/y.rb + Deleted extra entry /cookbooks/x/z.rb (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -478,10 +478,10 @@ EOM end it "knife download /cookbooks/x downloads the latest version" do - knife("download --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/onlyin1.0.1.rb -Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) + knife("download --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x/metadata.rb + Created /cookbooks/x/onlyin1.0.1.rb + Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -494,8 +494,8 @@ EOM end it "knife download /cookbooks/x downloads the updated file" do - knife("download --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x/onlyin1.0.0.rb + knife("download --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x/onlyin1.0.0.rb EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -507,10 +507,10 @@ EOM end it "knife download /cookbooks/x downloads the latest version" do - knife("download --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/onlyin1.0.1.rb -Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) + knife("download --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x/metadata.rb + Created /cookbooks/x/onlyin1.0.1.rb + Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -522,10 +522,10 @@ EOM end it "knife download /cookbooks/x downloads the old version" do - knife("download --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/onlyin0.9.9.rb -Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) + knife("download --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x/metadata.rb + Created /cookbooks/x/onlyin0.9.9.rb + Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -538,9 +538,9 @@ EOM end when_the_repository "has the role in ruby" do before do - file "roles/x.rb", <<EOM -name "x" -description "x" + file "roles/x.rb", <<~EOM + name "x" + description "x" EOM end @@ -560,11 +560,11 @@ EOM file "environments/x.json", "{" end it "knife download succeeds" do - warning = <<-EOH -WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF - { - (right here) ------^ - + warning = <<~EOH + WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF + { + (right here) ------^ + EOH knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n", stderr: warning knife("diff --name-status /environments/x.json").should_succeed "" @@ -617,20 +617,20 @@ EOH end it "knife download downloads everything" do - knife("download /").should_succeed <<EOM -Created /clients/chef-validator.json -Created /clients/chef-webui.json -Created /clients/x.json -Created /cookbooks/x-1.0.0 -Created /cookbooks/x-1.0.0/metadata.rb -Created /data_bags/x -Created /data_bags/x/y.json -Created /environments/_default.json -Created /environments/x.json -Created /nodes/x.json -Created /roles/x.json -Created /users/admin.json -Created /users/x.json + knife("download /").should_succeed <<~EOM + Created /clients/chef-validator.json + Created /clients/chef-webui.json + Created /clients/x.json + Created /cookbooks/x-1.0.0 + Created /cookbooks/x-1.0.0/metadata.rb + Created /data_bags/x + Created /data_bags/x/y.json + Created /environments/_default.json + Created /environments/x.json + Created /nodes/x.json + Created /roles/x.json + Created /users/admin.json + Created /users/x.json EOM knife("diff --name-status /").should_succeed "" end @@ -674,22 +674,22 @@ EOM context "except the role file is textually different, but not ACTUALLY different" do before do - file "roles/x.json", <<EOM -{ - "chef_type": "role" , - "default_attributes": { - }, - "env_run_lists": { - }, - "json_class": "Chef::Role", - "name": "x", - "description": "", - "override_attributes": { - }, - "run_list": [ - - ] -} + file "roles/x.json", <<~EOM + { + "chef_type": "role" , + "default_attributes": { + }, + "env_run_lists": { + }, + "json_class": "Chef::Role", + "name": "x", + "description": "", + "override_attributes": { + }, + "run_list": [ + + ] + } EOM end @@ -715,32 +715,32 @@ EOM it "knife download does nothing" do knife("download /").should_succeed "" - knife("diff --name-status /").should_succeed <<EOM -A\t/clients/y.json -A\t/cookbooks/x-1.0.0/blah.rb -A\t/cookbooks/x-2.0.0 -A\t/cookbooks/y-1.0.0 -A\t/data_bags/x/z.json -A\t/data_bags/y -A\t/environments/y.json -A\t/nodes/y.json -A\t/roles/y.json -A\t/users/y.json + knife("diff --name-status /").should_succeed <<~EOM + A\t/clients/y.json + A\t/cookbooks/x-1.0.0/blah.rb + A\t/cookbooks/x-2.0.0 + A\t/cookbooks/y-1.0.0 + A\t/data_bags/x/z.json + A\t/data_bags/y + A\t/environments/y.json + A\t/nodes/y.json + A\t/roles/y.json + A\t/users/y.json EOM end it "knife download --purge deletes the extra files" do - knife("download --purge /").should_succeed <<EOM -Deleted extra entry /clients/y.json (purge is on) -Deleted extra entry /cookbooks/x-1.0.0/blah.rb (purge is on) -Deleted extra entry /cookbooks/x-2.0.0 (purge is on) -Deleted extra entry /cookbooks/y-1.0.0 (purge is on) -Deleted extra entry /data_bags/x/z.json (purge is on) -Deleted extra entry /data_bags/y (purge is on) -Deleted extra entry /environments/y.json (purge is on) -Deleted extra entry /nodes/y.json (purge is on) -Deleted extra entry /roles/y.json (purge is on) -Deleted extra entry /users/y.json (purge is on) + knife("download --purge /").should_succeed <<~EOM + Deleted extra entry /clients/y.json (purge is on) + Deleted extra entry /cookbooks/x-1.0.0/blah.rb (purge is on) + Deleted extra entry /cookbooks/x-2.0.0 (purge is on) + Deleted extra entry /cookbooks/y-1.0.0 (purge is on) + Deleted extra entry /data_bags/x/z.json (purge is on) + Deleted extra entry /data_bags/y (purge is on) + Deleted extra entry /environments/y.json (purge is on) + Deleted extra entry /nodes/y.json (purge is on) + Deleted extra entry /roles/y.json (purge is on) + Deleted extra entry /users/y.json (purge is on) EOM knife("diff --name-status /").should_succeed "" end @@ -749,27 +749,27 @@ EOM when_the_repository "is empty" do it "knife download creates the extra files" do - knife("download /").should_succeed <<EOM -Created /clients -Created /clients/chef-validator.json -Created /clients/chef-webui.json -Created /clients/x.json -Created /cookbooks -Created /cookbooks/x-1.0.0 -Created /cookbooks/x-1.0.0/metadata.rb -Created /data_bags -Created /data_bags/x -Created /data_bags/x/y.json -Created /environments -Created /environments/_default.json -Created /environments/x.json -Created /nodes -Created /nodes/x.json -Created /roles -Created /roles/x.json -Created /users -Created /users/admin.json -Created /users/x.json + knife("download /").should_succeed <<~EOM + Created /clients + Created /clients/chef-validator.json + Created /clients/chef-webui.json + Created /clients/x.json + Created /cookbooks + Created /cookbooks/x-1.0.0 + Created /cookbooks/x-1.0.0/metadata.rb + Created /data_bags + Created /data_bags/x + Created /data_bags/x/y.json + Created /environments + Created /environments/_default.json + Created /environments/x.json + Created /nodes + Created /nodes/x.json + Created /roles + Created /roles/x.json + Created /users + Created /users/admin.json + Created /users/x.json EOM knife("diff --name-status /").should_succeed "" end @@ -793,13 +793,13 @@ EOM end it "knife download of one data bag item itself succeeds" do - knife("download /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags -Created /data_bags/x -Created /data_bags/x/y.json + knife("download /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags + Created /data_bags/x + Created /data_bags/x/y.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/z.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/z.json EOM end end @@ -807,20 +807,20 @@ EOM when_the_repository "has three data bag items" do before do - file "data_bags/x/deleted.json", <<EOM -{ - "id": "deleted" -} + file "data_bags/x/deleted.json", <<~EOM + { + "id": "deleted" + } EOM - file "data_bags/x/modified.json", <<EOM -{ - "id": "modified" -} + file "data_bags/x/modified.json", <<~EOM + { + "id": "modified" + } EOM - file "data_bags/x/unmodified.json", <<EOM -{ - "id": "unmodified" -} + file "data_bags/x/unmodified.json", <<~EOM + { + "id": "unmodified" + } EOM end @@ -834,62 +834,62 @@ EOM end it "knife download of the modified file succeeds" do - knife("download /data_bags/x/modified.json").should_succeed <<EOM -Updated /data_bags/x/modified.json + knife("download /data_bags/x/modified.json").should_succeed <<~EOM + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + A\t/data_bags/x/deleted.json EOM end it "knife download of the unmodified file does nothing" do knife("download /data_bags/x/unmodified.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/deleted.json EOM end it "knife download of the added file succeeds" do - knife("download /data_bags/x/added.json").should_succeed <<EOM -Created /data_bags/x/added.json + knife("download /data_bags/x/added.json").should_succeed <<~EOM + Created /data_bags/x/added.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -M\t/data_bags/x/modified.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + M\t/data_bags/x/modified.json + A\t/data_bags/x/deleted.json EOM end it "knife download of the deleted file does nothing" do knife("download /data_bags/x/deleted.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/deleted.json EOM end it "knife download --purge of the deleted file deletes it" do - knife("download --purge /data_bags/x/deleted.json").should_succeed <<EOM -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("download --purge /data_bags/x/deleted.json").should_succeed <<~EOM + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/added.json -M\t/data_bags/x/modified.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/added.json + M\t/data_bags/x/modified.json EOM end it "knife download of the entire data bag downloads everything" do - knife("download /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json + knife("download /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -A\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + A\t/data_bags/x/deleted.json EOM end it "knife download --purge of the entire data bag downloads everything" do - knife("download --purge /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("download --purge /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -901,18 +901,18 @@ EOM knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", stdout: /USAGE/ end it "knife download --purge . downloads everything" do - knife("download --purge .").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("download --purge .").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife download --purge * downloads everything" do - knife("download --purge *").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("download --purge *").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -933,47 +933,47 @@ EOM it "knife download of a modified file succeeds" do knife("download /cookbooks/x-1.0.0/metadata.rb").should_succeed "Updated /cookbooks/x-1.0.0/metadata.rb\n" - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-1.0.0/y.rb -A\t/cookbooks/x-1.0.0/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-1.0.0/y.rb + A\t/cookbooks/x-1.0.0/z.rb EOM end it "knife download of a deleted file does nothing" do knife("download /cookbooks/x-1.0.0/z.rb").should_succeed "" - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x-1.0.0/metadata.rb -D\t/cookbooks/x-1.0.0/y.rb -A\t/cookbooks/x-1.0.0/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x-1.0.0/metadata.rb + D\t/cookbooks/x-1.0.0/y.rb + A\t/cookbooks/x-1.0.0/z.rb EOM end it "knife download --purge of a deleted file succeeds" do knife("download --purge /cookbooks/x-1.0.0/z.rb").should_succeed "Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)\n" - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x-1.0.0/metadata.rb -D\t/cookbooks/x-1.0.0/y.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x-1.0.0/metadata.rb + D\t/cookbooks/x-1.0.0/y.rb EOM end it "knife download of an added file succeeds" do knife("download /cookbooks/x-1.0.0/y.rb").should_succeed "Created /cookbooks/x-1.0.0/y.rb\n" - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x-1.0.0/metadata.rb -A\t/cookbooks/x-1.0.0/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x-1.0.0/metadata.rb + A\t/cookbooks/x-1.0.0/z.rb EOM end it "knife download of the cookbook itself succeeds" do - knife("download /cookbooks/x-1.0.0").should_succeed <<EOM -Updated /cookbooks/x-1.0.0/metadata.rb -Created /cookbooks/x-1.0.0/y.rb + knife("download /cookbooks/x-1.0.0").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0/metadata.rb + Created /cookbooks/x-1.0.0/y.rb EOM - knife("diff --name-status /cookbooks").should_succeed <<EOM -A\t/cookbooks/x-1.0.0/z.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + A\t/cookbooks/x-1.0.0/z.rb EOM end it "knife download --purge of the cookbook itself succeeds" do - knife("download --purge /cookbooks/x-1.0.0").should_succeed <<EOM -Updated /cookbooks/x-1.0.0/metadata.rb -Created /cookbooks/x-1.0.0/y.rb -Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on) + knife("download --purge /cookbooks/x-1.0.0").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0/metadata.rb + Created /cookbooks/x-1.0.0/y.rb + Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -993,11 +993,11 @@ EOM end it "knife download /cookbooks/x downloads the latest version" do - knife("download --purge /cookbooks").should_succeed <<EOM -Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb -Created /cookbooks/x-1.0.1 -Created /cookbooks/x-1.0.1/metadata.rb -Created /cookbooks/x-1.0.1/onlyin1.0.1.rb + knife("download --purge /cookbooks").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb + Created /cookbooks/x-1.0.1 + Created /cookbooks/x-1.0.1/metadata.rb + Created /cookbooks/x-1.0.1/onlyin1.0.1.rb EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1010,11 +1010,11 @@ EOM end it "knife download /cookbooks downloads the updated file" do - knife("download --purge /cookbooks").should_succeed <<EOM -Created /cookbooks/x-0.9.9 -Created /cookbooks/x-0.9.9/metadata.rb -Created /cookbooks/x-0.9.9/onlyin0.9.9.rb -Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb + knife("download --purge /cookbooks").should_succeed <<~EOM + Created /cookbooks/x-0.9.9 + Created /cookbooks/x-0.9.9/metadata.rb + Created /cookbooks/x-0.9.9/onlyin0.9.9.rb + Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1026,11 +1026,11 @@ EOM end it "knife download /cookbooks/x downloads the latest version" do - knife("download --purge /cookbooks").should_succeed <<EOM -Created /cookbooks/x-1.0.1 -Created /cookbooks/x-1.0.1/metadata.rb -Created /cookbooks/x-1.0.1/onlyin1.0.1.rb -Deleted extra entry /cookbooks/x-1.0.0 (purge is on) + knife("download --purge /cookbooks").should_succeed <<~EOM + Created /cookbooks/x-1.0.1 + Created /cookbooks/x-1.0.1/metadata.rb + Created /cookbooks/x-1.0.1/onlyin1.0.1.rb + Deleted extra entry /cookbooks/x-1.0.0 (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1042,11 +1042,11 @@ EOM end it "knife download --purge /cookbooks downloads the old version and deletes the new version" do - knife("download --purge /cookbooks").should_succeed <<EOM -Created /cookbooks/x-0.9.9 -Created /cookbooks/x-0.9.9/metadata.rb -Created /cookbooks/x-0.9.9/onlyin0.9.9.rb -Deleted extra entry /cookbooks/x-1.0.0 (purge is on) + knife("download --purge /cookbooks").should_succeed <<~EOM + Created /cookbooks/x-0.9.9 + Created /cookbooks/x-0.9.9/metadata.rb + Created /cookbooks/x-0.9.9/onlyin0.9.9.rb + Deleted extra entry /cookbooks/x-1.0.0 (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1102,10 +1102,10 @@ EOM new_result }.at_least(:once) - knife("download /cookbooks/x").should_succeed <<EOM -Created /cookbooks -Created /cookbooks/x -Created /cookbooks/x/metadata.rb + knife("download /cookbooks/x").should_succeed <<~EOM + Created /cookbooks + Created /cookbooks/x + Created /cookbooks/x/metadata.rb EOM end end @@ -1125,70 +1125,70 @@ EOM when_the_repository "has all the default stuff" do before do - knife("download /").should_succeed <<EOM -Created /acls -Created /acls/clients -Created /acls/clients/foo-validator.json -Created /acls/containers -Created /acls/containers/clients.json -Created /acls/containers/containers.json -Created /acls/containers/cookbook_artifacts.json -Created /acls/containers/cookbooks.json -Created /acls/containers/data.json -Created /acls/containers/environments.json -Created /acls/containers/groups.json -Created /acls/containers/nodes.json -Created /acls/containers/policies.json -Created /acls/containers/policy_groups.json -Created /acls/containers/roles.json -Created /acls/containers/sandboxes.json -Created /acls/cookbook_artifacts -Created /acls/cookbooks -Created /acls/data_bags -Created /acls/environments -Created /acls/environments/_default.json -Created /acls/groups -Created /acls/groups/admins.json -Created /acls/groups/billing-admins.json -Created /acls/groups/clients.json -Created /acls/groups/users.json -Created /acls/nodes -Created /acls/policies -Created /acls/policy_groups -Created /acls/roles -Created /acls/organization.json -Created /clients -Created /clients/foo-validator.json -Created /containers -Created /containers/clients.json -Created /containers/containers.json -Created /containers/cookbook_artifacts.json -Created /containers/cookbooks.json -Created /containers/data.json -Created /containers/environments.json -Created /containers/groups.json -Created /containers/nodes.json -Created /containers/policies.json -Created /containers/policy_groups.json -Created /containers/roles.json -Created /containers/sandboxes.json -Created /cookbook_artifacts -Created /cookbooks -Created /data_bags -Created /environments -Created /environments/_default.json -Created /groups -Created /groups/admins.json -Created /groups/billing-admins.json -Created /groups/clients.json -Created /groups/users.json -Created /invitations.json -Created /members.json -Created /nodes -Created /org.json -Created /policies -Created /policy_groups -Created /roles + knife("download /").should_succeed <<~EOM + Created /acls + Created /acls/clients + Created /acls/clients/foo-validator.json + Created /acls/containers + Created /acls/containers/clients.json + Created /acls/containers/containers.json + Created /acls/containers/cookbook_artifacts.json + Created /acls/containers/cookbooks.json + Created /acls/containers/data.json + Created /acls/containers/environments.json + Created /acls/containers/groups.json + Created /acls/containers/nodes.json + Created /acls/containers/policies.json + Created /acls/containers/policy_groups.json + Created /acls/containers/roles.json + Created /acls/containers/sandboxes.json + Created /acls/cookbook_artifacts + Created /acls/cookbooks + Created /acls/data_bags + Created /acls/environments + Created /acls/environments/_default.json + Created /acls/groups + Created /acls/groups/admins.json + Created /acls/groups/billing-admins.json + Created /acls/groups/clients.json + Created /acls/groups/users.json + Created /acls/nodes + Created /acls/policies + Created /acls/policy_groups + Created /acls/roles + Created /acls/organization.json + Created /clients + Created /clients/foo-validator.json + Created /containers + Created /containers/clients.json + Created /containers/containers.json + Created /containers/cookbook_artifacts.json + Created /containers/cookbooks.json + Created /containers/data.json + Created /containers/environments.json + Created /containers/groups.json + Created /containers/nodes.json + Created /containers/policies.json + Created /containers/policy_groups.json + Created /containers/roles.json + Created /containers/sandboxes.json + Created /cookbook_artifacts + Created /cookbooks + Created /data_bags + Created /environments + Created /environments/_default.json + Created /groups + Created /groups/admins.json + Created /groups/billing-admins.json + Created /groups/clients.json + Created /groups/users.json + Created /invitations.json + Created /members.json + Created /nodes + Created /org.json + Created /policies + Created /policy_groups + Created /roles EOM end @@ -1217,43 +1217,43 @@ EOM end before do - knife("download /acls /groups/clients.json /groups/users.json").should_succeed <<-EOM -Created /acls/clients/x.json -Created /acls/containers/x.json -Created /acls/cookbook_artifacts/x.json -Created /acls/cookbooks/x.json -Created /acls/data_bags/x.json -Created /acls/environments/x.json -Created /acls/groups/x.json -Created /acls/nodes/x.json -Created /acls/policies/blah.json -Created /acls/policies/x.json -Created /acls/policy_groups/x.json -Created /acls/roles/x.json -Updated /groups/clients.json -Updated /groups/users.json + knife("download /acls /groups/clients.json /groups/users.json").should_succeed <<~EOM + Created /acls/clients/x.json + Created /acls/containers/x.json + Created /acls/cookbook_artifacts/x.json + Created /acls/cookbooks/x.json + Created /acls/data_bags/x.json + Created /acls/environments/x.json + Created /acls/groups/x.json + Created /acls/nodes/x.json + Created /acls/policies/blah.json + Created /acls/policies/x.json + Created /acls/policy_groups/x.json + Created /acls/roles/x.json + Updated /groups/clients.json + Updated /groups/users.json EOM end it "knife download / downloads everything" do - knife("download /").should_succeed <<EOM -Created /clients/x.json -Created /containers/x.json -Created /cookbook_artifacts/x-1x1 -Created /cookbook_artifacts/x-1x1/metadata.rb -Created /cookbooks/x -Created /cookbooks/x/metadata.rb -Created /data_bags/x -Created /data_bags/x/y.json -Created /environments/x.json -Created /groups/x.json -Updated /invitations.json -Updated /members.json -Created /nodes/x.json -Created /policies/blah-1.0.0.json -Created /policies/x-1.0.0.json -Created /policy_groups/x.json -Created /roles/x.json + knife("download /").should_succeed <<~EOM + Created /clients/x.json + Created /containers/x.json + Created /cookbook_artifacts/x-1x1 + Created /cookbook_artifacts/x-1x1/metadata.rb + Created /cookbooks/x + Created /cookbooks/x/metadata.rb + Created /data_bags/x + Created /data_bags/x/y.json + Created /environments/x.json + Created /groups/x.json + Updated /invitations.json + Updated /members.json + Created /nodes/x.json + Created /policies/blah-1.0.0.json + Created /policies/x-1.0.0.json + Created /policy_groups/x.json + Created /roles/x.json EOM knife("diff --name-status /").should_succeed "" end @@ -1308,21 +1308,21 @@ EOM end it "knife download updates everything" do - knife("download /").should_succeed <<EOM -Updated /clients/x.json -Updated /cookbook_artifacts/x-1x1/metadata.rb -Updated /cookbooks/x/metadata.rb -Updated /data_bags/x/y.json -Updated /environments/x.json -Updated /groups/x.json -Updated /invitations.json -Updated /members.json -Updated /nodes/x.json -Updated /org.json -Created /policies/blah-1.0.0.json -Updated /policies/x-1.0.0.json -Updated /policy_groups/x.json -Updated /roles/x.json + knife("download /").should_succeed <<~EOM + Updated /clients/x.json + Updated /cookbook_artifacts/x-1x1/metadata.rb + Updated /cookbooks/x/metadata.rb + Updated /data_bags/x/y.json + Updated /environments/x.json + Updated /groups/x.json + Updated /invitations.json + Updated /members.json + Updated /nodes/x.json + Updated /org.json + Created /policies/blah-1.0.0.json + Updated /policies/x-1.0.0.json + Updated /policy_groups/x.json + Updated /roles/x.json EOM knife("diff --name-status /").should_succeed "" end diff --git a/spec/integration/knife/environment_compare_spec.rb b/spec/integration/knife/environment_compare_spec.rb index 720bead8c0..d3999fffa3 100644 --- a/spec/integration/knife/environment_compare_spec.rb +++ b/spec/integration/knife/environment_compare_spec.rb @@ -44,29 +44,29 @@ describe "knife environment compare", :workstation do # rubocop:disable Layout/TrailingWhitespace it "displays the cookbooks for a single environment" do - knife("environment compare x").should_succeed <<EOM - x -blah = 1.0.0 -krad >= 1.0.0 - + knife("environment compare x").should_succeed <<~EOM + x + blah = 1.0.0 + krad >= 1.0.0 + EOM end it "compares the cookbooks for two environments" do - knife("environment compare x y").should_succeed <<EOM - x y -blah = 1.0.0 = 1.1.0 -krad >= 1.0.0 >= 1.0.0 - + knife("environment compare x y").should_succeed <<~EOM + x y + blah = 1.0.0 = 1.1.0 + krad >= 1.0.0 >= 1.0.0 + EOM end it "compares the cookbooks for all environments" do - knife("environment compare --all").should_succeed <<EOM - x y -blah = 1.0.0 = 1.1.0 -krad >= 1.0.0 >= 1.0.0 - + knife("environment compare --all").should_succeed <<~EOM + x y + blah = 1.0.0 = 1.1.0 + krad >= 1.0.0 >= 1.0.0 + EOM end # rubocop:enable Layout/TrailingWhitespace diff --git a/spec/integration/knife/environment_from_file_spec.rb b/spec/integration/knife/environment_from_file_spec.rb index 67d4373939..0831ef5518 100644 --- a/spec/integration/knife/environment_from_file_spec.rb +++ b/spec/integration/knife/environment_from_file_spec.rb @@ -29,84 +29,84 @@ describe "knife environment from file", :workstation do when_the_repository "has some environments" do before do - file "environments/cons.json", <<EOM -{ - "name": "cons", - "description": "An environment", - "cookbook_versions": { - - }, - "json_class": "Chef::Environment", - "chef_type": "environment", - "default_attributes": { - "hola": "Amigos!" - }, - "override_attributes": { - - } -} + file "environments/cons.json", <<~EOM + { + "name": "cons", + "description": "An environment", + "cookbook_versions": { + + }, + "json_class": "Chef::Environment", + "chef_type": "environment", + "default_attributes": { + "hola": "Amigos!" + }, + "override_attributes": { + + } + } EOM - file "environments/car.json", <<EOM -{ - "name": "car", - "description": "An environment for list nodes", - "cookbook_versions": { - - }, - "json_class": "Chef::Environment", - "chef_type": "environment", - "default_attributes": { - "hola": "Amigos!" - }, - "override_attributes": { - - } -} + file "environments/car.json", <<~EOM + { + "name": "car", + "description": "An environment for list nodes", + "cookbook_versions": { + + }, + "json_class": "Chef::Environment", + "chef_type": "environment", + "default_attributes": { + "hola": "Amigos!" + }, + "override_attributes": { + + } + } EOM - file "environments/cdr.json", <<EOM -{ - "name": "cdr", - "description": "An environment for last nodes", - "cookbook_versions": { - - }, - "json_class": "Chef::Environment", - "chef_type": "environment", - "default_attributes": { - "hola": "Amigos!" - }, - "override_attributes": { - - } -} + file "environments/cdr.json", <<~EOM + { + "name": "cdr", + "description": "An environment for last nodes", + "cookbook_versions": { + + }, + "json_class": "Chef::Environment", + "chef_type": "environment", + "default_attributes": { + "hola": "Amigos!" + }, + "override_attributes": { + + } + } EOM end it "uploads a single file" do - knife("environment from file #{env_dir}/cons.json").should_succeed stderr: <<EOM -Updated Environment cons + knife("environment from file #{env_dir}/cons.json").should_succeed stderr: <<~EOM + Updated Environment cons EOM end it "uploads many files" do - knife("environment from file #{env_dir}/cons.json #{env_dir}/car.json #{env_dir}/cdr.json").should_succeed stderr: <<EOM -Updated Environment cons -Updated Environment car -Updated Environment cdr + knife("environment from file #{env_dir}/cons.json #{env_dir}/car.json #{env_dir}/cdr.json").should_succeed stderr: <<~EOM + Updated Environment cons + Updated Environment car + Updated Environment cdr EOM end it "uploads all environments in the repository" do cwd(".") knife("environment from file --all") - knife("environment list").should_succeed <<EOM -_default -car -cdr -cons + knife("environment list").should_succeed <<~EOM + _default + car + cdr + cons EOM end diff --git a/spec/integration/knife/environment_list_spec.rb b/spec/integration/knife/environment_list_spec.rb index 5e74453d1f..0ac2df6300 100644 --- a/spec/integration/knife/environment_list_spec.rb +++ b/spec/integration/knife/environment_list_spec.rb @@ -30,10 +30,10 @@ describe "knife environment list", :workstation do end it "lists all the environments" do - knife("environment list").should_succeed <<EOM -_default -b -y + knife("environment list").should_succeed <<~EOM + _default + b + y EOM end diff --git a/spec/integration/knife/environment_show_spec.rb b/spec/integration/knife/environment_show_spec.rb index dabdfac6a2..fdf41e70ce 100644 --- a/spec/integration/knife/environment_show_spec.rb +++ b/spec/integration/knife/environment_show_spec.rb @@ -32,44 +32,44 @@ describe "knife environment show", :workstation do # rubocop:disable Layout/TrailingWhitespace it "shows an environment" do - knife("environment show b").should_succeed <<EOM -chef_type: environment -cookbook_versions: -default_attributes: - baz: - raz.my: mataz - foo: bar -description: -json_class: Chef::Environment -name: b -override_attributes: + knife("environment show b").should_succeed <<~EOM + chef_type: environment + cookbook_versions: + default_attributes: + baz: + raz.my: mataz + foo: bar + description: + json_class: Chef::Environment + name: b + override_attributes: EOM end # rubocop:enable Layout/TrailingWhitespace it "shows the requested attribute of an environment" do - knife("environment show b -a default_attributes").should_succeed <<EOM -b: - default_attributes: - baz: - raz.my: mataz - foo: bar + knife("environment show b -a default_attributes").should_succeed <<~EOM + b: + default_attributes: + baz: + raz.my: mataz + foo: bar EOM end it "shows the requested nested attribute of an environment" do - knife("environment show b -a default_attributes.baz").should_succeed <<EON -b: - default_attributes.baz: - raz.my: mataz + knife("environment show b -a default_attributes.baz").should_succeed <<~EON + b: + default_attributes.baz: + raz.my: mataz EON end it "shows the requested attribute of an environment with custom field separator" do - knife("environment show b -S: -a default_attributes:baz").should_succeed <<EOT -b: - default_attributes:baz: - raz.my: mataz + knife("environment show b -S: -a default_attributes:baz").should_succeed <<~EOT + b: + default_attributes:baz: + raz.my: mataz EOT end end diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb index bcafd40e9b..bee9892220 100644 --- a/spec/integration/knife/list_spec.rb +++ b/spec/integration/knife/list_spec.rb @@ -27,45 +27,45 @@ describe "knife list", :workstation do when_the_chef_server "is empty" do it "knife list / returns all top level directories" do - knife("list /").should_succeed <<-EOM -/clients -/cookbooks -/data_bags -/environments -/nodes -/roles -/users + knife("list /").should_succeed <<~EOM + /clients + /cookbooks + /data_bags + /environments + /nodes + /roles + /users EOM end it "knife list -R / returns everything" do - knife("list -R /").should_succeed <<-EOM -/: -clients -cookbooks -data_bags -environments -nodes -roles -users - -/clients: -chef-validator.json -chef-webui.json - -/cookbooks: - -/data_bags: - -/environments: -_default.json - -/nodes: - -/roles: - -/users: -admin.json + knife("list -R /").should_succeed <<~EOM + /: + clients + cookbooks + data_bags + environments + nodes + roles + users + + /clients: + chef-validator.json + chef-webui.json + + /cookbooks: + + /data_bags: + + /environments: + _default.json + + /nodes: + + /roles: + + /users: + admin.json EOM end end @@ -92,160 +92,160 @@ EOM end it "knife list / returns all top level directories" do - knife("list /").should_succeed <<-EOM -/clients -/cookbooks -/data_bags -/environments -/nodes -/roles -/users + knife("list /").should_succeed <<~EOM + /clients + /cookbooks + /data_bags + /environments + /nodes + /roles + /users EOM end it "knife list -R / returns everything" do - knife("list -R /").should_succeed <<-EOM -/: -clients -cookbooks -data_bags -environments -nodes -roles -users - -/clients: -chef-validator.json -chef-webui.json -client1.json -client2.json - -/cookbooks: -cookbook1 -cookbook2 - -/cookbooks/cookbook1: -metadata.rb - -/cookbooks/cookbook2: -metadata.rb -recipes - -/cookbooks/cookbook2/recipes: -default.rb - -/data_bags: -bag1 -bag2 - -/data_bags/bag1: -item1.json -item2.json - -/data_bags/bag2: -item1.json -item2.json - -/environments: -_default.json -environment1.json -environment2.json - -/nodes: -node1.json -node2.json - -/roles: -role1.json -role2.json - -/users: -admin.json -user1.json -user2.json + knife("list -R /").should_succeed <<~EOM + /: + clients + cookbooks + data_bags + environments + nodes + roles + users + + /clients: + chef-validator.json + chef-webui.json + client1.json + client2.json + + /cookbooks: + cookbook1 + cookbook2 + + /cookbooks/cookbook1: + metadata.rb + + /cookbooks/cookbook2: + metadata.rb + recipes + + /cookbooks/cookbook2/recipes: + default.rb + + /data_bags: + bag1 + bag2 + + /data_bags/bag1: + item1.json + item2.json + + /data_bags/bag2: + item1.json + item2.json + + /environments: + _default.json + environment1.json + environment2.json + + /nodes: + node1.json + node2.json + + /roles: + role1.json + role2.json + + /users: + admin.json + user1.json + user2.json EOM end it "knife list -R --flat / returns everything" do - knife("list -R --flat /").should_succeed <<-EOM -/clients -/clients/chef-validator.json -/clients/chef-webui.json -/clients/client1.json -/clients/client2.json -/cookbooks -/cookbooks/cookbook1 -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2 -/cookbooks/cookbook2/metadata.rb -/cookbooks/cookbook2/recipes -/cookbooks/cookbook2/recipes/default.rb -/data_bags -/data_bags/bag1 -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2 -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json -/environments -/environments/_default.json -/environments/environment1.json -/environments/environment2.json -/nodes -/nodes/node1.json -/nodes/node2.json -/roles -/roles/role1.json -/roles/role2.json -/users -/users/admin.json -/users/user1.json -/users/user2.json + knife("list -R --flat /").should_succeed <<~EOM + /clients + /clients/chef-validator.json + /clients/chef-webui.json + /clients/client1.json + /clients/client2.json + /cookbooks + /cookbooks/cookbook1 + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2 + /cookbooks/cookbook2/metadata.rb + /cookbooks/cookbook2/recipes + /cookbooks/cookbook2/recipes/default.rb + /data_bags + /data_bags/bag1 + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2 + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json + /environments + /environments/_default.json + /environments/environment1.json + /environments/environment2.json + /nodes + /nodes/node1.json + /nodes/node2.json + /roles + /roles/role1.json + /roles/role2.json + /users + /users/admin.json + /users/user1.json + /users/user2.json EOM end it "knife list -Rfp / returns everything" do - knife("list -Rfp /").should_succeed <<-EOM -/clients/ -/clients/chef-validator.json -/clients/chef-webui.json -/clients/client1.json -/clients/client2.json -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/ -/cookbooks/cookbook2/metadata.rb -/cookbooks/cookbook2/recipes/ -/cookbooks/cookbook2/recipes/default.rb -/data_bags/ -/data_bags/bag1/ -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2/ -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json -/environments/ -/environments/_default.json -/environments/environment1.json -/environments/environment2.json -/nodes/ -/nodes/node1.json -/nodes/node2.json -/roles/ -/roles/role1.json -/roles/role2.json -/users/ -/users/admin.json -/users/user1.json -/users/user2.json + knife("list -Rfp /").should_succeed <<~EOM + /clients/ + /clients/chef-validator.json + /clients/chef-webui.json + /clients/client1.json + /clients/client2.json + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/ + /cookbooks/cookbook2/metadata.rb + /cookbooks/cookbook2/recipes/ + /cookbooks/cookbook2/recipes/default.rb + /data_bags/ + /data_bags/bag1/ + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2/ + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json + /environments/ + /environments/_default.json + /environments/environment1.json + /environments/environment2.json + /nodes/ + /nodes/node1.json + /nodes/node2.json + /roles/ + /roles/role1.json + /roles/role2.json + /users/ + /users/admin.json + /users/user1.json + /users/user2.json EOM end it "knife list /cookbooks returns the list of cookbooks" do - knife("list /cookbooks").should_succeed <<-EOM -/cookbooks/cookbook1 -/cookbooks/cookbook2 + knife("list /cookbooks").should_succeed <<~EOM + /cookbooks/cookbook1 + /cookbooks/cookbook2 EOM end @@ -254,50 +254,50 @@ EOM end it "knife list /**.rb returns all ruby files" do - knife("list /**.rb").should_succeed <<-EOM -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/metadata.rb -/cookbooks/cookbook2/recipes/default.rb + knife("list /**.rb").should_succeed <<~EOM + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/metadata.rb + /cookbooks/cookbook2/recipes/default.rb EOM end it "knife list /cookbooks/**.rb returns all ruby files" do - knife("list /cookbooks/**.rb").should_succeed <<-EOM -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/metadata.rb -/cookbooks/cookbook2/recipes/default.rb + knife("list /cookbooks/**.rb").should_succeed <<~EOM + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/metadata.rb + /cookbooks/cookbook2/recipes/default.rb EOM end it "knife list /**.json returns all json files" do - knife("list /**.json").should_succeed <<-EOM -/clients/chef-validator.json -/clients/chef-webui.json -/clients/client1.json -/clients/client2.json -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json -/environments/_default.json -/environments/environment1.json -/environments/environment2.json -/nodes/node1.json -/nodes/node2.json -/roles/role1.json -/roles/role2.json -/users/admin.json -/users/user1.json -/users/user2.json + knife("list /**.json").should_succeed <<~EOM + /clients/chef-validator.json + /clients/chef-webui.json + /clients/client1.json + /clients/client2.json + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json + /environments/_default.json + /environments/environment1.json + /environments/environment2.json + /nodes/node1.json + /nodes/node2.json + /roles/role1.json + /roles/role2.json + /users/admin.json + /users/user1.json + /users/user2.json EOM end it "knife list /data**.json returns all data bag json files" do - knife("list /data**.json").should_succeed <<-EOM -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json + knife("list /data**.json").should_succeed <<~EOM + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json EOM end @@ -317,40 +317,40 @@ EOM before { cwd "." } it "knife list -Rfp returns everything" do - knife("list -Rfp").should_succeed <<-EOM -clients/ -clients/chef-validator.json -clients/chef-webui.json -clients/client1.json -clients/client2.json -cookbooks/ -cookbooks/cookbook1/ -cookbooks/cookbook1/metadata.rb -cookbooks/cookbook2/ -cookbooks/cookbook2/metadata.rb -cookbooks/cookbook2/recipes/ -cookbooks/cookbook2/recipes/default.rb -data_bags/ -data_bags/bag1/ -data_bags/bag1/item1.json -data_bags/bag1/item2.json -data_bags/bag2/ -data_bags/bag2/item1.json -data_bags/bag2/item2.json -environments/ -environments/_default.json -environments/environment1.json -environments/environment2.json -nodes/ -nodes/node1.json -nodes/node2.json -roles/ -roles/role1.json -roles/role2.json -users/ -users/admin.json -users/user1.json -users/user2.json + knife("list -Rfp").should_succeed <<~EOM + clients/ + clients/chef-validator.json + clients/chef-webui.json + clients/client1.json + clients/client2.json + cookbooks/ + cookbooks/cookbook1/ + cookbooks/cookbook1/metadata.rb + cookbooks/cookbook2/ + cookbooks/cookbook2/metadata.rb + cookbooks/cookbook2/recipes/ + cookbooks/cookbook2/recipes/default.rb + data_bags/ + data_bags/bag1/ + data_bags/bag1/item1.json + data_bags/bag1/item2.json + data_bags/bag2/ + data_bags/bag2/item1.json + data_bags/bag2/item2.json + environments/ + environments/_default.json + environments/environment1.json + environments/environment2.json + nodes/ + nodes/node1.json + nodes/node2.json + roles/ + roles/role1.json + roles/role2.json + users/ + users/admin.json + users/user1.json + users/user2.json EOM end end @@ -362,89 +362,89 @@ EOM before { cwd "cookbooks" } it "knife list -Rfp / returns everything" do - knife("list -Rfp /").should_succeed <<-EOM -/clients/ -/clients/chef-validator.json -/clients/chef-webui.json -/clients/client1.json -/clients/client2.json -./ -cookbook1/ -cookbook1/metadata.rb -cookbook2/ -cookbook2/metadata.rb -cookbook2/recipes/ -cookbook2/recipes/default.rb -/data_bags/ -/data_bags/bag1/ -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2/ -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json -/environments/ -/environments/_default.json -/environments/environment1.json -/environments/environment2.json -/nodes/ -/nodes/node1.json -/nodes/node2.json -/roles/ -/roles/role1.json -/roles/role2.json -/users/ -/users/admin.json -/users/user1.json -/users/user2.json + knife("list -Rfp /").should_succeed <<~EOM + /clients/ + /clients/chef-validator.json + /clients/chef-webui.json + /clients/client1.json + /clients/client2.json + ./ + cookbook1/ + cookbook1/metadata.rb + cookbook2/ + cookbook2/metadata.rb + cookbook2/recipes/ + cookbook2/recipes/default.rb + /data_bags/ + /data_bags/bag1/ + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2/ + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json + /environments/ + /environments/_default.json + /environments/environment1.json + /environments/environment2.json + /nodes/ + /nodes/node1.json + /nodes/node2.json + /roles/ + /roles/role1.json + /roles/role2.json + /users/ + /users/admin.json + /users/user1.json + /users/user2.json EOM end it "knife list -Rfp .. returns everything" do - knife("list -Rfp ..").should_succeed <<-EOM -/clients/ -/clients/chef-validator.json -/clients/chef-webui.json -/clients/client1.json -/clients/client2.json -./ -cookbook1/ -cookbook1/metadata.rb -cookbook2/ -cookbook2/metadata.rb -cookbook2/recipes/ -cookbook2/recipes/default.rb -/data_bags/ -/data_bags/bag1/ -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2/ -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json -/environments/ -/environments/_default.json -/environments/environment1.json -/environments/environment2.json -/nodes/ -/nodes/node1.json -/nodes/node2.json -/roles/ -/roles/role1.json -/roles/role2.json -/users/ -/users/admin.json -/users/user1.json -/users/user2.json + knife("list -Rfp ..").should_succeed <<~EOM + /clients/ + /clients/chef-validator.json + /clients/chef-webui.json + /clients/client1.json + /clients/client2.json + ./ + cookbook1/ + cookbook1/metadata.rb + cookbook2/ + cookbook2/metadata.rb + cookbook2/recipes/ + cookbook2/recipes/default.rb + /data_bags/ + /data_bags/bag1/ + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2/ + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json + /environments/ + /environments/_default.json + /environments/environment1.json + /environments/environment2.json + /nodes/ + /nodes/node1.json + /nodes/node2.json + /roles/ + /roles/role1.json + /roles/role2.json + /users/ + /users/admin.json + /users/user1.json + /users/user2.json EOM end it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<-EOM -cookbook1/ -cookbook1/metadata.rb -cookbook2/ -cookbook2/metadata.rb -cookbook2/recipes/ -cookbook2/recipes/default.rb + knife("list -Rfp").should_succeed <<~EOM + cookbook1/ + cookbook1/metadata.rb + cookbook2/ + cookbook2/metadata.rb + cookbook2/recipes/ + cookbook2/recipes/default.rb EOM end end @@ -457,10 +457,10 @@ EOM before { cwd "cookbooks/cookbook2" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<-EOM -metadata.rb -recipes/ -recipes/default.rb + knife("list -Rfp").should_succeed <<~EOM + metadata.rb + recipes/ + recipes/default.rb EOM end end @@ -476,13 +476,13 @@ EOM before { cwd "cookbooks" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<-EOM -cookbook1/ -cookbook1/metadata.rb -cookbook2/ -cookbook2/metadata.rb -cookbook2/recipes/ -cookbook2/recipes/default.rb + knife("list -Rfp").should_succeed <<~EOM + cookbook1/ + cookbook1/metadata.rb + cookbook2/ + cookbook2/metadata.rb + cookbook2/recipes/ + cookbook2/recipes/default.rb EOM end end @@ -491,13 +491,13 @@ EOM before { cwd "symlinked" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<-EOM -cookbook1/ -cookbook1/metadata.rb -cookbook2/ -cookbook2/metadata.rb -cookbook2/recipes/ -cookbook2/recipes/default.rb + knife("list -Rfp").should_succeed <<~EOM + cookbook1/ + cookbook1/metadata.rb + cookbook2/ + cookbook2/metadata.rb + cookbook2/recipes/ + cookbook2/recipes/default.rb EOM end end @@ -513,13 +513,13 @@ EOM before { cwd "real_cookbooks" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<-EOM -cookbook1/ -cookbook1/metadata.rb -cookbook2/ -cookbook2/metadata.rb -cookbook2/recipes/ -cookbook2/recipes/default.rb + knife("list -Rfp").should_succeed <<~EOM + cookbook1/ + cookbook1/metadata.rb + cookbook2/ + cookbook2/metadata.rb + cookbook2/recipes/ + cookbook2/recipes/default.rb EOM end end @@ -528,13 +528,13 @@ EOM before { cwd "cookbooks" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<-EOM -cookbook1/ -cookbook1/metadata.rb -cookbook2/ -cookbook2/metadata.rb -cookbook2/recipes/ -cookbook2/recipes/default.rb + knife("list -Rfp").should_succeed <<~EOM + cookbook1/ + cookbook1/metadata.rb + cookbook2/ + cookbook2/metadata.rb + cookbook2/recipes/ + cookbook2/recipes/default.rb EOM end end @@ -589,36 +589,36 @@ EOM end it "knife list -Rfp / returns everything" do - knife("list -Rp --local --flat /").should_succeed <<-EOM -/clients/ -/clients/client1.json -/clients/client2.json -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/ -/cookbooks/cookbook2/metadata.rb -/cookbooks/cookbook2/recipes/ -/cookbooks/cookbook2/recipes/default.rb -/data_bags/ -/data_bags/bag1/ -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2/ -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json -/environments/ -/environments/environment1.json -/environments/environment2.json -/nodes/ -/nodes/node1.json -/nodes/node2.json -/roles/ -/roles/role1.json -/roles/role2.json -/users/ -/users/user1.json -/users/user2.json + knife("list -Rp --local --flat /").should_succeed <<~EOM + /clients/ + /clients/client1.json + /clients/client2.json + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/ + /cookbooks/cookbook2/metadata.rb + /cookbooks/cookbook2/recipes/ + /cookbooks/cookbook2/recipes/default.rb + /data_bags/ + /data_bags/bag1/ + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2/ + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json + /environments/ + /environments/environment1.json + /environments/environment2.json + /nodes/ + /nodes/node1.json + /nodes/node2.json + /roles/ + /roles/role1.json + /roles/role2.json + /users/ + /users/user1.json + /users/user2.json EOM end @@ -649,253 +649,253 @@ EOM context "and is empty" do it "knife list / returns all top level directories" do - knife("list /").should_succeed <<-EOM -/acls -/clients -/containers -/cookbook_artifacts -/cookbooks -/data_bags -/environments -/groups -/invitations.json -/members.json -/nodes -/org.json -/policies -/policy_groups -/roles + knife("list /").should_succeed <<~EOM + /acls + /clients + /containers + /cookbook_artifacts + /cookbooks + /data_bags + /environments + /groups + /invitations.json + /members.json + /nodes + /org.json + /policies + /policy_groups + /roles EOM end it "knife list -R / returns everything" do - knife("list -R /").should_succeed <<-EOM -/: -acls -clients -containers -cookbook_artifacts -cookbooks -data_bags -environments -groups -invitations.json -members.json -nodes -org.json -policies -policy_groups -roles - -/acls: -clients -containers -cookbook_artifacts -cookbooks -data_bags -environments -groups -nodes -organization.json -policies -policy_groups -roles - -/acls/clients: -foo-validator.json - -/acls/containers: -clients.json -containers.json -cookbook_artifacts.json -cookbooks.json -data.json -environments.json -groups.json -nodes.json -policies.json -policy_groups.json -roles.json -sandboxes.json - -/acls/cookbook_artifacts: - -/acls/cookbooks: - -/acls/data_bags: - -/acls/environments: -_default.json - -/acls/groups: -admins.json -billing-admins.json -clients.json -users.json - -/acls/nodes: - -/acls/policies: - -/acls/policy_groups: - -/acls/roles: - -/clients: -foo-validator.json - -/containers: -clients.json -containers.json -cookbook_artifacts.json -cookbooks.json -data.json -environments.json -groups.json -nodes.json -policies.json -policy_groups.json -roles.json -sandboxes.json - -/cookbook_artifacts: - -/cookbooks: - -/data_bags: - -/environments: -_default.json - -/groups: -admins.json -billing-admins.json -clients.json -users.json - -/nodes: - -/policies: - -/policy_groups: - -/roles: + knife("list -R /").should_succeed <<~EOM + /: + acls + clients + containers + cookbook_artifacts + cookbooks + data_bags + environments + groups + invitations.json + members.json + nodes + org.json + policies + policy_groups + roles + + /acls: + clients + containers + cookbook_artifacts + cookbooks + data_bags + environments + groups + nodes + organization.json + policies + policy_groups + roles + + /acls/clients: + foo-validator.json + + /acls/containers: + clients.json + containers.json + cookbook_artifacts.json + cookbooks.json + data.json + environments.json + groups.json + nodes.json + policies.json + policy_groups.json + roles.json + sandboxes.json + + /acls/cookbook_artifacts: + + /acls/cookbooks: + + /acls/data_bags: + + /acls/environments: + _default.json + + /acls/groups: + admins.json + billing-admins.json + clients.json + users.json + + /acls/nodes: + + /acls/policies: + + /acls/policy_groups: + + /acls/roles: + + /clients: + foo-validator.json + + /containers: + clients.json + containers.json + cookbook_artifacts.json + cookbooks.json + data.json + environments.json + groups.json + nodes.json + policies.json + policy_groups.json + roles.json + sandboxes.json + + /cookbook_artifacts: + + /cookbooks: + + /data_bags: + + /environments: + _default.json + + /groups: + admins.json + billing-admins.json + clients.json + users.json + + /nodes: + + /policies: + + /policy_groups: + + /roles: EOM end end it "knife list -R / returns everything" do - knife("list -R /").should_succeed <<-EOM -/: -acls -clients -containers -cookbook_artifacts -cookbooks -data_bags -environments -groups -invitations.json -members.json -nodes -org.json -policies -policy_groups -roles - -/acls: -clients -containers -cookbook_artifacts -cookbooks -data_bags -environments -groups -nodes -organization.json -policies -policy_groups -roles - -/acls/clients: -foo-validator.json - -/acls/containers: -clients.json -containers.json -cookbook_artifacts.json -cookbooks.json -data.json -environments.json -groups.json -nodes.json -policies.json -policy_groups.json -roles.json -sandboxes.json - -/acls/cookbook_artifacts: - -/acls/cookbooks: - -/acls/data_bags: - -/acls/environments: -_default.json - -/acls/groups: -admins.json -billing-admins.json -clients.json -users.json - -/acls/nodes: - -/acls/policies: - -/acls/policy_groups: - -/acls/roles: - -/clients: -foo-validator.json - -/containers: -clients.json -containers.json -cookbook_artifacts.json -cookbooks.json -data.json -environments.json -groups.json -nodes.json -policies.json -policy_groups.json -roles.json -sandboxes.json - -/cookbook_artifacts: - -/cookbooks: - -/data_bags: - -/environments: -_default.json - -/groups: -admins.json -billing-admins.json -clients.json -users.json - -/nodes: - -/policies: - -/policy_groups: - -/roles: + knife("list -R /").should_succeed <<~EOM + /: + acls + clients + containers + cookbook_artifacts + cookbooks + data_bags + environments + groups + invitations.json + members.json + nodes + org.json + policies + policy_groups + roles + + /acls: + clients + containers + cookbook_artifacts + cookbooks + data_bags + environments + groups + nodes + organization.json + policies + policy_groups + roles + + /acls/clients: + foo-validator.json + + /acls/containers: + clients.json + containers.json + cookbook_artifacts.json + cookbooks.json + data.json + environments.json + groups.json + nodes.json + policies.json + policy_groups.json + roles.json + sandboxes.json + + /acls/cookbook_artifacts: + + /acls/cookbooks: + + /acls/data_bags: + + /acls/environments: + _default.json + + /acls/groups: + admins.json + billing-admins.json + clients.json + users.json + + /acls/nodes: + + /acls/policies: + + /acls/policy_groups: + + /acls/roles: + + /clients: + foo-validator.json + + /containers: + clients.json + containers.json + cookbook_artifacts.json + cookbooks.json + data.json + environments.json + groups.json + nodes.json + policies.json + policy_groups.json + roles.json + sandboxes.json + + /cookbook_artifacts: + + /cookbooks: + + /data_bags: + + /environments: + _default.json + + /groups: + admins.json + billing-admins.json + clients.json + users.json + + /nodes: + + /policies: + + /policy_groups: + + /roles: EOM end @@ -931,127 +931,127 @@ EOM end it "knife list -Rfp / returns everything" do - knife("list -Rfp /").should_succeed <<-EOM -/acls/ -/acls/clients/ -/acls/clients/client1.json -/acls/clients/client2.json -/acls/clients/foo-validator.json -/acls/containers/ -/acls/containers/clients.json -/acls/containers/container1.json -/acls/containers/container2.json -/acls/containers/containers.json -/acls/containers/cookbook_artifacts.json -/acls/containers/cookbooks.json -/acls/containers/data.json -/acls/containers/environments.json -/acls/containers/groups.json -/acls/containers/nodes.json -/acls/containers/policies.json -/acls/containers/policy_groups.json -/acls/containers/roles.json -/acls/containers/sandboxes.json -/acls/cookbook_artifacts/ -/acls/cookbook_artifacts/cookbook_artifact1.json -/acls/cookbook_artifacts/cookbook_artifact2.json -/acls/cookbooks/ -/acls/cookbooks/cookbook1.json -/acls/cookbooks/cookbook2.json -/acls/data_bags/ -/acls/data_bags/bag1.json -/acls/data_bags/bag2.json -/acls/environments/ -/acls/environments/_default.json -/acls/environments/environment1.json -/acls/environments/environment2.json -/acls/groups/ -/acls/groups/admins.json -/acls/groups/billing-admins.json -/acls/groups/clients.json -/acls/groups/group1.json -/acls/groups/group2.json -/acls/groups/users.json -/acls/nodes/ -/acls/nodes/node1.json -/acls/nodes/node2.json -/acls/organization.json -/acls/policies/ -/acls/policies/policy1.json -/acls/policies/policy2.json -/acls/policy_groups/ -/acls/policy_groups/policy_group1.json -/acls/policy_groups/policy_group2.json -/acls/roles/ -/acls/roles/role1.json -/acls/roles/role2.json -/clients/ -/clients/client1.json -/clients/client2.json -/clients/foo-validator.json -/containers/ -/containers/clients.json -/containers/container1.json -/containers/container2.json -/containers/containers.json -/containers/cookbook_artifacts.json -/containers/cookbooks.json -/containers/data.json -/containers/environments.json -/containers/groups.json -/containers/nodes.json -/containers/policies.json -/containers/policy_groups.json -/containers/roles.json -/containers/sandboxes.json -/cookbook_artifacts/ -/cookbook_artifacts/cookbook_artifact1-1x1/ -/cookbook_artifacts/cookbook_artifact1-1x1/metadata.rb -/cookbook_artifacts/cookbook_artifact2-2x2/ -/cookbook_artifacts/cookbook_artifact2-2x2/metadata.rb -/cookbook_artifacts/cookbook_artifact2-2x2/recipes/ -/cookbook_artifacts/cookbook_artifact2-2x2/recipes/default.rb -/cookbooks/ -/cookbooks/cookbook1/ -/cookbooks/cookbook1/metadata.rb -/cookbooks/cookbook2/ -/cookbooks/cookbook2/metadata.rb -/cookbooks/cookbook2/recipes/ -/cookbooks/cookbook2/recipes/default.rb -/data_bags/ -/data_bags/bag1/ -/data_bags/bag1/item1.json -/data_bags/bag1/item2.json -/data_bags/bag2/ -/data_bags/bag2/item1.json -/data_bags/bag2/item2.json -/environments/ -/environments/_default.json -/environments/environment1.json -/environments/environment2.json -/groups/ -/groups/admins.json -/groups/billing-admins.json -/groups/clients.json -/groups/group1.json -/groups/group2.json -/groups/users.json -/invitations.json -/members.json -/nodes/ -/nodes/node1.json -/nodes/node2.json -/org.json -/policies/ -/policies/policy1-1.2.3.json -/policies/policy2-1.2.3.json -/policies/policy2-1.3.5.json -/policy_groups/ -/policy_groups/policy_group1.json -/policy_groups/policy_group2.json -/roles/ -/roles/role1.json -/roles/role2.json + knife("list -Rfp /").should_succeed <<~EOM + /acls/ + /acls/clients/ + /acls/clients/client1.json + /acls/clients/client2.json + /acls/clients/foo-validator.json + /acls/containers/ + /acls/containers/clients.json + /acls/containers/container1.json + /acls/containers/container2.json + /acls/containers/containers.json + /acls/containers/cookbook_artifacts.json + /acls/containers/cookbooks.json + /acls/containers/data.json + /acls/containers/environments.json + /acls/containers/groups.json + /acls/containers/nodes.json + /acls/containers/policies.json + /acls/containers/policy_groups.json + /acls/containers/roles.json + /acls/containers/sandboxes.json + /acls/cookbook_artifacts/ + /acls/cookbook_artifacts/cookbook_artifact1.json + /acls/cookbook_artifacts/cookbook_artifact2.json + /acls/cookbooks/ + /acls/cookbooks/cookbook1.json + /acls/cookbooks/cookbook2.json + /acls/data_bags/ + /acls/data_bags/bag1.json + /acls/data_bags/bag2.json + /acls/environments/ + /acls/environments/_default.json + /acls/environments/environment1.json + /acls/environments/environment2.json + /acls/groups/ + /acls/groups/admins.json + /acls/groups/billing-admins.json + /acls/groups/clients.json + /acls/groups/group1.json + /acls/groups/group2.json + /acls/groups/users.json + /acls/nodes/ + /acls/nodes/node1.json + /acls/nodes/node2.json + /acls/organization.json + /acls/policies/ + /acls/policies/policy1.json + /acls/policies/policy2.json + /acls/policy_groups/ + /acls/policy_groups/policy_group1.json + /acls/policy_groups/policy_group2.json + /acls/roles/ + /acls/roles/role1.json + /acls/roles/role2.json + /clients/ + /clients/client1.json + /clients/client2.json + /clients/foo-validator.json + /containers/ + /containers/clients.json + /containers/container1.json + /containers/container2.json + /containers/containers.json + /containers/cookbook_artifacts.json + /containers/cookbooks.json + /containers/data.json + /containers/environments.json + /containers/groups.json + /containers/nodes.json + /containers/policies.json + /containers/policy_groups.json + /containers/roles.json + /containers/sandboxes.json + /cookbook_artifacts/ + /cookbook_artifacts/cookbook_artifact1-1x1/ + /cookbook_artifacts/cookbook_artifact1-1x1/metadata.rb + /cookbook_artifacts/cookbook_artifact2-2x2/ + /cookbook_artifacts/cookbook_artifact2-2x2/metadata.rb + /cookbook_artifacts/cookbook_artifact2-2x2/recipes/ + /cookbook_artifacts/cookbook_artifact2-2x2/recipes/default.rb + /cookbooks/ + /cookbooks/cookbook1/ + /cookbooks/cookbook1/metadata.rb + /cookbooks/cookbook2/ + /cookbooks/cookbook2/metadata.rb + /cookbooks/cookbook2/recipes/ + /cookbooks/cookbook2/recipes/default.rb + /data_bags/ + /data_bags/bag1/ + /data_bags/bag1/item1.json + /data_bags/bag1/item2.json + /data_bags/bag2/ + /data_bags/bag2/item1.json + /data_bags/bag2/item2.json + /environments/ + /environments/_default.json + /environments/environment1.json + /environments/environment2.json + /groups/ + /groups/admins.json + /groups/billing-admins.json + /groups/clients.json + /groups/group1.json + /groups/group2.json + /groups/users.json + /invitations.json + /members.json + /nodes/ + /nodes/node1.json + /nodes/node2.json + /org.json + /policies/ + /policies/policy1-1.2.3.json + /policies/policy2-1.2.3.json + /policies/policy2-1.3.5.json + /policy_groups/ + /policy_groups/policy_group1.json + /policy_groups/policy_group2.json + /roles/ + /roles/role1.json + /roles/role2.json EOM end end diff --git a/spec/integration/knife/node_bulk_delete_spec.rb b/spec/integration/knife/node_bulk_delete_spec.rb index fa706cbd2b..dfac031068 100644 --- a/spec/integration/knife/node_bulk_delete_spec.rb +++ b/spec/integration/knife/node_bulk_delete_spec.rb @@ -32,18 +32,18 @@ describe "knife node bulk delete", :workstation do end it "deletes all matching nodes" do - knife("node bulk delete ^ca.*", input: "Y").should_succeed <<EOM -The following nodes will be deleted: - -car cat - -Are you sure you want to delete these nodes? (Y/N) Deleted node car -Deleted node cat + knife("node bulk delete ^ca.*", input: "Y").should_succeed <<~EOM + The following nodes will be deleted: + + car cat + + Are you sure you want to delete these nodes? (Y/N) Deleted node car + Deleted node cat EOM - knife("node list").should_succeed <<EOM -cdr -cons + knife("node list").should_succeed <<~EOM + cdr + cons EOM end end diff --git a/spec/integration/knife/node_delete_spec.rb b/spec/integration/knife/node_delete_spec.rb index 5d88af6d4f..9d8f382690 100644 --- a/spec/integration/knife/node_delete_spec.rb +++ b/spec/integration/knife/node_delete_spec.rb @@ -32,14 +32,14 @@ describe "knife node delete", :workstation do end it "deletes a node" do - knife("node delete car", input: "Y").should_succeed <<EOM -Do you really want to delete car? (Y/N) Deleted node[car] + knife("node delete car", input: "Y").should_succeed <<~EOM + Do you really want to delete car? (Y/N) Deleted node[car] EOM - knife("node list").should_succeed <<EOM -cat -cdr -cons + knife("node list").should_succeed <<~EOM + cat + cdr + cons EOM end diff --git a/spec/integration/knife/node_environment_set_spec.rb b/spec/integration/knife/node_environment_set_spec.rb index 10fec5723f..09d1828130 100644 --- a/spec/integration/knife/node_environment_set_spec.rb +++ b/spec/integration/knife/node_environment_set_spec.rb @@ -31,9 +31,9 @@ describe "knife node environment set", :workstation do it "sets an environment on a node" do knife("node environment set cons lisp").should_succeed /chef_environment:.*lisp/ - knife("node show cons -a chef_environment").should_succeed <<EOM -cons: - chef_environment: lisp + knife("node show cons -a chef_environment").should_succeed <<~EOM + cons: + chef_environment: lisp EOM end diff --git a/spec/integration/knife/node_from_file_spec.rb b/spec/integration/knife/node_from_file_spec.rb index 3430967a21..e58dfddee4 100644 --- a/spec/integration/knife/node_from_file_spec.rb +++ b/spec/integration/knife/node_from_file_spec.rb @@ -29,27 +29,27 @@ describe "knife node from file", :workstation do when_the_repository "has some nodes" do before do - file "nodes/cons.json", <<EOM -{ - "name": "cons", - "chef_environment": "_default", - "run_list": [ - "recipe[cons]" -] -, - "normal": { - "tags": [ - - ] - } -} + file "nodes/cons.json", <<~EOM + { + "name": "cons", + "chef_environment": "_default", + "run_list": [ + "recipe[cons]" + ] + , + "normal": { + "tags": [ + + ] + } + } EOM end it "uploads a single file" do - knife("node from file #{node_dir}/cons.json").should_succeed stderr: <<EOM -Updated Node cons + knife("node from file #{node_dir}/cons.json").should_succeed stderr: <<~EOM + Updated Node cons EOM end diff --git a/spec/integration/knife/node_list_spec.rb b/spec/integration/knife/node_list_spec.rb index 76f5861e03..fd7394f00b 100644 --- a/spec/integration/knife/node_list_spec.rb +++ b/spec/integration/knife/node_list_spec.rb @@ -32,11 +32,11 @@ describe "knife node list", :workstation do end it "lists all cookbooks" do - knife("node list").should_succeed <<EOM -car -cat -cdr -cons + knife("node list").should_succeed <<~EOM + car + cat + cdr + cons EOM end diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb index 27e425717b..35f5130145 100644 --- a/spec/integration/knife/raw_spec.rb +++ b/spec/integration/knife/raw_spec.rb @@ -39,30 +39,30 @@ describe "knife raw", :workstation do end it "knife raw /nodes/x returns the node", skip: (RUBY_VERSION < "1.9") do - knife("raw /nodes/x").should_succeed <<EOM -{ - "name": "x", - "json_class": "Chef::Node", - "chef_type": "node", - "chef_environment": "_default", - "override": { - - }, - "normal": { - "tags": [ - - ] - }, - "default": { - - }, - "automatic": { - - }, - "run_list": [ - - ] -} + knife("raw /nodes/x").should_succeed <<~EOM + { + "name": "x", + "json_class": "Chef::Node", + "chef_type": "node", + "chef_environment": "_default", + "override": { + + }, + "normal": { + "tags": [ + + ] + }, + "default": { + + }, + "automatic": { + + }, + "run_list": [ + + ] + } EOM end @@ -71,115 +71,115 @@ EOM end it "knife raw -m DELETE /roles/x succeeds", skip: (RUBY_VERSION < "1.9") do - knife("raw -m DELETE /roles/x").should_succeed <<EOM -{ - "name": "x", - "description": "", - "json_class": "Chef::Role", - "chef_type": "role", - "default_attributes": { - - }, - "override_attributes": { - - }, - "run_list": [ - - ], - "env_run_lists": { - - } -} + knife("raw -m DELETE /roles/x").should_succeed <<~EOM + { + "name": "x", + "description": "", + "json_class": "Chef::Role", + "chef_type": "role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "run_list": [ + + ], + "env_run_lists": { + + } + } EOM knife("show /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n" end it "knife raw -m PUT -i blah.txt /roles/x succeeds", skip: (RUBY_VERSION < "1.9") do Tempfile.open("raw_put_input") do |file| - file.write <<EOM -{ - "name": "x", - "description": "eek", - "json_class": "Chef::Role", - "chef_type": "role", - "default_attributes": { - - }, - "override_attributes": { - - }, - "run_list": [ - - ], - "env_run_lists": { - - } -} + file.write <<~EOM + { + "name": "x", + "description": "eek", + "json_class": "Chef::Role", + "chef_type": "role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "run_list": [ + + ], + "env_run_lists": { + + } + } EOM file.close - knife("raw -m PUT -i #{file.path} /roles/x").should_succeed <<EOM -{ - "name": "x", - "description": "eek", - "json_class": "Chef::Role", - "chef_type": "role", - "default_attributes": { - - }, - "override_attributes": { - - }, - "run_list": [ - - ], - "env_run_lists": { - - } -} + knife("raw -m PUT -i #{file.path} /roles/x").should_succeed <<~EOM + { + "name": "x", + "description": "eek", + "json_class": "Chef::Role", + "chef_type": "role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "run_list": [ + + ], + "env_run_lists": { + + } + } EOM - knife("show /roles/x.json").should_succeed <<EOM -/roles/x.json: -{ - "name": "x", - "description": "eek" -} + knife("show /roles/x.json").should_succeed <<~EOM + /roles/x.json: + { + "name": "x", + "description": "eek" + } EOM end end it "knife raw -m POST -i blah.txt /roles succeeds", skip: (RUBY_VERSION < "1.9") do Tempfile.open("raw_put_input") do |file| - file.write <<EOM -{ - "name": "y", - "description": "eek", - "json_class": "Chef::Role", - "chef_type": "role", - "default_attributes": { - }, - "override_attributes": { - }, - "run_list": [ - - ], - "env_run_lists": { - } -} + file.write <<~EOM + { + "name": "y", + "description": "eek", + "json_class": "Chef::Role", + "chef_type": "role", + "default_attributes": { + }, + "override_attributes": { + }, + "run_list": [ + + ], + "env_run_lists": { + } + } EOM file.close - knife("raw -m POST -i #{file.path} /roles").should_succeed <<EOM -{ - "uri": "#{Chef::Config.chef_server_url}/roles/y" -} + knife("raw -m POST -i #{file.path} /roles").should_succeed <<~EOM + { + "uri": "#{Chef::Config.chef_server_url}/roles/y" + } EOM - knife("show /roles/y.json").should_succeed <<EOM -/roles/y.json: -{ - "name": "y", - "description": "eek" -} + knife("show /roles/y.json").should_succeed <<~EOM + /roles/y.json: + { + "name": "y", + "description": "eek" + } EOM end end @@ -199,17 +199,17 @@ EOM end it "knife raw /blah returns the prettified json", skip: (RUBY_VERSION < "1.9") do - knife("raw /blah").should_succeed <<EOM -{ - "x": "y", - "a": "b" -} + knife("raw /blah").should_succeed <<~EOM + { + "x": "y", + "a": "b" + } EOM end it "knife raw --no-pretty /blah returns the raw json" do - knife("raw --no-pretty /blah").should_succeed <<EOM -{ "x": "y", "a": "b" } + knife("raw --no-pretty /blah").should_succeed <<~EOM + { "x": "y", "a": "b" } EOM end end @@ -229,14 +229,14 @@ EOM end it "knife raw /blah returns the raw text" do - knife("raw /blah").should_succeed(<<EOM) -{ "x": "y", "a": "b" } + knife("raw /blah").should_succeed(<<~EOM) + { "x": "y", "a": "b" } EOM end it "knife raw --no-pretty /blah returns the raw text" do - knife("raw --no-pretty /blah").should_succeed(<<EOM) -{ "x": "y", "a": "b" } + knife("raw --no-pretty /blah").should_succeed(<<~EOM) + { "x": "y", "a": "b" } EOM end end diff --git a/spec/integration/knife/role_bulk_delete_spec.rb b/spec/integration/knife/role_bulk_delete_spec.rb index 0e7ff941e2..40aef97c07 100644 --- a/spec/integration/knife/role_bulk_delete_spec.rb +++ b/spec/integration/knife/role_bulk_delete_spec.rb @@ -32,18 +32,18 @@ describe "knife role bulk delete", :workstation do end it "deletes all matching roles" do - knife("role bulk delete ^ca.*", input: "Y").should_succeed <<EOM -The following roles will be deleted: - -car cat - -Are you sure you want to delete these roles? (Y/N) Deleted role car -Deleted role cat + knife("role bulk delete ^ca.*", input: "Y").should_succeed <<~EOM + The following roles will be deleted: + + car cat + + Are you sure you want to delete these roles? (Y/N) Deleted role car + Deleted role cat EOM - knife("role list").should_succeed <<EOM -cdr -cons + knife("role list").should_succeed <<~EOM + cdr + cons EOM end diff --git a/spec/integration/knife/role_delete_spec.rb b/spec/integration/knife/role_delete_spec.rb index 9fbd3758b9..875f80cede 100644 --- a/spec/integration/knife/role_delete_spec.rb +++ b/spec/integration/knife/role_delete_spec.rb @@ -32,14 +32,14 @@ describe "knife role delete", :workstation do end it "deletes a role" do - knife("role delete car", input: "Y").should_succeed <<EOM -Do you really want to delete car? (Y/N) Deleted role[car] + knife("role delete car", input: "Y").should_succeed <<~EOM + Do you really want to delete car? (Y/N) Deleted role[car] EOM - knife("role list").should_succeed <<EOM -cat -cdr -cons + knife("role list").should_succeed <<~EOM + cat + cdr + cons EOM end diff --git a/spec/integration/knife/role_from_file_spec.rb b/spec/integration/knife/role_from_file_spec.rb index 60caa3fa88..ca1c17380d 100644 --- a/spec/integration/knife/role_from_file_spec.rb +++ b/spec/integration/knife/role_from_file_spec.rb @@ -29,64 +29,64 @@ describe "knife role from file", :workstation do when_the_repository "has some roles" do before do - file "roles/cons.json", <<EOM -{ - "name": "cons", - "description": "An role", - "json_class": "Chef::role", - "chef_type": "role", - "default_attributes": { - "hola": "Amigos!" - }, - "override_attributes": { - - } -} + file "roles/cons.json", <<~EOM + { + "name": "cons", + "description": "An role", + "json_class": "Chef::role", + "chef_type": "role", + "default_attributes": { + "hola": "Amigos!" + }, + "override_attributes": { + + } + } EOM - file "roles/car.json", <<EOM -{ - "name": "car", - "description": "A role for list nodes", - "json_class": "Chef::Role", - "chef_type": "role", - "default_attributes": { - "hola": "Amigos!" - }, - "override_attributes": { - - } -} + file "roles/car.json", <<~EOM + { + "name": "car", + "description": "A role for list nodes", + "json_class": "Chef::Role", + "chef_type": "role", + "default_attributes": { + "hola": "Amigos!" + }, + "override_attributes": { + + } + } EOM - file "roles/cdr.json", <<EOM -{ - "name": "cdr", - "description": "A role for last nodes", - "json_class": "Chef::Role", - "chef_type": "role", - "default_attributes": { - "hola": "Amigos!" - }, - "override_attributes": { - - } -} + file "roles/cdr.json", <<~EOM + { + "name": "cdr", + "description": "A role for last nodes", + "json_class": "Chef::Role", + "chef_type": "role", + "default_attributes": { + "hola": "Amigos!" + }, + "override_attributes": { + + } + } EOM end it "uploads a single file" do - knife("role from file #{role_dir}/cons.json").should_succeed stderr: <<EOM -Updated Role cons + knife("role from file #{role_dir}/cons.json").should_succeed stderr: <<~EOM + Updated Role cons EOM end it "uploads many files" do - knife("role from file #{role_dir}/cons.json #{role_dir}/car.json #{role_dir}/cdr.json").should_succeed stderr: <<EOM -Updated Role cons -Updated Role car -Updated Role cdr + knife("role from file #{role_dir}/cons.json #{role_dir}/car.json #{role_dir}/cdr.json").should_succeed stderr: <<~EOM + Updated Role cons + Updated Role car + Updated Role cdr EOM end diff --git a/spec/integration/knife/role_list_spec.rb b/spec/integration/knife/role_list_spec.rb index 36dc76be4c..db13e521b5 100644 --- a/spec/integration/knife/role_list_spec.rb +++ b/spec/integration/knife/role_list_spec.rb @@ -32,11 +32,11 @@ describe "knife role list", :workstation do end it "lists all cookbooks" do - knife("role list").should_succeed <<EOM -car -cat -cdr -cons + knife("role list").should_succeed <<~EOM + car + cat + cdr + cons EOM end diff --git a/spec/integration/knife/role_show_spec.rb b/spec/integration/knife/role_show_spec.rb index f655c03e8d..c2f5efedaf 100644 --- a/spec/integration/knife/role_show_spec.rb +++ b/spec/integration/knife/role_show_spec.rb @@ -33,15 +33,15 @@ describe "knife role show", :workstation do # rubocop:disable Layout/TrailingWhitespace it "shows a cookbook" do - knife("role show cons").should_succeed <<EOM -chef_type: role -default_attributes: -description: -env_run_lists: -json_class: Chef::Role -name: cons -override_attributes: -run_list: + knife("role show cons").should_succeed <<~EOM + chef_type: role + default_attributes: + description: + env_run_lists: + json_class: Chef::Role + name: cons + override_attributes: + run_list: EOM end # rubocop:enable Layout/TrailingWhitespace diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb index 3d7dfe68e2..df9f55fbf2 100644 --- a/spec/integration/knife/show_spec.rb +++ b/spec/integration/knife/show_spec.rb @@ -49,63 +49,63 @@ describe "knife show", :workstation do end it "knife show /cookbooks/x/metadata.rb shows the remote version" do - knife("show /cookbooks/x/metadata.rb").should_succeed <<EOM -/cookbooks/x/metadata.rb: -name "x"; version "1.0.0" + knife("show /cookbooks/x/metadata.rb").should_succeed <<~EOM + /cookbooks/x/metadata.rb: + name "x"; version "1.0.0" EOM end it "knife show --local /cookbooks/x/metadata.rb shows the local version" do - knife("show --local /cookbooks/x/metadata.rb").should_succeed <<EOM -/cookbooks/x/metadata.rb: -name "x"; version "1.0.0" + knife("show --local /cookbooks/x/metadata.rb").should_succeed <<~EOM + /cookbooks/x/metadata.rb: + name "x"; version "1.0.0" EOM end it "knife show /data_bags/x/y.json shows the remote version" do - knife("show /data_bags/x/y.json").should_succeed <<EOM -/data_bags/x/y.json: -{ - "id": "y" -} + knife("show /data_bags/x/y.json").should_succeed <<~EOM + /data_bags/x/y.json: + { + "id": "y" + } EOM end it "knife show --local /data_bags/x/y.json shows the local version" do - knife("show --local /data_bags/x/y.json").should_succeed <<EOM -/data_bags/x/y.json: -{ - "foo": "bar" -} + knife("show --local /data_bags/x/y.json").should_succeed <<~EOM + /data_bags/x/y.json: + { + "foo": "bar" + } EOM end it "knife show /environments/x.json shows the remote version", skip: (RUBY_VERSION < "1.9") do - knife("show /environments/x.json").should_succeed <<EOM -/environments/x.json: -{ - "name": "x" -} + knife("show /environments/x.json").should_succeed <<~EOM + /environments/x.json: + { + "name": "x" + } EOM end it "knife show --local /environments/x.json shows the local version" do - knife("show --local /environments/x.json").should_succeed <<EOM -/environments/x.json: -{ - "foo": "bar" -} + knife("show --local /environments/x.json").should_succeed <<~EOM + /environments/x.json: + { + "foo": "bar" + } EOM end it "knife show /roles/x.json shows the remote version", skip: (RUBY_VERSION < "1.9") do - knife("show /roles/x.json").should_succeed <<EOM -/roles/x.json: -{ - "name": "x" -} + knife("show /roles/x.json").should_succeed <<~EOM + /roles/x.json: + { + "name": "x" + } EOM end it "knife show --local /roles/x.json shows the local version" do - knife("show --local /roles/x.json").should_succeed <<EOM -/roles/x.json: -{ - "foo": "bar" -} + knife("show --local /roles/x.json").should_succeed <<~EOM + /roles/x.json: + { + "foo": "bar" + } EOM end # show directory @@ -136,21 +136,21 @@ EOM } end it "knife show shows the attributes in a predetermined order", skip: (RUBY_VERSION < "1.9") do - knife("show /environments/x.json").should_succeed <<EOM -/environments/x.json: -{ - "name": "x", - "description": "woo", - "cookbook_versions": { - "blah": "= 1.0.0" - }, - "default_attributes": { - "foo": "bar" - }, - "override_attributes": { - "x": "y" - } -} + knife("show /environments/x.json").should_succeed <<~EOM + /environments/x.json: + { + "name": "x", + "description": "woo", + "cookbook_versions": { + "blah": "= 1.0.0" + }, + "default_attributes": { + "foo": "bar" + }, + "override_attributes": { + "x": "y" + } + } EOM end end @@ -158,9 +158,9 @@ EOM when_the_repository "has an environment with bad JSON" do before { file "environments/x.json", "{" } it "knife show succeeds" do - knife("show --local /environments/x.json").should_succeed <<EOM -/environments/x.json: -{ + knife("show --local /environments/x.json").should_succeed <<~EOM + /environments/x.json: + { EOM end end diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index f478e6da01..4a3247ccd7 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -52,36 +52,36 @@ describe "knife upload", :workstation do it "knife upload does nothing" do knife("upload /").should_succeed "" - knife("diff --name-status /").should_succeed <<EOM -D\t/clients/chef-validator.json -D\t/clients/chef-webui.json -D\t/clients/x.json -D\t/cookbooks/x -D\t/data_bags/x -D\t/environments/_default.json -D\t/environments/x.json -D\t/nodes/x.json -D\t/roles/x.json -D\t/users/admin.json -D\t/users/x.json + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients/chef-validator.json + D\t/clients/chef-webui.json + D\t/clients/x.json + D\t/cookbooks/x + D\t/data_bags/x + D\t/environments/_default.json + D\t/environments/x.json + D\t/nodes/x.json + D\t/roles/x.json + D\t/users/admin.json + D\t/users/x.json EOM end it "knife upload --purge deletes everything" do - knife("upload --purge /").should_succeed(<<EOM, stderr: "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n") -Deleted extra entry /clients/chef-validator.json (purge is on) -Deleted extra entry /clients/chef-webui.json (purge is on) -Deleted extra entry /clients/x.json (purge is on) -Deleted extra entry /cookbooks/x (purge is on) -Deleted extra entry /data_bags/x (purge is on) -Deleted extra entry /environments/x.json (purge is on) -Deleted extra entry /nodes/x.json (purge is on) -Deleted extra entry /roles/x.json (purge is on) -Deleted extra entry /users/admin.json (purge is on) -Deleted extra entry /users/x.json (purge is on) -EOM - knife("diff --name-status /").should_succeed <<EOM -D\t/environments/_default.json + knife("upload --purge /").should_succeed(<<~EOM, stderr: "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n") + Deleted extra entry /clients/chef-validator.json (purge is on) + Deleted extra entry /clients/chef-webui.json (purge is on) + Deleted extra entry /clients/x.json (purge is on) + Deleted extra entry /cookbooks/x (purge is on) + Deleted extra entry /data_bags/x (purge is on) + Deleted extra entry /environments/x.json (purge is on) + Deleted extra entry /nodes/x.json (purge is on) + Deleted extra entry /roles/x.json (purge is on) + Deleted extra entry /users/admin.json (purge is on) + Deleted extra entry /users/x.json (purge is on) +EOM + knife("diff --name-status /").should_succeed <<~EOM + D\t/environments/_default.json EOM end end @@ -129,22 +129,22 @@ EOM context "except the role file is textually different, but not ACTUALLY different" do before do - file "roles/x.json", <<EOM -{ - "chef_type": "role", - "default_attributes": { - }, - "env_run_lists": { - }, - "json_class": "Chef::Role", - "name": "x", - "description": "", - "override_attributes": { - }, - "run_list": [ - - ] -} + file "roles/x.json", <<~EOM + { + "chef_type": "role", + "default_attributes": { + }, + "env_run_lists": { + }, + "json_class": "Chef::Role", + "name": "x", + "description": "", + "override_attributes": { + }, + "run_list": [ + + ] + } EOM end @@ -156,9 +156,9 @@ EOM context "the role is in ruby" do before do - file "roles/x.rb", <<EOM -name "x" -description "blargle" + file "roles/x.rb", <<~EOM + name "x" + description "blargle" EOM end @@ -197,33 +197,33 @@ EOM end it "knife upload adds the new files" do - knife("upload /").should_succeed <<EOM -Created /clients/y.json -Updated /cookbooks/x -Created /cookbooks/y -Created /data_bags/x/z.json -Created /data_bags/y -Created /data_bags/y/zz.json -Created /environments/y.json -Created /nodes/y.json -Created /roles/y.json -Created /users/y.json + knife("upload /").should_succeed <<~EOM + Created /clients/y.json + Updated /cookbooks/x + Created /cookbooks/y + Created /data_bags/x/z.json + Created /data_bags/y + Created /data_bags/y/zz.json + Created /environments/y.json + Created /nodes/y.json + Created /roles/y.json + Created /users/y.json EOM knife("diff /").should_succeed "" end it "knife upload --no-diff adds the new files" do - knife("upload --no-diff /").should_succeed <<EOM -Created /clients/y.json -Updated /cookbooks/x -Created /cookbooks/y -Created /data_bags/x/z.json -Created /data_bags/y -Created /data_bags/y/zz.json -Created /environments/y.json -Created /nodes/y.json -Created /roles/y.json -Created /users/y.json + knife("upload --no-diff /").should_succeed <<~EOM + Created /clients/y.json + Updated /cookbooks/x + Created /cookbooks/y + Created /data_bags/x/z.json + Created /data_bags/y + Created /data_bags/y/zz.json + Created /environments/y.json + Created /nodes/y.json + Created /roles/y.json + Created /users/y.json EOM knife("diff --name-status /").should_succeed "" end @@ -233,35 +233,35 @@ EOM when_the_repository "is empty" do it "knife upload does nothing" do knife("upload /").should_succeed "" - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end it "knife upload --purge deletes nothing" do - knife("upload --purge /").should_fail <<EOM -ERROR: /clients cannot be deleted. -ERROR: /cookbooks cannot be deleted. -ERROR: /data_bags cannot be deleted. -ERROR: /environments cannot be deleted. -ERROR: /nodes cannot be deleted. -ERROR: /roles cannot be deleted. -ERROR: /users cannot be deleted. -EOM - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("upload --purge /").should_fail <<~EOM + ERROR: /clients cannot be deleted. + ERROR: /cookbooks cannot be deleted. + ERROR: /data_bags cannot be deleted. + ERROR: /environments cannot be deleted. + ERROR: /nodes cannot be deleted. + ERROR: /roles cannot be deleted. + ERROR: /users cannot be deleted. +EOM + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end @@ -285,9 +285,9 @@ EOM end it "knife upload of the data bag uploads only the values in the data bag item and no other" do - knife("upload /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags/x -Created /data_bags/x/y.json + knife("upload /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags/x + Created /data_bags/x/y.json EOM knife("diff --name-status /data_bags").should_succeed <<EOM EOM @@ -295,9 +295,9 @@ EOM end it "knife upload /data_bags/x /data_bags/x/y.json uploads x once" do - knife("upload /data_bags/x /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags/x -Created /data_bags/x/y.json + knife("upload /data_bags/x /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags/x + Created /data_bags/x/y.json EOM end end @@ -309,9 +309,9 @@ EOM end it "upload preserves chef_type and data_bag" do - knife("upload /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags/x -Created /data_bags/x/y.json + knife("upload /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags/x + Created /data_bags/x/y.json EOM knife("diff --name-status /data_bags").should_succeed "" result = Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, create_additions: false) @@ -328,12 +328,12 @@ EOM file "data_bags/x/z.json", {} end it "knife upload of one data bag item itself succeeds" do - knife("upload /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags/x -Created /data_bags/x/y.json + knife("upload /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags/x + Created /data_bags/x/y.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -A\t/data_bags/x/z.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + A\t/data_bags/x/z.json EOM end end @@ -353,62 +353,62 @@ EOM end it "knife upload of the modified file succeeds" do - knife("upload /data_bags/x/modified.json").should_succeed <<EOM -Updated /data_bags/x/modified.json + knife("upload /data_bags/x/modified.json").should_succeed <<~EOM + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + A\t/data_bags/x/added.json EOM end it "knife upload of the unmodified file does nothing" do knife("upload /data_bags/x/unmodified.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/added.json EOM end it "knife upload of the added file succeeds" do - knife("upload /data_bags/x/added.json").should_succeed <<EOM -Created /data_bags/x/added.json + knife("upload /data_bags/x/added.json").should_succeed <<~EOM + Created /data_bags/x/added.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -M\t/data_bags/x/modified.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + M\t/data_bags/x/modified.json EOM end it "knife upload of the deleted file does nothing" do knife("upload /data_bags/x/deleted.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/added.json EOM end it "knife upload --purge of the deleted file deletes it" do - knife("upload --purge /data_bags/x/deleted.json").should_succeed <<EOM -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("upload --purge /data_bags/x/deleted.json").should_succeed <<~EOM + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -M\t/data_bags/x/modified.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + M\t/data_bags/x/modified.json + A\t/data_bags/x/added.json EOM end it "knife upload of the entire data bag uploads everything" do - knife("upload /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json + knife("upload /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json EOM end it "knife upload --purge of the entire data bag uploads everything" do - knife("upload --purge /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("upload --purge /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -423,18 +423,18 @@ EOM end it "knife upload --purge . uploads everything" do - knife("upload --purge .").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("upload --purge .").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife upload --purge * uploads everything" do - knife("upload --purge *").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("upload --purge *").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -466,14 +466,14 @@ EOM # technically we shouldn't have deleted missing files. But ... cookbooks # are a special case. it "knife upload of the cookbook itself succeeds" do - knife("upload /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM knife("diff --name-status /cookbooks").should_succeed "" end it "knife upload --purge of the cookbook itself succeeds" do - knife("upload /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -485,8 +485,8 @@ EOM end it "knife upload of the cookbook succeeds" do - knife("upload /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -500,8 +500,8 @@ EOM end it "knife upload of the cookbook succeeds" do - knife("upload /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -513,8 +513,8 @@ EOM end it "knife upload --freeze freezes the cookbook" do - knife("upload --freeze /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload --freeze /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM # Modify a file and attempt to upload file "cookbooks/x/metadata.rb", 'name "x"; version "1.0.0"#different' @@ -538,8 +538,8 @@ EOM knife("upload /cookbooks/frozencook").should_fail "ERROR: /cookbooks failed to write: Cookbook frozencook is frozen\n" end it "knife upload --force uploads the frozen cookbook" do - knife("upload --force /cookbooks/frozencook").should_succeed <<EOM -Updated /cookbooks/frozencook + knife("upload --force /cookbooks/frozencook").should_succeed <<~EOM + Updated /cookbooks/frozencook EOM end end @@ -558,18 +558,18 @@ EOM end it "knife upload /cookbooks/x uploads the local version" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM - knife("upload --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -581,8 +581,8 @@ EOM end it "knife upload /cookbooks/x uploads the local version" do - knife("upload --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -594,18 +594,18 @@ EOM end it "knife upload /cookbooks/x uploads the local version" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM - knife("upload --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -616,8 +616,8 @@ EOM end it "knife upload /cookbooks/x uploads the new version" do - knife("upload --purge /cookbooks/x").should_succeed <<EOM -Updated /cookbooks/x + knife("upload --purge /cookbooks/x").should_succeed <<~EOM + Updated /cookbooks/x EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -635,21 +635,21 @@ EOM end it "knife upload tries and fails" do - error1 = <<-EOH -WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF - { - (right here) ------^ - -ERROR: /environments/x.json failed to write: Parse error reading JSON: parse error: premature EOF - { - (right here) ------^ + error1 = <<~EOH + WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF + { + (right here) ------^ + + ERROR: /environments/x.json failed to write: Parse error reading JSON: parse error: premature EOF + { + (right here) ------^ EOH - warn = <<-EOH -WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF - { - (right here) ------^ - + warn = <<~EOH + WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF + { + (right here) ------^ + EOH knife("upload /environments/x.json").should_fail(error1) knife("diff --name-status /environments/x.json").should_succeed("M\t/environments/x.json\n", stderr: warn) @@ -716,8 +716,8 @@ WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'") end it "knife upload succeeds" do - knife("upload /cookbooks/x").should_succeed <<EOM -Created /cookbooks/x + knife("upload /cookbooks/x").should_succeed <<~EOM + Created /cookbooks/x EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -751,36 +751,36 @@ EOM it "knife upload does nothing" do knife("upload /").should_succeed "" - knife("diff --name-status /").should_succeed <<EOM -D\t/clients/chef-validator.json -D\t/clients/chef-webui.json -D\t/clients/x.json -D\t/cookbooks/x-1.0.0 -D\t/data_bags/x -D\t/environments/_default.json -D\t/environments/x.json -D\t/nodes/x.json -D\t/roles/x.json -D\t/users/admin.json -D\t/users/x.json + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients/chef-validator.json + D\t/clients/chef-webui.json + D\t/clients/x.json + D\t/cookbooks/x-1.0.0 + D\t/data_bags/x + D\t/environments/_default.json + D\t/environments/x.json + D\t/nodes/x.json + D\t/roles/x.json + D\t/users/admin.json + D\t/users/x.json EOM end it "knife upload --purge deletes everything" do - knife("upload --purge /").should_succeed(<<EOM, stderr: "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n") -Deleted extra entry /clients/chef-validator.json (purge is on) -Deleted extra entry /clients/chef-webui.json (purge is on) -Deleted extra entry /clients/x.json (purge is on) -Deleted extra entry /cookbooks/x-1.0.0 (purge is on) -Deleted extra entry /data_bags/x (purge is on) -Deleted extra entry /environments/x.json (purge is on) -Deleted extra entry /nodes/x.json (purge is on) -Deleted extra entry /roles/x.json (purge is on) -Deleted extra entry /users/admin.json (purge is on) -Deleted extra entry /users/x.json (purge is on) -EOM - knife("diff --name-status /").should_succeed <<EOM -D\t/environments/_default.json + knife("upload --purge /").should_succeed(<<~EOM, stderr: "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n") + Deleted extra entry /clients/chef-validator.json (purge is on) + Deleted extra entry /clients/chef-webui.json (purge is on) + Deleted extra entry /clients/x.json (purge is on) + Deleted extra entry /cookbooks/x-1.0.0 (purge is on) + Deleted extra entry /data_bags/x (purge is on) + Deleted extra entry /environments/x.json (purge is on) + Deleted extra entry /nodes/x.json (purge is on) + Deleted extra entry /roles/x.json (purge is on) + Deleted extra entry /users/admin.json (purge is on) + Deleted extra entry /users/x.json (purge is on) +EOM + knife("diff --name-status /").should_succeed <<~EOM + D\t/environments/_default.json EOM end end @@ -824,22 +824,22 @@ EOM context "except the role file is textually different, but not ACTUALLY different" do before do - file "roles/x.json", <<EOM -{ - "chef_type": "role", - "default_attributes": { - }, - "env_run_lists": { - }, - "json_class": "Chef::Role", - "name": "x", - "description": "", - "override_attributes": { - }, - "run_list": [ - - ] -} + file "roles/x.json", <<~EOM + { + "chef_type": "role", + "default_attributes": { + }, + "env_run_lists": { + }, + "json_class": "Chef::Role", + "name": "x", + "description": "", + "override_attributes": { + }, + "run_list": [ + + ] + } EOM end @@ -864,18 +864,18 @@ EOM end it "knife upload adds the new files" do - knife("upload /").should_succeed <<EOM -Created /clients/y.json -Updated /cookbooks/x-1.0.0 -Created /cookbooks/x-2.0.0 -Created /cookbooks/y-1.0.0 -Created /data_bags/x/z.json -Created /data_bags/y -Created /data_bags/y/zz.json -Created /environments/y.json -Created /nodes/y.json -Created /roles/y.json -Created /users/y.json + knife("upload /").should_succeed <<~EOM + Created /clients/y.json + Updated /cookbooks/x-1.0.0 + Created /cookbooks/x-2.0.0 + Created /cookbooks/y-1.0.0 + Created /data_bags/x/z.json + Created /data_bags/y + Created /data_bags/y/zz.json + Created /environments/y.json + Created /nodes/y.json + Created /roles/y.json + Created /users/y.json EOM knife("diff --name-status /").should_succeed "" end @@ -885,35 +885,35 @@ EOM when_the_repository "is empty" do it "knife upload does nothing" do knife("upload /").should_succeed "" - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end it "knife upload --purge deletes nothing" do - knife("upload --purge /").should_fail <<EOM -ERROR: /clients cannot be deleted. -ERROR: /cookbooks cannot be deleted. -ERROR: /data_bags cannot be deleted. -ERROR: /environments cannot be deleted. -ERROR: /nodes cannot be deleted. -ERROR: /roles cannot be deleted. -ERROR: /users cannot be deleted. -EOM - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("upload --purge /").should_fail <<~EOM + ERROR: /clients cannot be deleted. + ERROR: /cookbooks cannot be deleted. + ERROR: /data_bags cannot be deleted. + ERROR: /environments cannot be deleted. + ERROR: /nodes cannot be deleted. + ERROR: /roles cannot be deleted. + ERROR: /users cannot be deleted. +EOM + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end @@ -937,12 +937,12 @@ EOM end it "knife upload of one data bag item itself succeeds" do - knife("upload /data_bags/x/y.json").should_succeed <<EOM -Created /data_bags/x -Created /data_bags/x/y.json + knife("upload /data_bags/x/y.json").should_succeed <<~EOM + Created /data_bags/x + Created /data_bags/x/y.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -A\t/data_bags/x/z.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + A\t/data_bags/x/z.json EOM end end @@ -960,62 +960,62 @@ EOM end it "knife upload of the modified file succeeds" do - knife("upload /data_bags/x/modified.json").should_succeed <<EOM -Updated /data_bags/x/modified.json + knife("upload /data_bags/x/modified.json").should_succeed <<~EOM + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + A\t/data_bags/x/added.json EOM end it "knife upload of the unmodified file does nothing" do knife("upload /data_bags/x/unmodified.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/added.json EOM end it "knife upload of the added file succeeds" do - knife("upload /data_bags/x/added.json").should_succeed <<EOM -Created /data_bags/x/added.json + knife("upload /data_bags/x/added.json").should_succeed <<~EOM + Created /data_bags/x/added.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -M\t/data_bags/x/modified.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + M\t/data_bags/x/modified.json EOM end it "knife upload of the deleted file does nothing" do knife("upload /data_bags/x/deleted.json").should_succeed "" - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json -M\t/data_bags/x/modified.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json + M\t/data_bags/x/modified.json + A\t/data_bags/x/added.json EOM end it "knife upload --purge of the deleted file deletes it" do - knife("upload --purge /data_bags/x/deleted.json").should_succeed <<EOM -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("upload --purge /data_bags/x/deleted.json").should_succeed <<~EOM + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -M\t/data_bags/x/modified.json -A\t/data_bags/x/added.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + M\t/data_bags/x/modified.json + A\t/data_bags/x/added.json EOM end it "knife upload of the entire data bag uploads everything" do - knife("upload /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json + knife("upload /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json EOM - knife("diff --name-status /data_bags").should_succeed <<EOM -D\t/data_bags/x/deleted.json + knife("diff --name-status /data_bags").should_succeed <<~EOM + D\t/data_bags/x/deleted.json EOM end it "knife upload --purge of the entire data bag uploads everything" do - knife("upload --purge /data_bags/x").should_succeed <<EOM -Created /data_bags/x/added.json -Updated /data_bags/x/modified.json -Deleted extra entry /data_bags/x/deleted.json (purge is on) + knife("upload --purge /data_bags/x").should_succeed <<~EOM + Created /data_bags/x/added.json + Updated /data_bags/x/modified.json + Deleted extra entry /data_bags/x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -1027,18 +1027,18 @@ EOM knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", stdout: /USAGE/ end it "knife upload --purge . uploads everything" do - knife("upload --purge .").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("upload --purge .").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife upload --purge * uploads everything" do - knife("upload --purge *").should_succeed <<EOM -Created x/added.json -Updated x/modified.json -Deleted extra entry x/deleted.json (purge is on) + knife("upload --purge *").should_succeed <<~EOM + Created x/added.json + Updated x/modified.json + Deleted extra entry x/deleted.json (purge is on) EOM knife("diff --name-status /data_bags").should_succeed "" end @@ -1070,15 +1070,15 @@ EOM # technically we shouldn't have deleted missing files. But ... cookbooks # are a special case. it "knife upload of the cookbook itself succeeds" do - knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM -Updated /cookbooks/x-1.0.0 + knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0 EOM knife("diff --name-status /cookbooks").should_succeed "" end it "knife upload --purge of the cookbook itself succeeds" do - knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM -Updated /cookbooks/x-1.0.0 + knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0 EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1090,8 +1090,8 @@ EOM end it "knife upload of the cookbook succeeds" do - knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM -Updated /cookbooks/x-1.0.0 + knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0 EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1105,8 +1105,8 @@ EOM end it "knife upload of the cookbook succeeds" do - knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM -Updated /cookbooks/x-1.0.0 + knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0 EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1126,13 +1126,13 @@ EOM end it "knife upload /cookbooks uploads the local version" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -M\t/cookbooks/x-1.0.0/onlyin1.0.0.rb -D\t/cookbooks/x-1.0.1 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + M\t/cookbooks/x-1.0.0/onlyin1.0.0.rb + D\t/cookbooks/x-1.0.1 EOM - knife("upload --purge /cookbooks").should_succeed <<EOM -Updated /cookbooks/x-1.0.0 -Deleted extra entry /cookbooks/x-1.0.1 (purge is on) + knife("upload --purge /cookbooks").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0 + Deleted extra entry /cookbooks/x-1.0.1 (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1144,9 +1144,9 @@ EOM cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" } end it "knife upload /cookbooks uploads the local version" do - knife("upload --purge /cookbooks").should_succeed <<EOM -Updated /cookbooks/x-1.0.0 -Deleted extra entry /cookbooks/x-0.9.9 (purge is on) + knife("upload --purge /cookbooks").should_succeed <<~EOM + Updated /cookbooks/x-1.0.0 + Deleted extra entry /cookbooks/x-0.9.9 (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1158,13 +1158,13 @@ EOM end it "knife upload /cookbooks/x uploads the local version" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-1.0.1 -A\t/cookbooks/x-1.0.0 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-1.0.1 + A\t/cookbooks/x-1.0.0 EOM - knife("upload --purge /cookbooks").should_succeed <<EOM -Created /cookbooks/x-1.0.0 -Deleted extra entry /cookbooks/x-1.0.1 (purge is on) + knife("upload --purge /cookbooks").should_succeed <<~EOM + Created /cookbooks/x-1.0.0 + Deleted extra entry /cookbooks/x-1.0.1 (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1176,9 +1176,9 @@ EOM end it "knife upload /cookbooks/x uploads the new version" do - knife("upload --purge /cookbooks").should_succeed <<EOM -Created /cookbooks/x-1.0.0 -Deleted extra entry /cookbooks/x-0.9.9 (purge is on) + knife("upload --purge /cookbooks").should_succeed <<~EOM + Created /cookbooks/x-1.0.0 + Deleted extra entry /cookbooks/x-0.9.9 (purge is on) EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1250,8 +1250,8 @@ EOM file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'") end it "knife upload succeeds" do - knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM -Created /cookbooks/x-1.0.0 + knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM + Created /cookbooks/x-1.0.0 EOM knife("diff --name-status /cookbooks").should_succeed "" end @@ -1313,24 +1313,24 @@ EOM end it "knife upload / uploads everything" do - knife("upload /").should_succeed <<EOM -Updated /acls/groups/blah.json -Created /clients/x.json -Created /containers/x.json -Created /cookbook_artifacts/x-1x1 -Created /cookbooks/x -Created /data_bags/x -Created /data_bags/x/y.json -Created /environments/x.json -Created /groups/x.json -Updated /invitations.json -Updated /members.json -Created /nodes/x.json -Updated /org.json -Created /policies/blah-1.0.0.json -Created /policies/x-1.0.0.json -Created /policy_groups/x.json -Created /roles/x.json + knife("upload /").should_succeed <<~EOM + Updated /acls/groups/blah.json + Created /clients/x.json + Created /containers/x.json + Created /cookbook_artifacts/x-1x1 + Created /cookbooks/x + Created /data_bags/x + Created /data_bags/x/y.json + Created /environments/x.json + Created /groups/x.json + Updated /invitations.json + Updated /members.json + Created /nodes/x.json + Updated /org.json + Created /policies/blah-1.0.0.json + Created /policies/x-1.0.0.json + Created /policy_groups/x.json + Created /roles/x.json EOM expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo" ]) expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ]) @@ -1366,8 +1366,8 @@ EOM end it "knife upload makes no changes" do - knife("upload /").should_succeed <<EOM -Updated /acls/groups/blah.json + knife("upload /").should_succeed <<~EOM + Updated /acls/groups/blah.json EOM end end @@ -1378,8 +1378,8 @@ EOM end it "should fail because policies are not updateable" do - knife("upload /policies/x-1.0.0.json").should_fail <<EOM -ERROR: /policies/x-1.0.0.json cannot be updated: policy revisions are immutable once uploaded. If you want to change the policy, create a new revision with your changes. + knife("upload /policies/x-1.0.0.json").should_fail <<~EOM + ERROR: /policies/x-1.0.0.json cannot be updated: policy revisions are immutable once uploaded. If you want to change the policy, create a new revision with your changes. EOM end end @@ -1390,8 +1390,8 @@ EOM end it "should fail because cookbook_artifacts cannot be updated" do - knife("upload /cookbook_artifacts/x-1x1").should_fail <<EOM -ERROR: /cookbook_artifacts/x-1x1 cannot be updated: cookbook artifacts are immutable once uploaded. + knife("upload /cookbook_artifacts/x-1x1").should_fail <<~EOM + ERROR: /cookbook_artifacts/x-1x1 cannot be updated: cookbook artifacts are immutable once uploaded. EOM end end @@ -1420,20 +1420,20 @@ EOM end it "knife upload updates everything" do - knife("upload /").should_succeed <<EOM -Updated /acls/groups/blah.json -Updated /clients/x.json -Updated /cookbooks/x -Updated /data_bags/x/y.json -Updated /environments/x.json -Updated /groups/x.json -Updated /invitations.json -Updated /members.json -Updated /nodes/x.json -Updated /org.json -Created /policies/blah-1.0.0.json -Updated /policy_groups/x.json -Updated /roles/x.json + knife("upload /").should_succeed <<~EOM + Updated /acls/groups/blah.json + Updated /clients/x.json + Updated /cookbooks/x + Updated /data_bags/x/y.json + Updated /environments/x.json + Updated /groups/x.json + Updated /invitations.json + Updated /members.json + Updated /nodes/x.json + Updated /org.json + Created /policies/blah-1.0.0.json + Updated /policy_groups/x.json + Updated /roles/x.json EOM knife("diff --name-status --diff-filter=AMT /").should_succeed "" end diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb index a9832fe6b0..dca78e23cc 100644 --- a/spec/integration/recipes/lwrp_inline_resources_spec.rb +++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb @@ -145,10 +145,10 @@ describe "LWRPs with inline resources" do end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb index 3494924a8f..3f591d4cfc 100644 --- a/spec/integration/recipes/lwrp_spec.rb +++ b/spec/integration/recipes/lwrp_spec.rb @@ -22,26 +22,26 @@ describe "LWRPs" do before do directory "cookbooks/l-w-r-p" do - file "resources/foo.rb", <<EOM -default_action :create + file "resources/foo.rb", <<~EOM + default_action :create EOM - file "providers/foo.rb", <<EOM -action :create do -end + file "providers/foo.rb", <<~EOM + action :create do + end EOM - file "recipes/default.rb", <<EOM -l_w_r_p_foo "me" + file "recipes/default.rb", <<~EOM + l_w_r_p_foo "me" EOM end # directory 'cookbooks/x' end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'l-w-r-p::default'", cwd: chef_dir) diff --git a/spec/integration/recipes/notifies_spec.rb b/spec/integration/recipes/notifies_spec.rb index 2aa02554b9..596f7b1970 100644 --- a/spec/integration/recipes/notifies_spec.rb +++ b/spec/integration/recipes/notifies_spec.rb @@ -26,10 +26,10 @@ describe "notifications" do end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -43,34 +43,34 @@ EOM before do directory "cookbooks/x" do - file "resources/notifying_test.rb", <<EOM -default_action :run -provides :notifying_test -resource_name :notifying_test - -action :run do - log "bar" do - notifies :write, 'log[foo]', :delayed - end -end + file "resources/notifying_test.rb", <<~EOM + default_action :run + provides :notifying_test + resource_name :notifying_test + + action :run do + log "bar" do + notifies :write, 'log[foo]', :delayed + end + end EOM - file "recipes/default.rb", <<EOM -log "foo" do - action :nothing -end -notifying_test "whatever" -log "baz" + file "recipes/default.rb", <<~EOM + log "foo" do + action :nothing + end + notifying_test "whatever" + log "baz" EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -84,36 +84,36 @@ EOM before do directory "cookbooks/x" do - file "resources/notifying_test.rb", <<EOM -default_action :run -provides :notifying_test -resource_name :notifying_test - -action :run do - log "bar" do - notifies :write, 'log[foo]', :delayed - end -end + file "resources/notifying_test.rb", <<~EOM + default_action :run + provides :notifying_test + resource_name :notifying_test + + action :run do + log "bar" do + notifies :write, 'log[foo]', :delayed + end + end EOM - file "recipes/default.rb", <<EOM -log "foo" do - action :nothing -end -notifying_test "whatever" -log "baz" do - notifies :write, 'log[foo]', :delayed -end + file "recipes/default.rb", <<~EOM + log "foo" do + action :nothing + end + notifying_test "whatever" + log "baz" do + notifies :write, 'log[foo]', :delayed + end EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -129,38 +129,38 @@ EOM before do directory "cookbooks/x" do - file "resources/notifying_test.rb", <<EOM -default_action :run -provides :notifying_test -resource_name :notifying_test - -action :run do - log "bar" do - notifies :write, 'log[foo]', :delayed - end -end + file "resources/notifying_test.rb", <<~EOM + default_action :run + provides :notifying_test + resource_name :notifying_test + + action :run do + log "bar" do + notifies :write, 'log[foo]', :delayed + end + end EOM - file "recipes/default.rb", <<EOM -log "foo" do - action :nothing -end -log "quux" do - notifies :write, 'log[foo]', :delayed - notifies :write, 'log[baz]', :delayed -end -notifying_test "whatever" -log "baz" + file "recipes/default.rb", <<~EOM + log "foo" do + action :nothing + end + log "quux" do + notifies :write, 'log[foo]', :delayed + notifies :write, 'log[baz]', :delayed + end + notifying_test "whatever" + log "baz" EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -175,26 +175,26 @@ EOM when_the_repository "notifies delayed four" do before do directory "cookbooks/x" do - file "recipes/default.rb", <<EOM -log "foo" do - action :nothing -end -log "bar" do - notifies :write, 'log[foo]', :delayed -end -log "baz" do - notifies :write, 'log[foo]', :delayed -end + file "recipes/default.rb", <<~EOM + log "foo" do + action :nothing + end + log "bar" do + notifies :write, 'log[foo]', :delayed + end + log "baz" do + notifies :write, 'log[foo]', :delayed + end EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -210,34 +210,34 @@ EOM before do directory "cookbooks/x" do - file "resources/notifying_test.rb", <<EOM -default_action :run -provides :notifying_test -resource_name :notifying_test - -action :run do - log "bar" do - notifies :write, 'log[foo]', :immediately - end -end + file "resources/notifying_test.rb", <<~EOM + default_action :run + provides :notifying_test + resource_name :notifying_test + + action :run do + log "bar" do + notifies :write, 'log[foo]', :immediately + end + end EOM - file "recipes/default.rb", <<EOM -log "foo" do - action :nothing -end -notifying_test "whatever" -log "baz" + file "recipes/default.rb", <<~EOM + log "foo" do + action :nothing + end + notifying_test "whatever" + log "baz" EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -250,34 +250,34 @@ EOM before do directory "cookbooks/x" do - file "resources/notifying_test.rb", <<EOM -default_action :run -provides :notifying_test -resource_name :notifying_test - -action :run do - log "bar" do - notifies :write, resources(log: "foo"), :immediately - end -end + file "resources/notifying_test.rb", <<~EOM + default_action :run + provides :notifying_test + resource_name :notifying_test + + action :run do + log "bar" do + notifies :write, resources(log: "foo"), :immediately + end + end EOM - file "recipes/default.rb", <<EOM -log "foo" do - action :nothing -end -notifying_test "whatever" -log "baz" + file "recipes/default.rb", <<~EOM + log "foo" do + action :nothing + end + notifying_test "whatever" + log "baz" EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -290,31 +290,31 @@ EOM before do directory "cookbooks/x" do - file "resources/notifying_test.rb", <<EOM -default_action :run -provides :notifying_test -resource_name :notifying_test - -action :run do - log "bar" do - notifies :write, "log[foo]" - end -end + file "resources/notifying_test.rb", <<~EOM + default_action :run + provides :notifying_test + resource_name :notifying_test + + action :run do + log "bar" do + notifies :write, "log[foo]" + end + end EOM - file "recipes/default.rb", <<EOM -notifying_test "whatever" -log "baz" + file "recipes/default.rb", <<~EOM + notifying_test "whatever" + log "baz" EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -327,34 +327,34 @@ EOM before do directory "cookbooks/x" do - file "resources/cloning_test.rb", <<EOM -default_action :run -provides :cloning_test -resource_name :cloning_test - -action :run do - log "bar" do - level :info - end -end + file "resources/cloning_test.rb", <<~EOM + default_action :run + provides :cloning_test + resource_name :cloning_test + + action :run do + log "bar" do + level :info + end + end EOM - file "recipes/default.rb", <<EOM -log "bar" do - level :warn -end - -cloning_test "whatever" + file "recipes/default.rb", <<~EOM + log "bar" do + level :warn + end + + cloning_test "whatever" EOM end end it "should complete with success" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) @@ -379,10 +379,10 @@ EOM end it "notifying the resource should work" do - file "config/client.rb", <<EOM -local_mode true -cookbook_path "#{path_to('cookbooks')}" -log_level :warn + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to('cookbooks')}" + log_level :warn EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb index f0ba4822a7..e1def5e191 100644 --- a/spec/integration/recipes/resource_converge_if_changed_spec.rb +++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb @@ -65,8 +65,8 @@ describe "Resource::ActionClass#converge_if_changed" do it "the resource updates nothing" do expect(resource.converged).to eq 0 expect(resource.updated?).to be_falsey - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create (up to date) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create (up to date) EOM end end @@ -83,10 +83,10 @@ describe "Resource::ActionClass#converge_if_changed" do it "the resource updates state1" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set state1 to "new_state1" (was "current_state1") + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set state1 to "new_state1" (was "current_state1") EOM end end @@ -104,11 +104,11 @@ describe "Resource::ActionClass#converge_if_changed" do it "the resource updates state1 and state2" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set state1 to "new_state1" (was "current_state1") - - set state2 to "new_state2" (was "current_state2") + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set state1 to "new_state1" (was "current_state1") + - set state2 to "new_state2" (was "current_state2") EOM end end @@ -127,11 +127,11 @@ EOM it "the resource updates state1 and state2" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set state1 to (suppressed sensitive property) - - set state2 to (suppressed sensitive property) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set state1 to (suppressed sensitive property) + - set state2 to (suppressed sensitive property) EOM end end @@ -148,10 +148,10 @@ EOM it "the resource updates sensitive1" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set sensitive1 to (suppressed sensitive property) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set sensitive1 to (suppressed sensitive property) EOM end end @@ -169,10 +169,10 @@ EOM it "the resource updates state2" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set state2 to "new_state2" (was "current_state2") + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set state2 to "new_state2" (was "current_state2") EOM end end @@ -190,8 +190,8 @@ EOM it "the resource updates nothing" do expect(resource.converged).to eq 0 expect(resource.updated?).to be_falsey - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create (up to date) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create (up to date) EOM end end @@ -211,8 +211,8 @@ EOM it "the resource updates nothing" do expect(resource.converged).to eq 0 expect(resource.updated?).to be_falsey - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create (up to date) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create (up to date) EOM end end @@ -241,10 +241,10 @@ EOM it "the resource updates identity1" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update current_identity1 - - set identity1 to "new_identity1" (was "current_identity1") + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update current_identity1 + - set identity1 to "new_identity1" (was "current_identity1") EOM end end @@ -263,13 +263,13 @@ EOM it "the resource is created" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - create default_identity1 - - set identity1 to "default_identity1" (default value) - - set state1 to "default_state1" (default value) - - set state2 to "default_state2" (default value) - - set sensitive1 to (suppressed sensitive property) (default value) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - create default_identity1 + - set identity1 to "default_identity1" (default value) + - set state1 to "default_state1" (default value) + - set state2 to "default_state2" (default value) + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end @@ -288,13 +288,13 @@ EOM it "the resource is created" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - create default_identity1 - - set identity1 to "default_identity1" (default value) - - set state1 to "new_state1" - - set state2 to "new_state2" - - set sensitive1 to (suppressed sensitive property) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - create default_identity1 + - set identity1 to "default_identity1" (default value) + - set state1 to "new_state1" + - set state2 to "new_state2" + - set sensitive1 to (suppressed sensitive property) EOM end end @@ -313,13 +313,13 @@ EOM it "the resource is created" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - create default_identity1 - - set identity1 to (suppressed sensitive property) (default value) - - set state1 to (suppressed sensitive property) - - set state2 to (suppressed sensitive property) - - set sensitive1 to (suppressed sensitive property) (default value) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - create default_identity1 + - set identity1 to (suppressed sensitive property) (default value) + - set state1 to (suppressed sensitive property) + - set state2 to (suppressed sensitive property) + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end @@ -355,8 +355,8 @@ EOM it "the resource updates nothing" do expect(resource.converged).to eq 0 expect(resource.updated?).to be_falsey - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create (up to date) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create (up to date) EOM end end @@ -374,10 +374,10 @@ EOM it "the resource updates state1" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set state1 to "new_state1" (was "current_state1") + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set state1 to "new_state1" (was "current_state1") EOM end end @@ -395,12 +395,12 @@ EOM it "the resource updates state1 and state2" do expect(resource.converged).to eq 2 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set state1 to "new_state1" (was "current_state1") - - update default_identity1 - - set state2 to "new_state2" (was "current_state2") + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set state1 to "new_state1" (was "current_state1") + - update default_identity1 + - set state2 to "new_state2" (was "current_state2") EOM end end @@ -418,10 +418,10 @@ EOM it "the resource updates state2" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set state2 to "new_state2" (was "current_state2") + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set state2 to "new_state2" (was "current_state2") EOM end end @@ -439,8 +439,8 @@ EOM it "the resource updates nothing" do expect(resource.converged).to eq 0 expect(resource.updated?).to be_falsey - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create (up to date) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create (up to date) EOM end end @@ -457,10 +457,10 @@ EOM it "the resource updates sensitive1" do expect(resource.converged).to eq 1 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - update default_identity1 - - set sensitive1 to (suppressed sensitive property) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - update default_identity1 + - set sensitive1 to (suppressed sensitive property) EOM end end @@ -481,14 +481,14 @@ EOM it "the resource is created" do expect(resource.converged).to eq 3 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - create default_identity1 - - set state1 to "default_state1" (default value) - - create default_identity1 - - set state2 to "default_state2" (default value) - - create default_identity1 - - set sensitive1 to (suppressed sensitive property) (default value) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - create default_identity1 + - set state1 to "default_state1" (default value) + - create default_identity1 + - set state2 to "default_state2" (default value) + - create default_identity1 + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end @@ -507,14 +507,14 @@ EOM it "the resource is created" do expect(resource.converged).to eq 3 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - create default_identity1 - - set state1 to "new_state1" - - create default_identity1 - - set state2 to "new_state2" - - create default_identity1 - - set sensitive1 to (suppressed sensitive property) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - create default_identity1 + - set state1 to "new_state1" + - create default_identity1 + - set state2 to "new_state2" + - create default_identity1 + - set sensitive1 to (suppressed sensitive property) EOM end end @@ -533,14 +533,14 @@ EOM it "the resource is created" do expect(resource.converged).to eq 3 expect(resource.updated?).to be_truthy - expect(converged_recipe.stdout).to eq <<-EOM -* #{resource_name}[blah] action create - - create default_identity1 - - set state1 to (suppressed sensitive property) - - create default_identity1 - - set state2 to (suppressed sensitive property) - - create default_identity1 - - set sensitive1 to (suppressed sensitive property) (default value) + expect(converged_recipe.stdout).to eq <<~EOM + * #{resource_name}[blah] action create + - create default_identity1 + - set state1 to (suppressed sensitive property) + - create default_identity1 + - set state2 to (suppressed sensitive property) + - create default_identity1 + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index 36fabd232d..58314473e7 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -23,8 +23,8 @@ describe "chef-solo" do let(:node_file) { Dir[File.join(nodes_dir, "*.json")][0] } before do - file "config/solo.rb", <<EOM -chef_repo_path "#{@repository_dir}" + file "config/solo.rb", <<~EOM + chef_repo_path "#{@repository_dir}" EOM result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir) result.error! @@ -74,9 +74,9 @@ EOM end it "should complete with success" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) result.error! @@ -84,13 +84,13 @@ EOM end it "should evaluate its node.json file" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM - file "config/node.json", <<-E -{"run_list":["x::default"]} + file "config/node.json", <<~E + {"run_list":["x::default"]} E result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", cwd: chef_dir) @@ -110,9 +110,9 @@ E end it "should exit with an error" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) expect(result.exitstatus).to eq(0) # For CHEF-5120 this becomes 1 @@ -124,9 +124,9 @@ EOM before do file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'") file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"' - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM end @@ -141,9 +141,9 @@ EOM before do file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nohai_version '~> 999.0'") file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"' - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM end @@ -159,23 +159,23 @@ EOM directory "logs" file "logs/runs.log", "" file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb - file "cookbooks/x/recipes/default.rb", <<EOM -ruby_block "sleeping" do - block do - retries = 200 - while IO.read(Chef::Config[:log_location]) !~ /Chef client .* is running, will wait for it to finish and then run./ - sleep 0.1 - raise "we ran out of retries" if ( retries -= 1 ) <= 0 - end - end -end + file "cookbooks/x/recipes/default.rb", <<~EOM + ruby_block "sleeping" do + block do + retries = 200 + while IO.read(Chef::Config[:log_location]) !~ /Chef client .* is running, will wait for it to finish and then run./ + sleep 0.1 + raise "we ran out of retries" if ( retries -= 1 ) <= 0 + end + end + end EOM end it "while running solo concurrently" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM # We have a timeout protection here so that if due to some bug # run_lock gets stuck we can discover it. |