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 | |
parent | 35603c7ce1bd3ccf35334ed65152140f0ecaf080 (diff) | |
download | chef-dcac6762380d011f73cf53a50476d31dab0025ee.tar.gz |
fix Layout/IndentHeredoc
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
106 files changed, 5915 insertions, 5915 deletions
diff --git a/spec/functional/resource/dnf_package_spec.rb b/spec/functional/resource/dnf_package_spec.rb index 921c48da84..f05d297004 100644 --- a/spec/functional/resource/dnf_package_spec.rb +++ b/spec/functional/resource/dnf_package_spec.rb @@ -39,12 +39,12 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do before(:each) do File.open("/etc/yum.repos.d/chef-dnf-localtesting.repo", "w+") do |f| - f.write <<-EOF -[chef-dnf-localtesting] -name=Chef DNF spec testing repo -baseurl=file://#{CHEF_SPEC_ASSETS}/yumrepo -enable=1 -gpgcheck=0 + f.write <<~EOF + [chef-dnf-localtesting] + name=Chef DNF spec testing repo + baseurl=file://#{CHEF_SPEC_ASSETS}/yumrepo + enable=1 + gpgcheck=0 EOF end shell_out!("rpm -qa | grep chef_rpm | xargs -r rpm -e") diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb index efda46abbe..3b7042610b 100644 --- a/spec/functional/resource/dsc_script_spec.rb +++ b/spec/functional/resource/dsc_script_spec.rb @@ -147,39 +147,39 @@ EOH let(:dsc_user_suffix_code) { dsc_user_suffix } let(:dsc_script_environment_attribute) { nil } let(:dsc_user_resources_code) do - <<-EOH - #{config_param_section} -node localhost -{ -$testuser = #{dsc_user_code} -$testpassword = ConvertTo-SecureString -String "jf9a8m49jrajf4#" -AsPlainText -Force -$testcred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $testuser, $testpassword - -User dsctestusercreate -{ - UserName = $testuser - Password = $testcred - Description = "DSC test user" - Ensure = "Present" - Disabled = $false - PasswordNeverExpires = $true - PasswordChangeRequired = $false -} -} + <<~EOH + #{config_param_section} + node localhost + { + $testuser = #{dsc_user_code} + $testpassword = ConvertTo-SecureString -String "jf9a8m49jrajf4#" -AsPlainText -Force + $testcred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $testuser, $testpassword + + User dsctestusercreate + { + UserName = $testuser + Password = $testcred + Description = "DSC test user" + Ensure = "Present" + Disabled = $false + PasswordNeverExpires = $true + PasswordChangeRequired = $false + } + } EOH end let(:dsc_user_config_data) do - <<-EOH -@{ - AllNodes = @( - @{ - NodeName = "localhost"; - PSDscAllowPlainTextPassword = $true - } - ) -} - + <<~EOH + @{ + AllNodes = @( + @{ + NodeName = "localhost"; + PSDscAllowPlainTextPassword = $true + } + ) + } + EOH end @@ -188,17 +188,17 @@ EOH let(:dsc_environment_fail_etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" } let(:exception_message_signature) { "LL927-LL928" } let(:dsc_environment_config) do - <<-EOH -if (($pwd.path -eq '#{dsc_environment_fail_etc_directory}') -and (test-path('#{dsc_environment_fail_etc_directory}'))) -{ - throw 'Signature #{exception_message_signature}: Purposefully failing because cwd == #{dsc_environment_fail_etc_directory}' -} -environment "whatsmydir" -{ - Name = '#{dsc_environment_env_var_name}' - Value = $pwd.path - Ensure = 'Present' -} + <<~EOH + if (($pwd.path -eq '#{dsc_environment_fail_etc_directory}') -and (test-path('#{dsc_environment_fail_etc_directory}'))) + { + throw 'Signature #{exception_message_signature}: Purposefully failing because cwd == #{dsc_environment_fail_etc_directory}' + } + environment "whatsmydir" + { + Name = '#{dsc_environment_env_var_name}' + Value = $pwd.path + Ensure = 'Present' + } EOH end @@ -243,12 +243,12 @@ EOH shared_examples_for "a dsc_script resource with configuration affected by cwd" do after(:each) do removal_resource = Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context) - removal_resource.code <<-EOH -environment 'removethis' -{ - Name = '#{dsc_environment_env_var_name}' - Ensure = 'Absent' -} + removal_resource.code <<~EOH + environment 'removethis' + { + Name = '#{dsc_environment_env_var_name}' + Ensure = 'Absent' + } EOH removal_resource.run_action(:run) end @@ -409,45 +409,45 @@ EOH end let(:dsc_configuration_script) do - <<-MYCODE -cd c:\\ -configuration LCM -{ - param ($thumbprint) - localconfigurationmanager - { - RebootNodeIfNeeded = $false - ConfigurationMode = 'ApplyOnly' - CertificateID = $thumbprint - } -} -$cert = ls Cert:\\LocalMachine\\My\\ | - Where-Object {$_.Subject -match "ChefTest"} | - Select -first 1 - -if($cert -eq $null) { - $pfxpath = '#{self_signed_cert_path}' - $password = '' - $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($pfxpath, $password, ([System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet -bor [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::MachineKeyset)) - $store = New-Object System.Security.Cryptography.X509Certificates.X509Store "My", ([System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine) - $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite) - $store.Add($cert) - $store.Close() -} - -lcm -thumbprint $cert.thumbprint -set-dsclocalconfigurationmanager -path ./LCM -$ConfigurationData = @" -@{ -AllNodes = @( - @{ - NodeName = "localhost"; - CertificateID = '$($cert.thumbprint)'; - }; -); -} -"@ -$ConfigurationData | out-file '#{configuration_data_path}' -force + <<~MYCODE + cd c:\\ + configuration LCM + { + param ($thumbprint) + localconfigurationmanager + { + RebootNodeIfNeeded = $false + ConfigurationMode = 'ApplyOnly' + CertificateID = $thumbprint + } + } + $cert = ls Cert:\\LocalMachine\\My\\ | + Where-Object {$_.Subject -match "ChefTest"} | + Select -first 1 + + if($cert -eq $null) { + $pfxpath = '#{self_signed_cert_path}' + $password = '' + $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($pfxpath, $password, ([System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet -bor [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::MachineKeyset)) + $store = New-Object System.Security.Cryptography.X509Certificates.X509Store "My", ([System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine) + $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite) + $store.Add($cert) + $store.Close() + } + + lcm -thumbprint $cert.thumbprint + set-dsclocalconfigurationmanager -path ./LCM + $ConfigurationData = @" + @{ + AllNodes = @( + @{ + NodeName = "localhost"; + CertificateID = '$($cert.thumbprint)'; + }; + ); + } + "@ + $ConfigurationData | out-file '#{configuration_data_path}' -force MYCODE end @@ -460,13 +460,13 @@ $ConfigurationData | out-file '#{configuration_data_path}' -force let(:dsc_script_resource) do dsc_test_resource_base.tap do |r| - r.code <<-EOF -User dsctestusercreate -{ - UserName = '#{dsc_user}' - Password = #{r.ps_credential('jf9a8m49jrajf4#')} - Ensure = "Present" -} + r.code <<~EOF + User dsctestusercreate + { + UserName = '#{dsc_user}' + Password = #{r.ps_credential('jf9a8m49jrajf4#')} + Ensure = "Present" + } EOF r.configuration_data_script(configuration_data_path) end diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb index 1fa3f54515..16cde6351a 100644 --- a/spec/functional/resource/git_spec.rb +++ b/spec/functional/resource/git_spec.rb @@ -65,10 +65,10 @@ describe Chef::Resource::Git, requires_git: true do let(:rev_head) { "d294fbfd05aa7709ad9a9b8ef6343b17d355bf5f" } let(:git_user_config) do - <<-E -[user] - name = frodoTbaggins - email = frodo@shire.org + <<~E + [user] + name = frodoTbaggins + email = frodo@shire.org E end diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb index 4828d0fa79..cc1bd8fd1c 100644 --- a/spec/functional/resource/powershell_script_spec.rb +++ b/spec/functional/resource/powershell_script_spec.rb @@ -255,16 +255,16 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do context "when dsc is supported", :windows_powershell_dsc_only do it "can execute LCM configuration code" do - resource.code <<-EOF -configuration LCM -{ - param ($thumbprint) - localconfigurationmanager - { - RebootNodeIfNeeded = $false - ConfigurationMode = 'ApplyOnly' - } -} + resource.code <<~EOF + configuration LCM + { + param ($thumbprint) + localconfigurationmanager + { + RebootNodeIfNeeded = $false + ConfigurationMode = 'ApplyOnly' + } + } EOF expect { resource.run_action(:run) }.not_to raise_error end diff --git a/spec/functional/resource/yum_package_spec.rb b/spec/functional/resource/yum_package_spec.rb index 5751e92ce5..8b49ec4080 100644 --- a/spec/functional/resource/yum_package_spec.rb +++ b/spec/functional/resource/yum_package_spec.rb @@ -45,12 +45,12 @@ describe Chef::Resource::YumPackage, :requires_root, external: exclude_test do before(:each) do File.open("/etc/yum.repos.d/chef-yum-localtesting.repo", "w+") do |f| - f.write <<-EOF -[chef-yum-localtesting] -name=Chef DNF spec testing repo -baseurl=file://#{CHEF_SPEC_ASSETS}/yumrepo -enable=1 -gpgcheck=0 + f.write <<~EOF + [chef-yum-localtesting] + name=Chef DNF spec testing repo + baseurl=file://#{CHEF_SPEC_ASSETS}/yumrepo + enable=1 + gpgcheck=0 EOF end shell_out!("rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | grep chef_rpm | xargs -r rpm -e") diff --git a/spec/functional/win32/crypto_spec.rb b/spec/functional/win32/crypto_spec.rb index 145c9881b9..5fcbca02b6 100644 --- a/spec/functional/win32/crypto_spec.rb +++ b/spec/functional/win32/crypto_spec.rb @@ -37,15 +37,15 @@ describe "Chef::ReservedNames::Win32::Crypto", :windows_only do it "can be decrypted by powershell" do encrypted = Chef::ReservedNames::Win32::Crypto.encrypt(plaintext) resource = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context) - resource.code <<-EOF -$encrypted = '#{encrypted}' | ConvertTo-SecureString -$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($encrypted) -$plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) -if ($plaintext -ne '#{plaintext}') { - Write-Error 'Got: ' $plaintext - exit 1 -} -exit 0 + resource.code <<~EOF + $encrypted = '#{encrypted}' | ConvertTo-SecureString + $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($encrypted) + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) + if ($plaintext -ne '#{plaintext}') { + Write-Error 'Got: ' $plaintext + exit 1 + } + exit 0 EOF resource.returns(0) resource.run_action(:run) 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. diff --git a/spec/unit/audit/audit_reporter_spec.rb b/spec/unit/audit/audit_reporter_spec.rb index f6707825cf..9f74ba93e1 100644 --- a/spec/unit/audit/audit_reporter_spec.rb +++ b/spec/unit/audit/audit_reporter_spec.rb @@ -99,10 +99,10 @@ describe Chef::Audit::AuditReporter do reporter.run_completed(node) expect(run_data).to have_key(:error) expect(run_data).to have_key(:error) - expect(run_data[:error]).to eq <<-EOM.strip! -Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp -/path/recipe.rb:57 -/path/library.rb:106 + expect(run_data[:error]).to eq <<~EOM.strip! + Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp + /path/recipe.rb:57 + /path/library.rb:106 EOM end @@ -269,10 +269,10 @@ EOM expect(rest).to receive(:post) reporter.run_failed(run_error) expect(run_data).to have_key(:error) - expect(run_data[:error]).to eq <<-EOM.strip! -Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp -/path/recipe.rb:57 -/path/library.rb:106 + expect(run_data[:error]).to eq <<~EOM.strip! + Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp + /path/recipe.rb:57 + /path/library.rb:106 EOM end end diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb index 0e72a285af..6d94e87e21 100644 --- a/spec/unit/client_spec.rb +++ b/spec/unit/client_spec.rb @@ -410,8 +410,8 @@ describe Chef::Client do let(:run_context) { double("Chef::RunContext") } let(:recipe) { double("Chef::Recipe (required recipe)") } let(:required_recipe) do - <<EOM -fake_recipe_variable = "for reals" + <<~EOM + fake_recipe_variable = "for reals" EOM end @@ -429,8 +429,8 @@ EOM context "when the required_recipe has bad contents" do let(:required_recipe) do - <<EOM -this is not a recipe + <<~EOM + this is not a recipe EOM end it "should not raise an error" do diff --git a/spec/unit/formatters/error_description_spec.rb b/spec/unit/formatters/error_description_spec.rb index cf6372ed49..a09d295c9b 100644 --- a/spec/unit/formatters/error_description_spec.rb +++ b/spec/unit/formatters/error_description_spec.rb @@ -69,18 +69,18 @@ describe Chef::Formatters::ErrorDescription do context "when no sections have been added" do it "should output only the title and the Platform section" do subject.display(out) - expect(out.out.string).to eq <<-END -================================================================================ -test title -================================================================================ - -System Info: ------------- -chef_version=1.2.3 -ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] -program_name=chef-client -executable=/test/bin/chef-client - + expect(out.out.string).to eq <<~END + ================================================================================ + test title + ================================================================================ + + System Info: + ------------ + chef_version=1.2.3 + ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] + program_name=chef-client + executable=/test/bin/chef-client + END end end @@ -92,22 +92,22 @@ executable=/test/bin/chef-client it "should output the expected sections" do subject.display(out) - expect(out.out.string).to eq <<-END -================================================================================ -test title -================================================================================ - -test heading ------------- -test text - -System Info: ------------- -chef_version=1.2.3 -ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] -program_name=chef-client -executable=/test/bin/chef-client - + expect(out.out.string).to eq <<~END + ================================================================================ + test title + ================================================================================ + + test heading + ------------ + test text + + System Info: + ------------ + chef_version=1.2.3 + ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] + program_name=chef-client + executable=/test/bin/chef-client + END end @@ -119,20 +119,20 @@ executable=/test/bin/chef-client # reset on global values. Chef.set_node({ "platform" => "openvms", "platform_version" => "8.4-2L1" }) subject.display(out) - expect(out.out.string).to eq <<-END -================================================================================ -test title -================================================================================ - -System Info: ------------- -chef_version=1.2.3 -platform=openvms -platform_version=8.4-2L1 -ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] -program_name=chef-client -executable=/test/bin/chef-client - + expect(out.out.string).to eq <<~END + ================================================================================ + test title + ================================================================================ + + System Info: + ------------ + chef_version=1.2.3 + platform=openvms + platform_version=8.4-2L1 + ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] + program_name=chef-client + executable=/test/bin/chef-client + END end diff --git a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb index 2c1da7345b..9ec2c8d567 100644 --- a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb @@ -18,22 +18,22 @@ require "spec_helper" -BAD_RECIPE = <<-E -# -# Cookbook Name:: syntax-err -# Recipe:: default -# -# Copyright 2012-2016, YOUR_COMPANY_NAME -# -# All rights reserved - Do Not Redistribute -# - - -file "/tmp/explode-me" do - mode 0655 - owner "root" - this_is_not_a_valid_method -end +BAD_RECIPE = <<~E + # + # Cookbook Name:: syntax-err + # Recipe:: default + # + # Copyright 2012-2016, YOUR_COMPANY_NAME + # + # All rights reserved - Do Not Redistribute + # + + + file "/tmp/explode-me" do + mode 0655 + owner "root" + this_is_not_a_valid_method + end E describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb index c50a2c0481..4502bb651c 100644 --- a/spec/unit/http/authenticator_spec.rb +++ b/spec/unit/http/authenticator_spec.rb @@ -98,16 +98,16 @@ describe Chef::HTTP::Authenticator do end context "when ssh_agent_signing" do - let(:public_key) { <<-EOH } ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA49TA0y81ps0zxkOpmf5V -4/c4IeR5yVyQFpX3JpxO4TquwnRh8VSUhrw8kkTLmB3cS39Db+3HadvhoqCEbqPE -6915kXSuk/cWIcNozujLK7tkuPEyYVsyTioQAddSdfe+8EhQVf3oHxaKmUd6waXr -WqYCnhxgOjxocenREYNhZ/OETIeiPbOku47vB4nJK/0GhKBytL2XnsRgfKgDxf42 -BqAi1jglIdeq8lAWZNF9TbNBU21AO1iuT7Pm6LyQujhggPznR5FJhXKRUARXBJZa -wxpGV4dGtdcahwXNE4601aXPra+xPcRd2puCNoEDBzgVuTSsLYeKBDMSfs173W1Q -YwIDAQAB ------END PUBLIC KEY----- + let(:public_key) { <<~EOH } + -----BEGIN PUBLIC KEY----- + MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA49TA0y81ps0zxkOpmf5V + 4/c4IeR5yVyQFpX3JpxO4TquwnRh8VSUhrw8kkTLmB3cS39Db+3HadvhoqCEbqPE + 6915kXSuk/cWIcNozujLK7tkuPEyYVsyTioQAddSdfe+8EhQVf3oHxaKmUd6waXr + WqYCnhxgOjxocenREYNhZ/OETIeiPbOku47vB4nJK/0GhKBytL2XnsRgfKgDxf42 + BqAi1jglIdeq8lAWZNF9TbNBU21AO1iuT7Pm6LyQujhggPznR5FJhXKRUARXBJZa + wxpGV4dGtdcahwXNE4601aXPra+xPcRd2puCNoEDBzgVuTSsLYeKBDMSfs173W1Q + YwIDAQAB + -----END PUBLIC KEY----- EOH let(:class_instance) { Chef::HTTP::Authenticator.new(client_name: "test", raw_key: public_key, ssh_agent_signing: true) } diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb index 4af506d227..0809483577 100644 --- a/spec/unit/key_spec.rb +++ b/spec/unit/key_spec.rb @@ -24,16 +24,16 @@ describe Chef::Key do # whether user or client irrelevent to these tests let(:key) { Chef::Key.new("original_actor", "user") } let(:public_key_string) do - <<EOS ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvPo+oNPB7uuNkws0fC02 -KxSwdyqPLu0fhI1pOweNKAZeEIiEz2PkybathHWy8snSXGNxsITkf3eyvIIKa8OZ -WrlqpI3yv/5DOP8HTMCxnFuMJQtDwMcevlqebX4bCxcByuBpNYDcAHjjfLGSfMjn -E5lZpgYWwnpic4kSjYcL9ORK9nYvlWV9P/kCYmRhIjB4AhtpWRiOfY/TKi3P2LxT -IjSmiN/ihHtlhV/VSnBJ5PzT/lRknlrJ4kACoz7Pq9jv+aAx5ft/xE9yDa2DYs0q -Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo -0wIDAQAB ------END PUBLIC KEY----- + <<~EOS + -----BEGIN PUBLIC KEY----- + MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvPo+oNPB7uuNkws0fC02 + KxSwdyqPLu0fhI1pOweNKAZeEIiEz2PkybathHWy8snSXGNxsITkf3eyvIIKa8OZ + WrlqpI3yv/5DOP8HTMCxnFuMJQtDwMcevlqebX4bCxcByuBpNYDcAHjjfLGSfMjn + E5lZpgYWwnpic4kSjYcL9ORK9nYvlWV9P/kCYmRhIjB4AhtpWRiOfY/TKi3P2LxT + IjSmiN/ihHtlhV/VSnBJ5PzT/lRknlrJ4kACoz7Pq9jv+aAx5ft/xE9yDa2DYs0q + Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo + 0wIDAQAB + -----END PUBLIC KEY----- EOS end diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb index 95ebe95fe7..7f890534bc 100644 --- a/spec/unit/knife/cookbook_upload_spec.rb +++ b/spec/unit/knife/cookbook_upload_spec.rb @@ -112,16 +112,16 @@ describe Chef::Knife::CookbookUpload do it "emits a warning" do knife.run - expected_message = <<-E -WARNING: The cookbooks: test_cookbook exist in multiple places in your cookbook_path. -A composite version of these cookbooks has been compiled for uploading. - -IMPORTANT: In a future version of Chef, this behavior will be removed and you will no longer -be able to have the same version of a cookbook in multiple places in your cookbook_path. -WARNING: The affected cookbooks are located: -test_cookbook: - /path/one/test_cookbook - /path/two/test_cookbook + expected_message = <<~E + WARNING: The cookbooks: test_cookbook exist in multiple places in your cookbook_path. + A composite version of these cookbooks has been compiled for uploading. + + IMPORTANT: In a future version of Chef, this behavior will be removed and you will no longer + be able to have the same version of a cookbook in multiple places in your cookbook_path. + WARNING: The affected cookbooks are located: + test_cookbook: + /path/one/test_cookbook + /path/two/test_cookbook E expect(output.string).to include(expected_message) end diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index 7ee177a7d1..bd48709a93 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -69,12 +69,12 @@ describe Chef::Knife::Core::BootstrapContext do end it "generates the config file data" do - expected = <<-EXPECTED -chef_server_url "http://chef.example.com:4444" -validation_client_name "chef-validator-testing" -log_level :info -log_location "/tmp/log" -# Using default node name (fqdn) + expected = <<~EXPECTED + chef_server_url "http://chef.example.com:4444" + validation_client_name "chef-validator-testing" + log_level :info + log_location "/tmp/log" + # Using default node name (fqdn) EXPECTED expect(bootstrap_context.config_content).to eq expected end diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb index c2b87cca38..65463005c9 100644 --- a/spec/unit/knife/core/ui_spec.rb +++ b/spec/unit/knife/core/ui_spec.rb @@ -211,9 +211,9 @@ describe Chef::Knife::UI do it "formats hashes appropriately" do @ui.output({ "hi" => "a", "lo" => "b" }) - expect(@out.string).to eq <<EOM -hi: a -lo: b + expect(@out.string).to eq <<~EOM + hi: a + lo: b EOM end @@ -224,9 +224,9 @@ EOM it "formats arrays appropriately" do @ui.output(%w{a b}) - expect(@out.string).to eq <<EOM -a -b + expect(@out.string).to eq <<~EOM + a + b EOM end @@ -247,74 +247,74 @@ EOM it "formats nested arrays appropriately" do @ui.output([ %w{a b}, %w{c d}]) - expect(@out.string).to eq <<EOM -a -b - -c -d + expect(@out.string).to eq <<~EOM + a + b + + c + d EOM end it "formats nested arrays with single- and empty subarrays appropriately" do @ui.output([ %w{a b}, [ "c" ], [], %w{d e}]) - expect(@out.string).to eq <<EOM -a -b - -c - - -d -e + expect(@out.string).to eq <<~EOM + a + b + + c + + + d + e EOM end it "formats arrays of hashes with extra lines in between for readability" do @ui.output([ { "a" => "b", "c" => "d" }, { "x" => "y" }, { "m" => "n", "o" => "p" }]) - expect(@out.string).to eq <<EOM -a: b -c: d - -x: y - -m: n -o: p + expect(@out.string).to eq <<~EOM + a: b + c: d + + x: y + + m: n + o: p EOM end it "formats hashes with empty array members appropriately" do @ui.output({ "a" => [], "b" => "c" }) - expect(@out.string).to eq <<EOM -a: -b: c + expect(@out.string).to eq <<~EOM + a: + b: c EOM end it "formats hashes with single-member array values appropriately" do @ui.output({ "a" => [ "foo" ], "b" => "c" }) - expect(@out.string).to eq <<EOM -a: foo -b: c + expect(@out.string).to eq <<~EOM + a: foo + b: c EOM end it "formats hashes with array members appropriately" do @ui.output({ "a" => %w{foo bar}, "b" => "c" }) - expect(@out.string).to eq <<EOM -a: - foo - bar -b: c + expect(@out.string).to eq <<~EOM + a: + foo + bar + b: c EOM end it "formats hashes with single-member nested array values appropriately" do @ui.output({ "a" => [ [ "foo" ] ], "b" => "c" }) - expect(@out.string).to eq <<EOM -a: - foo -b: c + expect(@out.string).to eq <<~EOM + a: + foo + b: c EOM end @@ -327,19 +327,19 @@ EOM it "formats hashes with hash values appropriately" do @ui.output({ "a" => { "aa" => "bb", "cc" => "dd" }, "b" => "c" }) - expect(@out.string).to eq <<EOM -a: - aa: bb - cc: dd -b: c + expect(@out.string).to eq <<~EOM + a: + aa: bb + cc: dd + b: c EOM end it "formats hashes with empty hash values appropriately" do @ui.output({ "a" => {}, "b" => "c" }) - expect(@out.string).to eq <<EOM -a: -b: c + expect(@out.string).to eq <<~EOM + a: + b: c EOM end end diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb index 8aa18c3abc..9f0c191323 100644 --- a/spec/unit/knife/ssl_check_spec.rb +++ b/spec/unit/knife/ssl_check_spec.rb @@ -67,11 +67,11 @@ describe Chef::Knife::SslCheck do it "prints an error and exits" do expect { ssl_check.run }.to raise_error(SystemExit) - expected_stdout = <<-E -USAGE: knife ssl check [URL] (options) + expected_stdout = <<~E + USAGE: knife ssl check [URL] (options) E - expected_stderr = <<-E -ERROR: Given URI: `foo.test' is invalid + expected_stderr = <<~E + ERROR: Given URI: `foo.test' is invalid E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) @@ -83,11 +83,11 @@ E it "prints an error and exits" do expect { ssl_check.run }.to raise_error(SystemExit) - expected_stdout = <<-E -USAGE: knife ssl check [URL] (options) + expected_stdout = <<~E + USAGE: knife ssl check [URL] (options) E - expected_stderr = <<-E -ERROR: Given URI: `#{name_args[0]}' is invalid + expected_stderr = <<~E + ERROR: Given URI: `#{name_args[0]}' is invalid E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) diff --git a/spec/unit/knife/ssl_fetch_spec.rb b/spec/unit/knife/ssl_fetch_spec.rb index bc49c40241..45dd27ceec 100644 --- a/spec/unit/knife/ssl_fetch_spec.rb +++ b/spec/unit/knife/ssl_fetch_spec.rb @@ -68,11 +68,11 @@ describe Chef::Knife::SslFetch do it "prints an error and exits" do expect { ssl_fetch.run }.to raise_error(SystemExit) - expected_stdout = <<-E -USAGE: knife ssl fetch [URL] (options) + expected_stdout = <<~E + USAGE: knife ssl fetch [URL] (options) E - expected_stderr = <<-E -ERROR: Given URI: `foo.test' is invalid + expected_stderr = <<~E + ERROR: Given URI: `foo.test' is invalid E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) @@ -84,11 +84,11 @@ E it "prints an error and exits" do expect { ssl_fetch.run }.to raise_error(SystemExit) - expected_stdout = <<-E -USAGE: knife ssl fetch [URL] (options) + expected_stdout = <<~E + USAGE: knife ssl fetch [URL] (options) E - expected_stderr = <<-E -ERROR: Given URI: `#{name_args[0]}' is invalid + expected_stderr = <<~E + ERROR: Given URI: `#{name_args[0]}' is invalid E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) @@ -187,9 +187,9 @@ E end it "tells the user their URL is for a non-ssl service" do - expected_error_text = <<-ERROR_TEXT -ERROR: The service at the given URI (http://foo.example.com) does not accept SSL connections -ERROR: Perhaps you meant to connect to 'https://foo.example.com'? + expected_error_text = <<~ERROR_TEXT + ERROR: The service at the given URI (http://foo.example.com) does not accept SSL connections + ERROR: Perhaps you meant to connect to 'https://foo.example.com'? ERROR_TEXT run diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index 86fe59ca58..443e21659e 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -571,11 +571,11 @@ describe Chef::Knife do knife.run_with_pretty_exceptions - expected_message = <<-MSG -ERROR: Could not establish a secure connection to the server. -Use `knife ssl check` to troubleshoot your SSL configuration. -If your Chef Server uses a self-signed certificate, you can use -`knife ssl fetch` to make knife trust the server's certificates. + expected_message = <<~MSG + ERROR: Could not establish a secure connection to the server. + Use `knife ssl check` to troubleshoot your SSL configuration. + If your Chef Server uses a self-signed certificate, you can use + `knife ssl fetch` to make knife trust the server's certificates. MSG expect(stderr.string).to include(expected_message) end diff --git a/spec/unit/provider/apt_repository_spec.rb b/spec/unit/provider/apt_repository_spec.rb index 54f1f2df66..8ea2b9b823 100644 --- a/spec/unit/provider/apt_repository_spec.rb +++ b/spec/unit/provider/apt_repository_spec.rb @@ -23,25 +23,25 @@ require "spec_helper" # # Output of the command: # => apt-key adv --list-public-keys --with-fingerprint --with-colons -APT_KEY_FINGER = <<-EOF -tru:t:1:1488924856:0:3:1:5 -pub:-:1024:17:40976EAF437D05B5:2004-09-12:::-:Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>::scESC: -fpr:::::::::630239CC130E1A7FD81A27B140976EAF437D05B5: -sub:-:2048:16:251BEFF479164387:2004-09-12::::::e: -pub:-:1024:17:46181433FBB75451:2004-12-30:::-:Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>::scSC: -fpr:::::::::C5986B4F1257FFA86632CBA746181433FBB75451: -pub:-:4096:1:3B4FE6ACC0B21F32:2012-05-11:::-:Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>::scSC: -fpr:::::::::790BC7277767219C42C86F933B4FE6ACC0B21F32: -pub:-:4096:1:D94AA3F0EFE21092:2012-05-11:::-:Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>::scSC: -fpr:::::::::843938DF228D22F7B3742BC0D94AA3F0EFE21092: +APT_KEY_FINGER = <<~EOF + tru:t:1:1488924856:0:3:1:5 + pub:-:1024:17:40976EAF437D05B5:2004-09-12:::-:Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>::scESC: + fpr:::::::::630239CC130E1A7FD81A27B140976EAF437D05B5: + sub:-:2048:16:251BEFF479164387:2004-09-12::::::e: + pub:-:1024:17:46181433FBB75451:2004-12-30:::-:Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>::scSC: + fpr:::::::::C5986B4F1257FFA86632CBA746181433FBB75451: + pub:-:4096:1:3B4FE6ACC0B21F32:2012-05-11:::-:Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>::scSC: + fpr:::::::::790BC7277767219C42C86F933B4FE6ACC0B21F32: + pub:-:4096:1:D94AA3F0EFE21092:2012-05-11:::-:Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>::scSC: + fpr:::::::::843938DF228D22F7B3742BC0D94AA3F0EFE21092: EOF # Output of the command: # => gpg --with-fingerprint --with-colons [FILE] -GPG_FINGER = <<-EOF -pub:-:1024:17:327574EE02A818DD:2009-04-22:::-:Cloudera Apt Repository: -fpr:::::::::F36A89E33CC1BD0F71079007327574EE02A818DD: -sub:-:2048:16:84080586D1CA74A1:2009-04-22:::: +GPG_FINGER = <<~EOF + pub:-:1024:17:327574EE02A818DD:2009-04-22:::-:Cloudera Apt Repository: + fpr:::::::::F36A89E33CC1BD0F71079007327574EE02A818DD: + sub:-:2048:16:84080586D1CA74A1:2009-04-22:::: EOF describe Chef::Provider::AptRepository do diff --git a/spec/unit/provider/cron/unix_spec.rb b/spec/unit/provider/cron/unix_spec.rb index 843f3f3d8c..6c4caa4656 100644 --- a/spec/unit/provider/cron/unix_spec.rb +++ b/spec/unit/provider/cron/unix_spec.rb @@ -53,13 +53,13 @@ describe Chef::Provider::Cron::Unix do describe "read_crontab" do let(:stderr) { "" } let(:stdout) do - String.new(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + String.new(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB end diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb index 5673ecc317..50ebff779d 100644 --- a/spec/unit/provider/cron_spec.rb +++ b/spec/unit/provider/cron_spec.rb @@ -42,15 +42,15 @@ describe Chef::Provider::Cron do context "with a matching entry in the user's crontab" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -@reboot /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + @reboot /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end @@ -67,19 +67,19 @@ CRONTAB end it "should pull env vars out" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -SHELL=/bin/foosh -PATH=/bin:/foo -HOME=/home/foo -@reboot /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + SHELL=/bin/foosh + PATH=/bin:/foo + HOME=/home/foo + @reboot /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("foo@example.com") @@ -91,12 +91,12 @@ CRONTAB end it "should parse and load generic and standard environment variables from cron entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MAILTO=warn@example.com -TEST=lol -FLAG=1 -@reboot /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MAILTO=warn@example.com + TEST=lol + FLAG=1 + @reboot /bin/true CRONTAB cron = @provider.load_current_resource @@ -105,13 +105,13 @@ CRONTAB end it "should not break with variables that match the cron resource internals" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MINUTE=40 -REBOOT=midnight -TEST=lol -ENVIRONMENT=production -@reboot /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MINUTE=40 + REBOOT=midnight + TEST=lol + ENVIRONMENT=production + @reboot /bin/true CRONTAB cron = @provider.load_current_resource @@ -137,9 +137,9 @@ CRONTAB end it "should create a crontab with the entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -# Chef Name: cronhole some stuff -@reboot /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + # Chef Name: cronhole some stuff + @reboot /bin/true ENDCRON @provider.run_action(:create) end @@ -168,13 +168,13 @@ CRONTAB context "with no matching entry in the user's crontab" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB end @@ -190,9 +190,9 @@ CRONTAB end it "should not fail if there's an existing cron with a numerical argument" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: foo[bar] (baz) -21 */4 * * * some_prog 1234567 + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: foo[bar] (baz) + 21 */4 * * * some_prog 1234567 CRONTAB expect do @provider.load_current_resource @@ -202,15 +202,15 @@ CRONTAB context "with a matching entry in the user's crontab" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -* 5 * 1 * /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + * 5 * 1 * /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end @@ -232,19 +232,19 @@ CRONTAB end it "should pull env vars out" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -SHELL=/bin/foosh -PATH=/bin:/foo -HOME=/home/foo -* 5 * 1 * /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + SHELL=/bin/foosh + PATH=/bin:/foo + HOME=/home/foo + * 5 * 1 * /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("foo@example.com") @@ -261,12 +261,12 @@ CRONTAB end it "should parse and load generic and standard environment variables from cron entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MAILTO=warn@example.com -TEST=lol -FLAG=1 -* 5 * * * /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MAILTO=warn@example.com + TEST=lol + FLAG=1 + * 5 * * * /bin/true CRONTAB cron = @provider.load_current_resource @@ -275,13 +275,13 @@ CRONTAB end it "should not break with variabels that match the cron resource internals" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -# Chef Name: cronhole some stuff -MINUTE=40 -HOUR=midnight -TEST=lol -ENVIRONMENT=production -* 5 * * * /bin/true + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + # Chef Name: cronhole some stuff + MINUTE=40 + HOUR=midnight + TEST=lol + ENVIRONMENT=production + * 5 * * * /bin/true CRONTAB cron = @provider.load_current_resource @@ -298,15 +298,15 @@ CRONTAB context "with a matching entry in the user's crontab using month names and weekday names (#CHEF-3178)" do before :each do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -* 5 * Jan Mon /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + * 5 * Jan Mon /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end @@ -334,10 +334,10 @@ CRONTAB context "with a matching entry without a crontab line" do it "should set cron_exists and leave current_resource values at defaults" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) @@ -351,11 +351,11 @@ CRONTAB end it "should not pick up a commented out crontab line" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#* 5 * 1 * /bin/true param1 param2 + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #* 5 * 1 * /bin/true param1 param2 CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) @@ -369,15 +369,15 @@ CRONTAB end it "should not pick up a later crontab entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#* 5 * 1 * /bin/true param1 param2 -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #* 5 * 1 * /bin/true param1 param2 + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) @@ -442,9 +442,9 @@ CRONTAB end it "should create a crontab with the entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -# Chef Name: cronhole some stuff -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + # Chef Name: cronhole some stuff + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -455,14 +455,14 @@ CRONTAB @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" @new_resource.environment "TEST" => "LOL" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -TEST=LOL -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + TEST=LOL + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -481,26 +481,26 @@ TEST=LOL context "when there is a crontab with no matching section" do before :each do @provider.cron_exists = false - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end it "should add the entry to the crontab" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment -# Chef Name: cronhole some stuff -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment + # Chef Name: cronhole some stuff + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -511,20 +511,20 @@ TEST=LOL @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" @new_resource.environment "TEST" => "LOL" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -TEST=LOL -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + TEST=LOL + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end @@ -544,28 +544,28 @@ TEST=LOL before :each do @provider.cron_exists = true allow(@provider).to receive(:cron_different?).and_return(true) - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end it "should update the crontab entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end @@ -576,20 +576,20 @@ TEST=LOL @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" @new_resource.environment "TEST" => "LOL" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -TEST=LOL -30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + TEST=LOL + 30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end @@ -612,78 +612,78 @@ TEST=LOL end it "should add the crontab to the entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * * * /bin/true + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * * * /bin/true ENDCRON @provider.run_action(:create) end it "should not blat any following entries" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * * * /bin/true -#30 * * * * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * * * /bin/true + #30 * * * * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end it "should handle env vars with no crontab" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=bar@example.com -PATH=/usr/bin:/my/custom/path -SHELL=/bin/barsh -HOME=/home/foo - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=bar@example.com + PATH=/usr/bin:/my/custom/path + SHELL=/bin/barsh + HOME=/home/foo + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB @new_resource.mailto "foo@example.com" @new_resource.path "/usr/bin:/my/custom/path" @new_resource.shell "/bin/foosh" @new_resource.home "/home/foo" - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO="foo@example.com" -PATH="/usr/bin:/my/custom/path" -SHELL="/bin/foosh" -HOME="/home/foo" -30 * * * * /bin/true - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO="foo@example.com" + PATH="/usr/bin:/my/custom/path" + SHELL="/bin/foosh" + HOME="/home/foo" + 30 * * * * /bin/true + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:create) end @@ -693,13 +693,13 @@ HOME="/home/foo" before :each do @provider.cron_exists = true allow(@provider).to receive(:cron_different?).and_return(false) - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -* 5 * * * /bin/true - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + * 5 * * * /bin/true + + # Another comment CRONTAB end @@ -747,50 +747,50 @@ CRONTAB context "when the user has a crontab with a matching section" do before :each do @provider.cron_exists = true - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + 30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB end it "should remove the entry" do - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end it "should remove any env vars with the entry" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -FOO=test -30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + FOO=test + 30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end @@ -812,61 +812,61 @@ FOO=test end it "should remove the section" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + ENDCRON @provider.run_action(:delete) end it "should not blat following sections" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end it "should remove any envvars with the section" do - allow(@provider).to receive(:read_crontab).and_return(<<-CRONTAB) -0 2 * * * /some/other/command - -# Chef Name: cronhole some stuff -MAILTO=foo@example.com -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) + 0 2 * * * /some/other/command + + # Chef Name: cronhole some stuff + MAILTO=foo@example.com + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment CRONTAB - expect(@provider).to receive(:write_crontab).with(<<-ENDCRON) -0 2 * * * /some/other/command - -#30 * * 3 * /bin/true -# Chef Name: something else -2 * 1 * * /bin/false - -# Another comment + expect(@provider).to receive(:write_crontab).with(<<~ENDCRON) + 0 2 * * * /some/other/command + + #30 * * 3 * /bin/true + # Chef Name: something else + 2 * 1 * * /bin/false + + # Another comment ENDCRON @provider.run_action(:delete) end @@ -875,13 +875,13 @@ MAILTO=foo@example.com describe "read_crontab" do before :each do - @stdout = <<-CRONTAB -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + @stdout = <<~CRONTAB + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -894,13 +894,13 @@ MAILTO=foo@example.com it "should return the contents of the crontab" do crontab = @provider.send(:read_crontab) - expect(crontab).to eq <<-CRONTAB -0 2 * * * /some/other/command - -# Chef Name: something else -* 5 * * * /bin/true - -# Another comment + expect(crontab).to eq <<~CRONTAB + 0 2 * * * /some/other/command + + # Chef Name: something else + * 5 * * * /bin/true + + # Another comment CRONTAB end diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index fafb83f548..b1b556db1c 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -244,21 +244,21 @@ describe Chef::Provider::Git do end it "gives the latest HEAD revision SHA if nothing is specified" do - @stdout = <<-SHAS -28af684d8460ba4793eda3e7ac238c864a5d029a\tHEAD -503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha -28af684d8460ba4793eda3e7ac238c864a5d029a\trefs/heads/master -c44fe79bb5e36941ce799cee6b9de3a2ef89afee\trefs/tags/0.5.2 -14534f0e0bf133dc9ff6dbe74f8a0c863ff3ac6d\trefs/tags/0.5.4 -d36fddb4291341a1ff2ecc3c560494e398881354\trefs/tags/0.5.6 -9e5ce9031cbee81015de680d010b603bce2dd15f\trefs/tags/0.6.0 -9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13\trefs/tags/0.6.2 -014a69af1cdce619de82afaf6cdb4e6ac658fede\trefs/tags/0.7.0 -fa8097ff666af3ce64761d8e1f1c2aa292a11378\trefs/tags/0.7.2 -44f9be0b33ba5c10027ddb030a5b2f0faa3eeb8d\trefs/tags/0.7.4 -d7b9957f67236fa54e660cc3ab45ffecd6e0ba38\trefs/tags/0.7.8 -b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{} -ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package + @stdout = <<~SHAS + 28af684d8460ba4793eda3e7ac238c864a5d029a\tHEAD + 503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha + 28af684d8460ba4793eda3e7ac238c864a5d029a\trefs/heads/master + c44fe79bb5e36941ce799cee6b9de3a2ef89afee\trefs/tags/0.5.2 + 14534f0e0bf133dc9ff6dbe74f8a0c863ff3ac6d\trefs/tags/0.5.4 + d36fddb4291341a1ff2ecc3c560494e398881354\trefs/tags/0.5.6 + 9e5ce9031cbee81015de680d010b603bce2dd15f\trefs/tags/0.6.0 + 9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13\trefs/tags/0.6.2 + 014a69af1cdce619de82afaf6cdb4e6ac658fede\trefs/tags/0.7.0 + fa8097ff666af3ce64761d8e1f1c2aa292a11378\trefs/tags/0.7.2 + 44f9be0b33ba5c10027ddb030a5b2f0faa3eeb8d\trefs/tags/0.7.4 + d7b9957f67236fa54e660cc3ab45ffecd6e0ba38\trefs/tags/0.7.8 + b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{} + ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package SHAS @resource.revision "" expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"HEAD\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout)) diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index b6748fd5f8..4d18a8c2b0 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -309,19 +309,19 @@ describe "Test DSCL loading" do @new_resource = Chef::Resource::Group.new("group name aj") @new_resource.group_name("aj") @provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context) - @output = <<-EOF -AppleMetaNodeLocation: /Local/Default -Comment: - Test Group -GeneratedUID: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA -NestedGroups: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAB -Password: * -PrimaryGroupID: 999 -RealName: - TestGroup -RecordName: com.apple.aj -RecordType: dsRecTypeStandard:Groups -GroupMembership: waka bar + @output = <<~EOF + AppleMetaNodeLocation: /Local/Default + Comment: + Test Group + GeneratedUID: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA + NestedGroups: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAB + Password: * + PrimaryGroupID: 999 + RealName: + TestGroup + RecordName: com.apple.aj + RecordType: dsRecTypeStandard:Groups + GroupMembership: waka bar EOF allow(@provider).to receive(:safe_dscl).with(*"read /Groups/aj".split(" ")).and_return(@output) @current_resource = @provider.load_current_resource diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb index 3eb4228c51..654b08b2c9 100644 --- a/spec/unit/provider/ifconfig/aix_spec.rb +++ b/spec/unit/provider/ifconfig/aix_spec.rb @@ -22,16 +22,16 @@ require "chef/exceptions" describe Chef::Provider::Ifconfig::Aix do before(:all) do - @ifconfig_output = <<-IFCONFIG -en1: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> - inet 10.153.11.59 netmask 0xffff0000 broadcast 10.153.255.255 - tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 -en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> metric 1 - inet 172.29.174.58 netmask 0xffffc000 broadcast 172.29.191.255 - tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 -lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN> - inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255 - inet6 ::1%1/0 + @ifconfig_output = <<~IFCONFIG + en1: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> + inet 10.153.11.59 netmask 0xffff0000 broadcast 10.153.255.255 + tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 + en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> metric 1 + inet 172.29.174.58 netmask 0xffffc000 broadcast 172.29.191.255 + tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1 + lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN> + inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255 + inet6 ::1%1/0 IFCONFIG end diff --git a/spec/unit/provider/ifconfig/debian_spec.rb b/spec/unit/provider/ifconfig/debian_spec.rb index 9a90dc1e0a..93b0008e8b 100644 --- a/spec/unit/provider/ifconfig/debian_spec.rb +++ b/spec/unit/provider/ifconfig/debian_spec.rb @@ -119,10 +119,10 @@ describe Chef::Provider::Ifconfig::Debian do context "when the /etc/network/interfaces file has the source line" do let(:expected_string) do - <<-EOF -a line -source #{tempdir_path}/* -another line + <<~EOF + a line + source #{tempdir_path}/* + another line EOF end @@ -142,10 +142,10 @@ EOF context "when the /etc/network/interfaces file does not have the source line" do let(:expected_string) do - <<-EOF -a line -another line -source #{tempdir_path}/* + <<~EOF + a line + another line + source #{tempdir_path}/* EOF end @@ -246,10 +246,10 @@ EOF context "when the /etc/network/interfaces file has the source line" do let(:expected_string) do - <<-EOF -a line -source #{tempdir_path}/* -another line + <<~EOF + a line + source #{tempdir_path}/* + another line EOF end @@ -267,10 +267,10 @@ another line context "when the /etc/network/interfaces file does not have the source line" do let(:expected_string) do - <<-EOF -a line -another line -source #{tempdir_path}/* + <<~EOF + a line + another line + source #{tempdir_path}/* EOF end diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb index 748b4d897e..0b8db90428 100644 --- a/spec/unit/provider/ifconfig_spec.rb +++ b/spec/unit/provider/ifconfig_spec.rb @@ -41,9 +41,9 @@ describe Chef::Provider::Ifconfig do end describe Chef::Provider::Ifconfig, "load_current_resource" do - let(:net_tools_version) { StringIO.new <<-EOS } -net-tools 1.60 -ifconfig 1.42 (2001-04-13) + let(:net_tools_version) { StringIO.new <<~EOS } + net-tools 1.60 + ifconfig 1.42 (2001-04-13) EOS before do diff --git a/spec/unit/provider/launchd_spec.rb b/spec/unit/provider/launchd_spec.rb index 693801f99b..97883fc04c 100644 --- a/spec/unit/provider/launchd_spec.rb +++ b/spec/unit/provider/launchd_spec.rb @@ -29,55 +29,55 @@ describe Chef::Provider::Launchd do let(:label) { "call.mom.weekly" } let(:new_resource) { Chef::Resource::Launchd.new(label) } let!(:current_resource) { Chef::Resource::Launchd.new(label) } - let(:test_plist) { String.new <<-XML } -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> -\t<key>Label</key> -\t<string>call.mom.weekly</string> -\t<key>Program</key> -\t<string>/Library/scripts/call_mom.sh</string> -\t<key>StartCalendarInterval</key> -\t<dict> -\t\t<key>Hour</key> -\t\t<integer>10</integer> -\t\t<key>Weekday</key> -\t\t<integer>7</integer> -\t</dict> -\t<key>TimeOut</key> -\t<integer>300</integer> -</dict> -</plist> + let(:test_plist) { String.new <<~XML } + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + \t<key>Label</key> + \t<string>call.mom.weekly</string> + \t<key>Program</key> + \t<string>/Library/scripts/call_mom.sh</string> + \t<key>StartCalendarInterval</key> + \t<dict> + \t\t<key>Hour</key> + \t\t<integer>10</integer> + \t\t<key>Weekday</key> + \t\t<integer>7</integer> + \t</dict> + \t<key>TimeOut</key> + \t<integer>300</integer> + </dict> + </plist> XML - let(:test_plist_multiple_intervals) { String.new <<-XML } -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> -\t<key>Label</key> -\t<string>call.mom.weekly</string> -\t<key>Program</key> -\t<string>/Library/scripts/call_mom.sh</string> -\t<key>StartCalendarInterval</key> -\t<array> -\t\t<dict> -\t\t\t<key>Hour</key> -\t\t\t<integer>11</integer> -\t\t\t<key>Weekday</key> -\t\t\t<integer>1</integer> -\t\t</dict> -\t\t<dict> -\t\t\t<key>Hour</key> -\t\t\t<integer>12</integer> -\t\t\t<key>Weekday</key> -\t\t\t<integer>2</integer> -\t\t</dict> -\t</array> -\t<key>TimeOut</key> -\t<integer>300</integer> -</dict> -</plist> + let(:test_plist_multiple_intervals) { String.new <<~XML } + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + \t<key>Label</key> + \t<string>call.mom.weekly</string> + \t<key>Program</key> + \t<string>/Library/scripts/call_mom.sh</string> + \t<key>StartCalendarInterval</key> + \t<array> + \t\t<dict> + \t\t\t<key>Hour</key> + \t\t\t<integer>11</integer> + \t\t\t<key>Weekday</key> + \t\t\t<integer>1</integer> + \t\t</dict> + \t\t<dict> + \t\t\t<key>Hour</key> + \t\t\t<integer>12</integer> + \t\t\t<key>Weekday</key> + \t\t\t<integer>2</integer> + \t\t</dict> + \t</array> + \t<key>TimeOut</key> + \t<integer>300</integer> + </dict> + </plist> XML let(:test_hash) do diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb index d807409d05..409bd46ecc 100644 --- a/spec/unit/provider/mount/aix_spec.rb +++ b/spec/unit/provider/mount/aix_spec.rb @@ -22,32 +22,32 @@ require "ostruct" describe Chef::Provider::Mount::Aix do before(:all) do - @mounted_output = <<-MOUNT - node mounted mounted over vfs date options --------- --------------- --------------- ------ ------------ --------------- - /dev/sdz1 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 + @mounted_output = <<~MOUNT + node mounted mounted over vfs date options + -------- --------------- --------------- ------ ------------ --------------- + /dev/sdz1 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 MOUNT - @unmounted_output = <<-UNMOUNTED - node mounted mounted over vfs date options --------- --------------- --------------- ------ ------------ --------------- - /dev/sdz2 / jfs2 Jul 17 13:22 rw,log=/dev/hd8 + @unmounted_output = <<~UNMOUNTED + node mounted mounted over vfs date options + -------- --------------- --------------- ------ ------------ --------------- + /dev/sdz2 / jfs2 Jul 17 13:22 rw,log=/dev/hd8 UNMOUNTED - @conflict_mounted_output = <<-MOUNT - node mounted mounted over vfs date options --------- --------------- --------------- ------ ------------ --------------- - /dev/sdz3 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 + @conflict_mounted_output = <<~MOUNT + node mounted mounted over vfs date options + -------- --------------- --------------- ------ ------------ --------------- + /dev/sdz3 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 MOUNT - @enabled_output = <<-ENABLED -#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct -/tmp/foo:/dev/sdz1:jfs2::bootfs:10485760:rw:yes:no + @enabled_output = <<~ENABLED + #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct + /tmp/foo:/dev/sdz1:jfs2::bootfs:10485760:rw:yes:no ENABLED - @test_wrong_output = <<-WRONG -#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct -/tmp/foo::/dev/sdz1:jfs2:bootfs:10485760:rw:yes:no + @test_wrong_output = <<~WRONG + #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct + /tmp/foo::/dev/sdz1:jfs2:bootfs:10485760:rw:yes:no WRONG end @@ -232,22 +232,22 @@ WRONG it "should disable mount if it is mounted and enabled" do stub_mounted_enabled(@provider, @mounted_output, @enabled_output) - allow(::File).to receive(:open).with("/etc/filesystems", "r").and_return(<<-ETCFILESYSTEMS) -/tmp/foo: - dev = /dev/sdz1 - vfs = jfs2 - log = /dev/hd8 - mount = true - check = true - vol = /opt - free = false - quota = no - -/tmp/abc: - dev = /dev/sdz2 - vfs = jfs2 - mount = true - options = rw + allow(::File).to receive(:open).with("/etc/filesystems", "r").and_return(<<~ETCFILESYSTEMS) + /tmp/foo: + dev = /dev/sdz1 + vfs = jfs2 + log = /dev/hd8 + mount = true + check = true + vol = /opt + free = false + quota = no + + /tmp/abc: + dev = /dev/sdz2 + vfs = jfs2 + mount = true + options = rw ETCFILESYSTEMS filesystems = StringIO.new diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index 1047534f98..97eda1d774 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -34,13 +34,13 @@ describe Chef::Provider::Package::Apt do @status = double("Status", exitstatus: 0) @provider = Chef::Provider::Package::Apt.new(@new_resource, @run_context) @stdin = StringIO.new - @stdout = <<-PKG_STATUS -irssi: - Installed: (none) - Candidate: 0.8.14-1ubuntu4 - Version table: - 0.8.14-1ubuntu4 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + @stdout = <<~PKG_STATUS + irssi: + Installed: (none) + Candidate: 0.8.14-1ubuntu4 + Version table: + 0.8.14-1ubuntu4 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages PKG_STATUS @stderr = "" @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0) @@ -65,17 +65,17 @@ irssi: end it "should set the installed version if package has one" do - @stdout.replace(<<-INSTALLED) -sudo: - Installed: 1.7.2p1-1ubuntu5.3 - Candidate: 1.7.2p1-1ubuntu5.3 - Version table: - *** 1.7.2p1-1ubuntu5.3 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages - 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages - 100 /var/lib/dpkg/status - 1.7.2p1-1ubuntu5 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + @stdout.replace(<<~INSTALLED) + sudo: + Installed: 1.7.2p1-1ubuntu5.3 + Candidate: 1.7.2p1-1ubuntu5.3 + Version table: + *** 1.7.2p1-1ubuntu5.3 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages + 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages + 100 /var/lib/dpkg/status + 1.7.2p1-1ubuntu5 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages INSTALLED expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource @@ -86,8 +86,8 @@ sudo: # it is the superclasses responsibility to throw most exceptions it "if the package does not exist in the cache sets installed + candidate version to nil" do @new_resource.package_name("conic-smarms") - policy_out = <<-POLICY_STDOUT -N: Unable to locate package conic-smarms + policy_out = <<~POLICY_STDOUT + N: Unable to locate package conic-smarms POLICY_STDOUT policy = double(stdout: policy_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -95,8 +95,8 @@ N: Unable to locate package conic-smarms env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(policy) - showpkg_out = <<-SHOWPKG_STDOUT -N: Unable to locate package conic-smarms + showpkg_out = <<~SHOWPKG_STDOUT + N: Unable to locate package conic-smarms SHOWPKG_STDOUT showpkg = double(stdout: showpkg_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -111,11 +111,11 @@ N: Unable to locate package conic-smarms # list of virtual packages: http://www.debian.org/doc/packaging-manuals/virtual-package-names-list.txt it "should not install the virtual package there is a single provider package and it is installed" do @new_resource.package_name("libmysqlclient15-dev") - virtual_package_out = <<-VPKG_STDOUT -libmysqlclient15-dev: - Installed: (none) - Candidate: (none) - Version table: + virtual_package_out = <<~VPKG_STDOUT + libmysqlclient15-dev: + Installed: (none) + Candidate: (none) + Version table: VPKG_STDOUT virtual_package = double(stdout: virtual_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -123,23 +123,23 @@ libmysqlclient15-dev: env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(virtual_package) - showpkg_out = <<-SHOWPKG_STDOUT -Package: libmysqlclient15-dev -Versions: - -Reverse Depends: - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev - libmysqlclient-dev,libmysqlclient15-dev -Dependencies: -Provides: -Reverse Provides: -libmysqlclient-dev 5.1.41-3ubuntu12.7 -libmysqlclient-dev 5.1.41-3ubuntu12.10 -libmysqlclient-dev 5.1.41-3ubuntu12 + showpkg_out = <<~SHOWPKG_STDOUT + Package: libmysqlclient15-dev + Versions: + + Reverse Depends: + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + libmysqlclient-dev,libmysqlclient15-dev + Dependencies: + Provides: + Reverse Provides: + libmysqlclient-dev 5.1.41-3ubuntu12.7 + libmysqlclient-dev 5.1.41-3ubuntu12.10 + libmysqlclient-dev 5.1.41-3ubuntu12 SHOWPKG_STDOUT showpkg = double(stdout: showpkg_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -147,18 +147,18 @@ libmysqlclient-dev 5.1.41-3ubuntu12 env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(showpkg) - real_package_out = <<-RPKG_STDOUT -libmysqlclient-dev: - Installed: 5.1.41-3ubuntu12.10 - Candidate: 5.1.41-3ubuntu12.10 - Version table: - *** 5.1.41-3ubuntu12.10 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages - 100 /var/lib/dpkg/status - 5.1.41-3ubuntu12.7 0 - 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages - 5.1.41-3ubuntu12 0 - 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages + real_package_out = <<~RPKG_STDOUT + libmysqlclient-dev: + Installed: 5.1.41-3ubuntu12.10 + Candidate: 5.1.41-3ubuntu12.10 + Version table: + *** 5.1.41-3ubuntu12.10 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages + 100 /var/lib/dpkg/status + 5.1.41-3ubuntu12.7 0 + 500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages + 5.1.41-3ubuntu12 0 + 500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages RPKG_STDOUT real_package = double(stdout: real_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -171,11 +171,11 @@ libmysqlclient-dev: it "should raise an exception if you specify a virtual package with multiple provider packages" do @new_resource.package_name("mp3-decoder") - virtual_package_out = <<-VPKG_STDOUT -mp3-decoder: - Installed: (none) - Candidate: (none) - Version table: + virtual_package_out = <<~VPKG_STDOUT + mp3-decoder: + Installed: (none) + Candidate: (none) + Version table: VPKG_STDOUT virtual_package = double(stdout: virtual_package_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( @@ -183,26 +183,26 @@ mp3-decoder: env: { "DEBIAN_FRONTEND" => "noninteractive" }, timeout: @timeout ).and_return(virtual_package) - showpkg_out = <<-SHOWPKG_STDOUT -Package: mp3-decoder -Versions: - -Reverse Depends: - nautilus,mp3-decoder - vux,mp3-decoder - plait,mp3-decoder - ecasound,mp3-decoder - nautilus,mp3-decoder -Dependencies: -Provides: -Reverse Provides: -vlc-nox 1.0.6-1ubuntu1.8 -vlc 1.0.6-1ubuntu1.8 -vlc-nox 1.0.6-1ubuntu1 -vlc 1.0.6-1ubuntu1 -opencubicplayer 1:0.1.17-2 -mpg321 0.2.10.6 -mpg123 1.12.1-0ubuntu1 + showpkg_out = <<~SHOWPKG_STDOUT + Package: mp3-decoder + Versions: + + Reverse Depends: + nautilus,mp3-decoder + vux,mp3-decoder + plait,mp3-decoder + ecasound,mp3-decoder + nautilus,mp3-decoder + Dependencies: + Provides: + Reverse Provides: + vlc-nox 1.0.6-1ubuntu1.8 + vlc 1.0.6-1ubuntu1.8 + vlc-nox 1.0.6-1ubuntu1 + vlc 1.0.6-1ubuntu1 + opencubicplayer 1:0.1.17-2 + mpg321 0.2.10.6 + mpg123 1.12.1-0ubuntu1 SHOWPKG_STDOUT showpkg = double(stdout: showpkg_out, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted!).with( diff --git a/spec/unit/provider/package/cab_spec.rb b/spec/unit/provider/package/cab_spec.rb index 5c86f781f3..bdfcd06be3 100644 --- a/spec/unit/provider/package/cab_spec.rb +++ b/spec/unit/provider/package/cab_spec.rb @@ -31,20 +31,20 @@ describe Chef::Provider::Package::Cab do end let(:installed_package_list_stdout) do - <<-EOF -Packages listing: -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + <<~EOF + Packages listing: + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 EOF end let(:package_version_stdout) do - <<-EOF -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end @@ -57,20 +57,20 @@ The operation completed successfully end def allow_package_info(package_path = nil, package_name = nil) - get_package_info_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -Applicable : Yes -Copyright : Microsoft Corporation -Company : Microsoft Corporation -State : Installed -Dependency : Language Pack -The operation completed successfully + get_package_info_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + Applicable : Yes + Copyright : Microsoft Corporation + Company : Microsoft Corporation + State : Installed + Dependency : Language Pack + The operation completed successfully EOF get_package_info_obj = double(stdout: get_package_info_stdout) if package_path @@ -81,30 +81,30 @@ The operation completed successfully end def allow_get_packages - get_packages_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Packages listing: - -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Release Type : Feature Pack -Install Time : 11/21/2010 3:40 AM - -The operation completed successfully. + get_packages_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Packages listing: + + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Release Type : Feature Pack + Install Time : 11/21/2010 3:40 AM + + The operation completed successfully. EOF get_packages_obj = double(stdout: get_packages_stdout) allow(provider).to receive(:dism_command).with("/Get-Packages").and_return(get_packages_obj) @@ -248,14 +248,14 @@ The operation completed successfully. context "Invalid package source" do def package_version_stdout - package_version_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 -Image Version: 6.1.7600.16385 -An error occurred trying to open - c:\\temp\\test6.1-KB2664825-v3-x64.cab Error: 0x80070003 -Error: 3 -The system cannot find the path specified. -The DISM log file can be found at C:\\Windows\\Logs\\DISM\\dism.log. + package_version_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + Image Version: 6.1.7600.16385 + An error occurred trying to open - c:\\temp\\test6.1-KB2664825-v3-x64.cab Error: 0x80070003 + Error: 3 + The system cannot find the path specified. + The DISM log file can be found at C:\\Windows\\Logs\\DISM\\dism.log. EOF end diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb index 40fca821d9..48f8a562de 100644 --- a/spec/unit/provider/package/chocolatey_spec.rb +++ b/spec/unit/provider/package/chocolatey_spec.rb @@ -35,10 +35,10 @@ describe Chef::Provider::Package::Chocolatey do # installed packages (ConEmu is upgradable) let(:local_list_stdout) do - <<-EOF -Chocolatey v0.9.9.11 -chocolatey|0.9.9.11 -ConEmu|15.10.25.0 + <<~EOF + Chocolatey v0.9.9.11 + chocolatey|0.9.9.11 + ConEmu|15.10.25.0 EOF end @@ -50,13 +50,13 @@ ConEmu|15.10.25.0 end def allow_remote_list(package_names, args = nil) - remote_list_stdout = <<-EOF -Chocolatey v0.9.9.11 -chocolatey|0.9.9.11 -ConEmu|15.10.25.1 -Git|2.6.1 -Git|2.6.2 -munin-node|1.6.1.20130823 + remote_list_stdout = <<~EOF + Chocolatey v0.9.9.11 + chocolatey|0.9.9.11 + ConEmu|15.10.25.1 + Git|2.6.1 + Git|2.6.2 + munin-node|1.6.1.20130823 EOF remote_list_obj = double(stdout: remote_list_stdout) package_names.each do |pkg| diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index cf8f5097f0..9df19f0f1b 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -34,18 +34,18 @@ describe Chef::Provider::Package::Dpkg do let(:dpkg_deb_status) { status = double(stdout: "#{package}\t#{dpkg_deb_version}", exitstatus: 0) } let(:dpkg_s_version) { "1.11.4-1ubuntu1" } let(:dpkg_s_status) do - stdout = <<-DPKG_S -Package: #{package} -Status: install ok installed -Priority: important -Section: web -Installed-Size: 1944 -Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com> -Architecture: amd64 -Version: #{dpkg_s_version} -Config-Version: #{dpkg_s_version} -Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5) -Conflicts: wget-ssl + stdout = <<~DPKG_S + Package: #{package} + Status: install ok installed + Priority: important + Section: web + Installed-Size: 1944 + Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com> + Architecture: amd64 + Version: #{dpkg_s_version} + Config-Version: #{dpkg_s_version} + Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5) + Conflicts: wget-ssl DPKG_S status = double(stdout: stdout, exitstatus: 1) end @@ -172,10 +172,10 @@ Conflicts: wget-ssl it "on new debian/ubuntu we get an exit(1) and no stdout from dpkg -s for uninstalled" do dpkg_s_status = double( - exitstatus: 1, stdout: "", stderr: <<-EOF -dpkg-query: package '#{package}' is not installed and no information is available -Use dpkg --info (= dpkg-deb --info) to examine archive files, -and dpkg --contents (= dpkg-deb --contents) to list their contents. + exitstatus: 1, stdout: "", stderr: <<~EOF + dpkg-query: package '#{package}' is not installed and no information is available + Use dpkg --info (= dpkg-deb --info) to examine archive files, + and dpkg --contents (= dpkg-deb --contents) to list their contents. EOF ) expect(provider).to receive(:shell_out_compacted!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status) @@ -185,11 +185,11 @@ and dpkg --contents (= dpkg-deb --contents) to list their contents. it "on old debian/ubuntu we get an exit(0) and we get info on stdout from dpkg -s for uninstalled" do dpkg_s_status = double( - exitstatus: 0, stderr: "", stdout: <<-EOF -Package: #{package} -Status: unknown ok not-installed -Priority: extra -Section: ruby + exitstatus: 0, stderr: "", stdout: <<~EOF + Package: #{package} + Status: unknown ok not-installed + Priority: extra + Section: ruby EOF ) expect(provider).to receive(:shell_out_compacted!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status) diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb index 46f0c72399..b5fb05f7ec 100644 --- a/spec/unit/provider/package/ips_spec.rb +++ b/spec/unit/provider/package/ips_spec.rb @@ -35,27 +35,27 @@ describe Chef::Provider::Package::Ips do def local_output stdin = StringIO.new stdout = "" - stderr = <<-PKG_STATUS -pkg: info: no packages matching the following patterns you specified are -installed on the system. Try specifying -r to query remotely: - - crypto/gnupg + stderr = <<~PKG_STATUS + pkg: info: no packages matching the following patterns you specified are + installed on the system. Try specifying -r to query remotely: + + crypto/gnupg PKG_STATUS OpenStruct.new(stdout: stdout, stdin: stdin, stderr: stderr, status: @status, exitstatus: 1) end def remote_output - stdout = <<-PKG_STATUS - Name: security/sudo - Summary: sudo - authority delegation tool - State: Not Installed - Publisher: omnios - Version: 1.8.4.1 (1.8.4p1) - Build Release: 5.11 - Branch: 0.151002 -Packaging Date: April 1, 2012 05:55:52 PM - Size: 2.57 MB - FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z + stdout = <<~PKG_STATUS + Name: security/sudo + Summary: sudo - authority delegation tool + State: Not Installed + Publisher: omnios + Version: 1.8.4.1 (1.8.4p1) + Build Release: 5.11 + Branch: 0.151002 + Packaging Date: April 1, 2012 05:55:52 PM + Size: 2.57 MB + FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z PKG_STATUS stdin = StringIO.new stderr = "" @@ -92,20 +92,20 @@ PKG_STATUS it "should set the installed version if package has one" do local = local_output - local.stdout = <<-INSTALLED - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Installed - Publisher: solaris - Version: 2.0.17 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z + local.stdout = <<~INSTALLED + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Installed + Publisher: solaris + Version: 2.0.17 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z INSTALLED expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote_output) @@ -140,17 +140,17 @@ INSTALLED it "should not include the human-readable version in the candidate_version" do remote = remote_output - remote.stdout = <<-PKG_STATUS - Name: security/sudo - Summary: sudo - authority delegation tool - State: Not Installed - Publisher: omnios - Version: 1.8.4.1 (1.8.4p1) - Build Release: 5.11 - Branch: 0.151002 -Packaging Date: April 1, 2012 05:55:52 PM - Size: 2.57 MB - FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z + remote.stdout = <<~PKG_STATUS + Name: security/sudo + Summary: sudo - authority delegation tool + State: Not Installed + Publisher: omnios + Version: 1.8.4.1 (1.8.4p1) + Build Release: 5.11 + Branch: 0.151002 + Packaging Date: April 1, 2012 05:55:52 PM + Size: 2.57 MB + FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z PKG_STATUS expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local_output) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote) @@ -161,36 +161,36 @@ PKG_STATUS it "should not upgrade the package if it is already installed" do local = local_output - local.stdout = <<-INSTALLED - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Installed - Publisher: solaris - Version: 2.0.17 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z + local.stdout = <<~INSTALLED + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Installed + Publisher: solaris + Version: 2.0.17 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z INSTALLED remote = remote_output - remote.stdout = <<-REMOTE - Name: crypto/gnupg - Summary: GNU Privacy Guard - Description: A complete and free implementation of the OpenPGP Standard as - defined by RFC4880. - Category: Applications/System Utilities - State: Not Installed - Publisher: solaris - Version: 2.0.18 - Build Release: 5.11 - Branch: 0.175.0.0.0.2.537 -Packaging Date: October 19, 2011 09:14:50 AM - Size: 8.07 MB - FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z + remote.stdout = <<~REMOTE + Name: crypto/gnupg + Summary: GNU Privacy Guard + Description: A complete and free implementation of the OpenPGP Standard as + defined by RFC4880. + Category: Applications/System Utilities + State: Not Installed + Publisher: solaris + Version: 2.0.18 + Build Release: 5.11 + Branch: 0.175.0.0.0.2.537 + Packaging Date: October 19, 2011 09:14:50 AM + Size: 8.07 MB + FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z REMOTE expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb index 54c5340d72..8b75e40d72 100644 --- a/spec/unit/provider/package/macports_spec.rb +++ b/spec/unit/provider/package/macports_spec.rb @@ -70,9 +70,9 @@ describe Chef::Provider::Package::Macports do describe "current_installed_version" do it "should return the current version if the package is installed" do - stdout = <<EOF -The following ports are currently installed: - openssl @0.9.8k_0 (active) + stdout = <<~EOF + The following ports are currently installed: + openssl @0.9.8k_0 (active) EOF status = double(stdout: stdout, exitstatus: 0) diff --git a/spec/unit/provider/package/msu_spec.rb b/spec/unit/provider/package/msu_spec.rb index de805fcb39..49b723e572 100644 --- a/spec/unit/provider/package/msu_spec.rb +++ b/spec/unit/provider/package/msu_spec.rb @@ -31,66 +31,66 @@ describe Chef::Provider::Package::Msu, :windows_only do end let(:installed_package_list_stdout) do - <<-EOF -Packages listing: -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + <<~EOF + Packages listing: + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 EOF end let(:package_version_stdout) do - <<-EOF -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end let(:get_package_info_stdout) do - <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Package information: -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -Applicable : Yes -Copyright : Microsoft Corporation -Company : Microsoft Corporation -State : Installed -Dependency : Language Pack -The operation completed successfully + <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Package information: + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + Applicable : Yes + Copyright : Microsoft Corporation + Company : Microsoft Corporation + State : Installed + Dependency : Language Pack + The operation completed successfully EOF end def allow_get_packages - get_packages_stdout = <<-EOF -Deployment Image Servicing and Management tool -Version: 6.1.7600.16385 - -Image Version: 6.1.7600.16385 - -Packages listing: - -Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 -State : Installed -Release Type : Language Pack -Install Time : 2/11/2015 11:33 PM - -Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 -State : Installed -Release Type : Feature Pack -Install Time : 11/21/2010 3:40 AM - -The operation completed successfully. + get_packages_stdout = <<~EOF + Deployment Image Servicing and Management tool + Version: 6.1.7600.16385 + + Image Version: 6.1.7600.16385 + + Packages listing: + + Package Identity : Package_for_KB2999486~31bf3856ad364e35~amd64~~6.1.9768.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2994825~31bf3856ad364e35~amd64~~6.1.7601.0 + State : Installed + Release Type : Language Pack + Install Time : 2/11/2015 11:33 PM + + Package Identity : Package_for_KB2664825~31bf3856ad364e35~amd64~~6.1.3.0 + State : Installed + Release Type : Feature Pack + Install Time : 11/21/2010 3:40 AM + + The operation completed successfully. EOF get_packages_obj = double(stdout: get_packages_stdout) allow_any_instance_of(Chef::Provider::Package::Cab).to receive(:dism_command).with("/Get-Packages").and_return(get_packages_obj) diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb index 9fbba202f5..a07c3b236d 100644 --- a/spec/unit/provider/package/pacman_spec.rb +++ b/spec/unit/provider/package/pacman_spec.rb @@ -32,8 +32,8 @@ describe Chef::Provider::Package::Pacman do allow(@provider).to receive(:shell_out_compacted).and_return(@status) @stdin = StringIO.new - @stdout = StringIO.new(<<-ERR) -error: package "nano" not found + @stdout = StringIO.new(<<~ERR) + error: package "nano" not found ERR @stderr = StringIO.new @pid = 2342 @@ -66,26 +66,26 @@ ERR end it "should set the installed version if pacman has one" do - stdout = <<-PACMAN -Name : nano -Version : 2.2.2-1 -URL : http://www.nano-editor.org -Licenses : GPL -Groups : base -Provides : None -Depends On : glibc ncurses -Optional Deps : None -Required By : None -Conflicts With : None -Replaces : None -Installed Size : 1496.00 K -Packager : Andreas Radke <andyrtr@archlinux.org> -Architecture : i686 -Build Date : Mon 18 Jan 2010 06:16:16 PM CET -Install Date : Mon 01 Feb 2010 10:06:30 PM CET -Install Reason : Explicitly installed -Install Script : Yes -Description : Pico editor clone with enhancements + stdout = <<~PACMAN + Name : nano + Version : 2.2.2-1 + URL : http://www.nano-editor.org + Licenses : GPL + Groups : base + Provides : None + Depends On : glibc ncurses + Optional Deps : None + Required By : None + Conflicts With : None + Replaces : None + Installed Size : 1496.00 K + Packager : Andreas Radke <andyrtr@archlinux.org> + Architecture : i686 + Build Date : Mon 18 Jan 2010 06:16:16 PM CET + Install Date : Mon 01 Feb 2010 10:06:30 PM CET + Install Reason : Explicitly installed + Install Script : Yes + Description : Pico editor clone with enhancements PACMAN status = double(stdout: stdout, exitstatus: 0) @@ -102,22 +102,22 @@ PACMAN end it "should use pacman.conf to determine valid repo names for package versions" do - @pacman_conf = <<-PACMAN_CONF -[options] -HoldPkg = pacman glibc -Architecture = auto - -[customrepo] -Server = https://my.custom.repo - -[core] -Include = /etc/pacman.d/mirrorlist - -[extra] -Include = /etc/pacman.d/mirrorlist - -[community] -Include = /etc/pacman.d/mirrorlist + @pacman_conf = <<~PACMAN_CONF + [options] + HoldPkg = pacman glibc + Architecture = auto + + [customrepo] + Server = https://my.custom.repo + + [core] + Include = /etc/pacman.d/mirrorlist + + [extra] + Include = /etc/pacman.d/mirrorlist + + [community] + Include = /etc/pacman.d/mirrorlist PACMAN_CONF status = double(stdout: "customrepo nano 1.2.3-4", exitstatus: 0) diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb index a9ae5bf9d3..10c0d0f7e8 100644 --- a/spec/unit/provider/package/paludis_spec.rb +++ b/spec/unit/provider/package/paludis_spec.rb @@ -33,13 +33,13 @@ describe Chef::Provider::Package::Paludis do @stdin = StringIO.new @stderr = StringIO.new - @stdout = <<-PKG_STATUS -group/ntp 0 accounts -group/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r2 arbor -user/ntp 0 accounts -user/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r1 installed + @stdout = <<~PKG_STATUS + group/ntp 0 accounts + group/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r2 arbor + user/ntp 0 accounts + user/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r1 installed PKG_STATUS @pid = 12345 @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0) @@ -64,13 +64,13 @@ PKG_STATUS end it "should return new version if package is installed" do - @stdout.replace(<<-INSTALLED) -group/ntp 0 accounts -group/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r2 arbor -user/ntp 0 accounts -user/ntp 0 installed-accounts -net/ntp 4.2.6_p5-r1 installed + @stdout.replace(<<~INSTALLED) + group/ntp 0 accounts + group/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r2 arbor + user/ntp 0 accounts + user/ntp 0 installed-accounts + net/ntp 4.2.6_p5-r1 installed INSTALLED expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource @@ -97,18 +97,18 @@ INSTALLED end it "should not contain invalid characters for the version string" do - @stdout.replace(<<-PKG_STATUS) -sys-process/lsof 4.87 arbor -sys-process/lsof 4.87 x86_64 + @stdout.replace(<<~PKG_STATUS) + sys-process/lsof 4.87 arbor + sys-process/lsof 4.87 x86_64 PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=sys-process/lsof-4.87", { timeout: @new_resource.timeout || 900 }) @provider.install_package("sys-process/lsof", "4.87") end it "should not include the human-readable version in the candidate_version" do - @stdout.replace(<<-PKG_STATUS) -sys-process/lsof 4.87 arbor -sys-process/lsof 4.87 x86_64 + @stdout.replace(<<~PKG_STATUS) + sys-process/lsof 4.87 arbor + sys-process/lsof 4.87 x86_64 PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index 889053e826..08d80d3a7d 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -132,12 +132,12 @@ describe Chef::Provider::Package::Portage, "load_current_resource" do end it "should throw an exception if a category is not specified and there are duplicates" do - stderr_output = <<EOF -You specified an unqualified atom that matched multiple packages: -* app-misc/sphinx -* dev-python/sphinx - -Please use a more specific atom. + stderr_output = <<~EOF + You specified an unqualified atom that matched multiple packages: + * app-misc/sphinx + * dev-python/sphinx + + Please use a more specific atom. EOF status = double(stdout: "", stderr: stderr_output, exitstatus: 1) @provider = Chef::Provider::Package::Portage.new(@new_resource_without_category, @run_context) diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index 3b1a13e49c..6b33ab97f9 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -253,32 +253,32 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do end it "detects when the target gem environment is the jruby platform" do - gem_env_out = <<-JRUBY_GEM_ENV -RubyGems Environment: - - RUBYGEMS VERSION: 1.3.6 - - RUBY VERSION: 1.8.7 (2010-05-12 patchlevel 249) [java] - - INSTALLATION DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0 - - RUBY EXECUTABLE: /Users/you/.rvm/rubies/jruby-1.5.0/bin/jruby - - EXECUTABLE DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0/bin - - RUBYGEMS PLATFORMS: - - ruby - - universal-java-1.6 - - GEM PATHS: - - /Users/you/.rvm/gems/jruby-1.5.0 - - /Users/you/.rvm/gems/jruby-1.5.0@global - - GEM CONFIGURATION: - - :update_sources => true - - :verbose => true - - :benchmark => false - - :backtrace => false - - :bulk_threshold => 1000 - - "install" => "--env-shebang" - - "update" => "--env-shebang" - - "gem" => "--no-rdoc --no-ri" - - :sources => ["https://rubygems.org/", "http://gems.github.com/"] - - REMOTE SOURCES: - - https://rubygems.org/ - - http://gems.github.com/ + gem_env_out = <<~JRUBY_GEM_ENV + RubyGems Environment: + - RUBYGEMS VERSION: 1.3.6 + - RUBY VERSION: 1.8.7 (2010-05-12 patchlevel 249) [java] + - INSTALLATION DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0 + - RUBY EXECUTABLE: /Users/you/.rvm/rubies/jruby-1.5.0/bin/jruby + - EXECUTABLE DIRECTORY: /Users/you/.rvm/gems/jruby-1.5.0/bin + - RUBYGEMS PLATFORMS: + - ruby + - universal-java-1.6 + - GEM PATHS: + - /Users/you/.rvm/gems/jruby-1.5.0 + - /Users/you/.rvm/gems/jruby-1.5.0@global + - GEM CONFIGURATION: + - :update_sources => true + - :verbose => true + - :benchmark => false + - :backtrace => false + - :bulk_threshold => 1000 + - "install" => "--env-shebang" + - "update" => "--env-shebang" + - "gem" => "--no-rdoc --no-ri" + - :sources => ["https://rubygems.org/", "http://gems.github.com/"] + - REMOTE SOURCES: + - https://rubygems.org/ + - http://gems.github.com/ JRUBY_GEM_ENV expect(@gem_env).to receive(:shell_out_compacted!).with("/usr/weird/bin/gem env").and_return(double("jruby_gem_env", stdout: gem_env_out)) expected = ["ruby", Gem::Platform.new("universal-java-1.6")] @@ -295,32 +295,32 @@ RubyGems Environment: end it "uses the current gem platforms when the target env is not jruby" do - gem_env_out = <<-RBX_GEM_ENV -RubyGems Environment: - - RUBYGEMS VERSION: 1.3.6 - - RUBY VERSION: 1.8.7 (2010-05-14 patchlevel 174) [x86_64-apple-darwin10.3.0] - - INSTALLATION DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 - - RUBYGEMS PREFIX: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514 - - RUBY EXECUTABLE: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514/bin/rbx - - EXECUTABLE DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514/bin - - RUBYGEMS PLATFORMS: - - ruby - - x86_64-darwin-10 - - x86_64-rubinius-1.0 - - GEM PATHS: - - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 - - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514@global - - GEM CONFIGURATION: - - :update_sources => true - - :verbose => true - - :benchmark => false - - :backtrace => false - - :bulk_threshold => 1000 - - :sources => ["https://rubygems.org/", "http://gems.github.com/"] - - "gem" => "--no-rdoc --no-ri" - - REMOTE SOURCES: - - https://rubygems.org/ - - http://gems.github.com/ + gem_env_out = <<~RBX_GEM_ENV + RubyGems Environment: + - RUBYGEMS VERSION: 1.3.6 + - RUBY VERSION: 1.8.7 (2010-05-14 patchlevel 174) [x86_64-apple-darwin10.3.0] + - INSTALLATION DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 + - RUBYGEMS PREFIX: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514 + - RUBY EXECUTABLE: /Users/ddeleo/.rvm/rubies/rbx-1.0.0-20100514/bin/rbx + - EXECUTABLE DIRECTORY: /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514/bin + - RUBYGEMS PLATFORMS: + - ruby + - x86_64-darwin-10 + - x86_64-rubinius-1.0 + - GEM PATHS: + - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514 + - /Users/ddeleo/.rvm/gems/rbx-1.0.0-20100514@global + - GEM CONFIGURATION: + - :update_sources => true + - :verbose => true + - :benchmark => false + - :backtrace => false + - :bulk_threshold => 1000 + - :sources => ["https://rubygems.org/", "http://gems.github.com/"] + - "gem" => "--no-rdoc --no-ri" + - REMOTE SOURCES: + - https://rubygems.org/ + - http://gems.github.com/ RBX_GEM_ENV expect(@gem_env).to receive(:shell_out_compacted!).with("/usr/weird/bin/gem env").and_return(double("rbx_gem_env", stdout: gem_env_out)) expect(@gem_env.gem_platforms).to eq(Gem.platforms) diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb index 2ebf8fe4be..2aa37fe8b3 100644 --- a/spec/unit/provider/package/solaris_spec.rb +++ b/spec/unit/provider/package/solaris_spec.rb @@ -32,18 +32,18 @@ describe Chef::Provider::Package::Solaris do describe "assessing the current package status" do before do - @pkginfo = <<-PKGINFO -PKGINST: SUNWbash -NAME: GNU Bourne-Again shell (bash) -CATEGORY: system -ARCH: sparc -VERSION: 11.10.0,REV=2005.01.08.05.16 -BASEDIR: / -VENDOR: Sun Microsystems, Inc. -DESC: GNU Bourne-Again shell (bash) version 3.0 -PSTAMP: sfw10-patch20070430084444 -INSTDATE: Nov 04 2009 01:02 -HOTLINE: Please contact your local service provider + @pkginfo = <<~PKGINFO + PKGINST: SUNWbash + NAME: GNU Bourne-Again shell (bash) + CATEGORY: system + ARCH: sparc + VERSION: 11.10.0,REV=2005.01.08.05.16 + BASEDIR: / + VENDOR: Sun Microsystems, Inc. + DESC: GNU Bourne-Again shell (bash) version 3.0 + PSTAMP: sfw10-patch20070430084444 + INSTDATE: Nov 04 2009 01:02 + HOTLINE: Please contact your local service provider PKGINFO @status = double("Status", stdout: "", exitstatus: 0) diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb index 818c2ccb27..18db25fef9 100644 --- a/spec/unit/provider/service/arch_service_spec.rb +++ b/spec/unit/provider/service/arch_service_spec.rb @@ -117,10 +117,10 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do describe "when discovering service status with ps" do before do - @stdout = StringIO.new(<<-DEFAULT_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb + @stdout = StringIO.new(<<~DEFAULT_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb DEFAULT_PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -129,9 +129,9 @@ DEFAULT_PS end it "determines the service is running when it appears in ps" do - @stdout = StringIO.new(<<-RUNNING_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~RUNNING_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb index 11a02c3421..954ef3d153 100644 --- a/spec/unit/provider/service/freebsd_service_spec.rb +++ b/spec/unit/provider/service/freebsd_service_spec.rb @@ -138,10 +138,10 @@ describe Chef::Provider::Service::Freebsd do context "when we have a 'ps' attribute" do let(:stdout) do - StringIO.new(<<-PS_SAMPLE) -413 ?? Ss 0:02.51 /usr/sbin/syslogd -s -539 ?? Is 0:00.14 /usr/sbin/sshd -545 ?? Ss 0:17.53 sendmail: accepting connections (sendmail) + StringIO.new(<<~PS_SAMPLE) + 413 ?? Ss 0:02.51 /usr/sbin/syslogd -s + 539 ?? Is 0:00.14 /usr/sbin/sshd + 545 ?? Ss 0:17.53 sendmail: accepting connections (sendmail) PS_SAMPLE end let(:status) { double(stdout: stdout, exitstatus: 0) } @@ -163,9 +163,9 @@ PS_SAMPLE context "when the regex matches the output" do let(:stdout) do - StringIO.new(<<-PS_SAMPLE) -555 ?? Ss 0:05.16 /usr/sbin/cron -s - 9881 ?? Ss 0:06.67 /usr/local/sbin/httpd -DNOHTTPACCEPT + StringIO.new(<<~PS_SAMPLE) + 555 ?? Ss 0:05.16 /usr/sbin/cron -s + 9881 ?? Ss 0:06.67 /usr/local/sbin/httpd -DNOHTTPACCEPT PS_SAMPLE end @@ -341,9 +341,9 @@ PS_SAMPLE context "when the rc script has a 'name' variable" do let(:rcscript) do - StringIO.new(<<-EOF) -name="#{new_resource.service_name}" -rcvar=`set_rcvar` + StringIO.new(<<~EOF) + name="#{new_resource.service_name}" + rcvar=`set_rcvar` EOF end @@ -363,8 +363,8 @@ EOF describe "when the rcscript does not have a name variable" do let(:rcscript) do - StringIO.new <<-EOF -rcvar=`set_rcvar` + StringIO.new <<~EOF + rcvar=`set_rcvar` EOF end @@ -375,11 +375,11 @@ EOF describe "when rcvar returns foobar_enable" do let(:rcvar_stdout) do - rcvar_stdout = <<-EOF -# apache22 -# -# #{new_resource.service_name}_enable="YES" -# (default: "") + rcvar_stdout = <<~EOF + # apache22 + # + # #{new_resource.service_name}_enable="YES" + # (default: "") EOF end @@ -394,9 +394,9 @@ EOF describe "when rcvar does not return foobar_enable" do let(:rcvar_stdout) do - rcvar_stdout = <<-EOF -# service_with_noname -# + rcvar_stdout = <<~EOF + # service_with_noname + # EOF end diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb index 5d403c6898..7bbe2c6363 100644 --- a/spec/unit/provider/service/init_service_spec.rb +++ b/spec/unit/provider/service/init_service_spec.rb @@ -32,10 +32,10 @@ describe Chef::Provider::Service::Init, "load_current_resource" do @provider = Chef::Provider::Service::Init.new(@new_resource, @run_context) allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) - @stdout = StringIO.new(<<-PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb + @stdout = StringIO.new(<<~PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -133,9 +133,9 @@ PS end it "should set running to true if the regex matches the output" do - @stdout = StringIO.new(<<-RUNNING_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~RUNNING_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb index a63e3e1afb..2e30c16da4 100644 --- a/spec/unit/provider/service/invokercd_service_spec.rb +++ b/spec/unit/provider/service/invokercd_service_spec.rb @@ -32,10 +32,10 @@ describe Chef::Provider::Service::Invokercd, "load_current_resource" do @provider = Chef::Provider::Service::Invokercd.new(@new_resource, @run_context) allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) - @stdout = StringIO.new(<<-PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb + @stdout = StringIO.new(<<~PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -118,9 +118,9 @@ PS end it "should set running to true if the regex matches the output" do - @stdout = StringIO.new(<<-RUNNING_PS) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~RUNNING_PS) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status = double("Status", exitstatus: 0, stdout: @stdout) expect(@provider).to receive(:shell_out!).and_return(@status) diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb index 5ca06d9ec8..0c71eb604f 100644 --- a/spec/unit/provider/service/macosx_spec.rb +++ b/spec/unit/provider/service/macosx_spec.rb @@ -48,15 +48,15 @@ describe Chef::Provider::Service::Macosx do let(:run_context) { Chef::RunContext.new(node, {}, events) } let(:provider) { described_class.new(new_resource, run_context) } let(:launchctl_stdout) { StringIO.new } - let(:plutil_stdout) { String.new <<-XML } -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>Label</key> - <string>io.redis.redis-server</string> -</dict> -</plist> + let(:plutil_stdout) { String.new <<~XML } + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + <key>Label</key> + <string>io.redis.redis-server</string> + </dict> + </plist> XML %w{Daemon Agent}.each do |service_type| @@ -136,20 +136,20 @@ XML end context "when launchctl returns pid in service list" do - let(:launchctl_stdout) { StringIO.new <<-SVC_LIST } -{ - "LimitLoadToSessionType" = "System"; - "Label" = "io.redis.redis-server"; - "TimeOut" = 30; - "OnDemand" = false; - "LastExitStatus" = 0; - "PID" = 62803; - "Program" = "do_some.sh"; - "ProgramArguments" = ( - "path/to/do_something.sh"; - "-f"; - ); -}; + let(:launchctl_stdout) { StringIO.new <<~SVC_LIST } + { + "LimitLoadToSessionType" = "System"; + "Label" = "io.redis.redis-server"; + "TimeOut" = 30; + "OnDemand" = false; + "LastExitStatus" = 0; + "PID" = 62803; + "Program" = "do_some.sh"; + "ProgramArguments" = ( + "path/to/do_something.sh"; + "-f"; + ); + }; SVC_LIST before do @@ -175,19 +175,19 @@ SVC_LIST end end context "when launchctl returns empty service pid" do - let(:launchctl_stdout) { StringIO.new <<-SVC_LIST } -{ - "LimitLoadToSessionType" = "System"; - "Label" = "io.redis.redis-server"; - "TimeOut" = 30; - "OnDemand" = false; - "LastExitStatus" = 0; - "Program" = "do_some.sh"; - "ProgramArguments" = ( - "path/to/do_something.sh"; - "-f"; - ); -}; + let(:launchctl_stdout) { StringIO.new <<~SVC_LIST } + { + "LimitLoadToSessionType" = "System"; + "Label" = "io.redis.redis-server"; + "TimeOut" = 30; + "OnDemand" = false; + "LastExitStatus" = 0; + "Program" = "do_some.sh"; + "ProgramArguments" = ( + "path/to/do_something.sh"; + "-f"; + ); + }; SVC_LIST before do @@ -204,8 +204,8 @@ SVC_LIST end context "when launchctl doesn't return service entry at all" do - let(:launchctl_stdout) { StringIO.new <<-SVC_LIST } -Could not find service "io.redis.redis-server" in domain for system + let(:launchctl_stdout) { StringIO.new <<~SVC_LIST } + Could not find service "io.redis.redis-server" in domain for system SVC_LIST it "sets service running state to false" do diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb index e9fe1b0482..4481a7c0e3 100644 --- a/spec/unit/provider/service/simple_service_spec.rb +++ b/spec/unit/provider/service/simple_service_spec.rb @@ -31,10 +31,10 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do @provider = Chef::Provider::Service::Simple.new(@new_resource, @run_context) allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) - @stdout = StringIO.new(<<-NOMOCKINGSTRINGSPLZ) -aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb -aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash -aj 8119 6041 0 21:34 pts/3 00:00:03 vi simple_service_spec.rb + @stdout = StringIO.new(<<~NOMOCKINGSTRINGSPLZ) + aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb + aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash + aj 8119 6041 0 21:34 pts/3 00:00:03 vi simple_service_spec.rb NOMOCKINGSTRINGSPLZ @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -75,9 +75,9 @@ NOMOCKINGSTRINGSPLZ end it "should set running to true if the regex matches the output" do - @stdout = StringIO.new(<<-NOMOCKINGSTRINGSPLZ) -aj 7842 5057 0 21:26 pts/2 00:00:06 chef -aj 7842 5057 0 21:26 pts/2 00:00:06 poos + @stdout = StringIO.new(<<~NOMOCKINGSTRINGSPLZ) + aj 7842 5057 0 21:26 pts/2 00:00:06 chef + aj 7842 5057 0 21:26 pts/2 00:00:06 poos NOMOCKINGSTRINGSPLZ @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) diff --git a/spec/unit/provider/template/content_spec.rb b/spec/unit/provider/template/content_spec.rb index fb5d127d57..67d4eba138 100644 --- a/spec/unit/provider/template/content_spec.rb +++ b/spec/unit/provider/template/content_spec.rb @@ -147,21 +147,21 @@ describe Chef::Provider::Template::Content do end it "creates the template with the rendered content" do - expect(IO.read(content.tempfile.path)).to eql <<EOF -openldap -default -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb -2 -helpers.erb -#{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb -openldap -default -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' -#{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb -2 -helpers.erb -#{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb + expect(IO.read(content.tempfile.path)).to eql <<~EOF + openldap + default + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb + 2 + helpers.erb + #{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb + openldap + default + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb:2:in `from_file' + #{CHEF_SPEC_DATA}/cookbooks/openldap/recipes/default.rb + 2 + helpers.erb + #{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb EOF end diff --git a/spec/unit/provider/zypper_repository_spec.rb b/spec/unit/provider/zypper_repository_spec.rb index 3a26876f99..fc8ff14afb 100644 --- a/spec/unit/provider/zypper_repository_spec.rb +++ b/spec/unit/provider/zypper_repository_spec.rb @@ -20,17 +20,17 @@ require "spec_helper" # Output of the command: # => rpm -qa gpg-pubkey* -RPM_KEYS = <<-EOF -gpg-pubkey-307e3d54-4be01a65 -gpg-pubkey-3dbdc284-53674dd4 +RPM_KEYS = <<~EOF + gpg-pubkey-307e3d54-4be01a65 + gpg-pubkey-3dbdc284-53674dd4 EOF # Output of the command: # => gpg --with-fingerprint [FILE] -GPG_FINGER = <<-EOF -pub 2048R/3DBDC284 2011-08-19 [expires: 2024-06-14] - Key fingerprint = 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 -uid nginx signing key <signing-key@nginx.com> +GPG_FINGER = <<~EOF + pub 2048R/3DBDC284 2011-08-19 [expires: 2024-06-14] + Key fingerprint = 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 + uid nginx signing key <signing-key@nginx.com> EOF describe Chef::Provider::ZypperRepository do diff --git a/spec/unit/resource_inspector_spec.rb b/spec/unit/resource_inspector_spec.rb index 2cb9c0bb65..aef92732b3 100644 --- a/spec/unit/resource_inspector_spec.rb +++ b/spec/unit/resource_inspector_spec.rb @@ -21,9 +21,9 @@ class DummyResource < Chef::Resource resource_name :dummy description "A dummy resource" examples <<~EOH - dummy "foo" do - first "yes" - end + dummy "foo" do + first "yes" + end EOH introduced "14.0" property :first, String, description: "My First Property", introduced: "14.0" diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 28a1e01872..92429e3257 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -400,16 +400,16 @@ describe Chef::Resource do it "can have some examples" do c = Class.new(Chef::Resource) do - examples <<-EOH -resource "foo" do - foo foo -end + examples <<~EOH + resource "foo" do + foo foo + end EOH end - expect(c.examples).to eq <<-EOH -resource "foo" do - foo foo -end + expect(c.examples).to eq <<~EOH + resource "foo" do + foo foo + end EOH end end diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb index 9c8900d464..b1400ae4f3 100644 --- a/spec/unit/role_spec.rb +++ b/spec/unit/role_spec.rb @@ -245,9 +245,9 @@ describe Chef::Role do end end - ROLE_DSL = <<-EOR -name "ceiling_cat" -description "like Aliens, but furry" + ROLE_DSL = <<~EOR + name "ceiling_cat" + description "like Aliens, but furry" EOR describe "when loading from disk" do diff --git a/spec/unit/runner_spec.rb b/spec/unit/runner_spec.rb index db52862a9c..1effe3157c 100644 --- a/spec/unit/runner_spec.rb +++ b/spec/unit/runner_spec.rb @@ -258,10 +258,10 @@ describe Chef::Runner do end expect(exception).to be_a(Chef::Exceptions::MultipleFailures) - expected_message = <<-E -Multiple failures occurred: -* FailureProvider::ChefClientFail occurred in delayed notification: [explode] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort -* FailureProvider::ChefClientFail occurred in delayed notification: [explode again] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort + expected_message = <<~E + Multiple failures occurred: + * FailureProvider::ChefClientFail occurred in delayed notification: [explode] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort + * FailureProvider::ChefClientFail occurred in delayed notification: [explode again] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort E expect(exception.message).to eq(expected_message) diff --git a/spec/unit/util/dsc/lcm_output_parser_spec.rb b/spec/unit/util/dsc/lcm_output_parser_spec.rb index 65eaafe19c..32e5c0e07f 100644 --- a/spec/unit/util/dsc/lcm_output_parser_spec.rb +++ b/spec/unit/util/dsc/lcm_output_parser_spec.rb @@ -47,11 +47,11 @@ describe Chef::Util::DSC::LocalConfigurationManager::Parser do context "correctly formatted output from lcm for WhatIfParser" do it "returns a single resource when only 1 logged with the correct name" do - str = <<EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ End Resource ] [name] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ End Resource ] [name] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources.length).to eq(1) @@ -59,51 +59,51 @@ EOF end it "identifies when a resource changes the state of the system" do - str = <<EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Start Set ] [name] -logtype: [machinename]: LCM: [ End Set ] [name] -logtype: [machinename]: LCM: [ End Resource ] [name] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ Start Set ] [name] + logtype: [machinename]: LCM: [ End Set ] [name] + logtype: [machinename]: LCM: [ End Resource ] [name] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_truthy end it "preserves the log provided for how the system changed the state" do - str = <<EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Start Set ] [name] -logtype: [machinename]: [message] -logtype: [machinename]: LCM: [ End Set ] [name] -logtype: [machinename]: LCM: [ End Resource ] [name] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ Start Set ] [name] + logtype: [machinename]: [message] + logtype: [machinename]: LCM: [ End Set ] [name] + logtype: [machinename]: LCM: [ End Resource ] [name] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].change_log).to match_array(["[name]", "[message]", "[name]"]) end it "returns false for changes_state?" do - str = <<EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Skip Set ] [name] -logtype: [machinename]: LCM: [ End Resource ] [name] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ Skip Set ] [name] + logtype: [machinename]: LCM: [ End Resource ] [name] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_falsey end it "returns an empty array for change_log if changes_state? is false" do - str = <<EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Skip Set ] [name] -logtype: [machinename]: LCM: [ End Resource ] [name] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ Skip Set ] [name] + logtype: [machinename]: LCM: [ End Resource ] [name] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].change_log).to be_empty @@ -112,12 +112,12 @@ EOF context "correctly formatted output from lcm for TestDSCParser" do it "returns a single resource when only 1 logged with the correct name" do - str = <<EOF -InDesiredState : False -ResourcesInDesiredState : -ResourcesNotInDesiredState: [name] -ReturnValue : 0 -PSComputerName : . + str = <<~EOF + InDesiredState : False + ResourcesInDesiredState : + ResourcesNotInDesiredState: [name] + ReturnValue : 0 + PSComputerName : . EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources.length).to eq(1) @@ -125,36 +125,36 @@ EOF end it "identifies when a resource changes the state of the system" do - str = <<EOF -InDesiredState : False -ResourcesInDesiredState : -ResourcesNotInDesiredState: [name] -ReturnValue : 0 -PSComputerName : . + str = <<~EOF + InDesiredState : False + ResourcesInDesiredState : + ResourcesNotInDesiredState: [name] + ReturnValue : 0 + PSComputerName : . EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources[0].changes_state?).to be_truthy end it "returns false for changes_state?" do - str = <<EOF -InDesiredState : True -ResourcesInDesiredState : [name] -ResourcesNotInDesiredState: -ReturnValue : 0 -PSComputerName : . + str = <<~EOF + InDesiredState : True + ResourcesInDesiredState : [name] + ResourcesNotInDesiredState: + ReturnValue : 0 + PSComputerName : . EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources[0].changes_state?).to be_falsey end it "returns an empty array for change_log if changes_state? is false" do - str = <<EOF -InDesiredState : True -ResourcesInDesiredState : [name] -ResourcesNotInDesiredState: -ReturnValue : 0 -PSComputerName : . + str = <<~EOF + InDesiredState : True + ResourcesInDesiredState : [name] + ResourcesNotInDesiredState: + ReturnValue : 0 + PSComputerName : . EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources[0].change_log).to be_empty @@ -163,19 +163,19 @@ EOF context "Incorrectly formatted output from LCM for WhatIfParser" do it "allows missing [End Resource] when its the last one and still find all the resource" do - str = <<-EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Start Test ] -logtype: [machinename]: LCM: [ End Test ] -logtype: [machinename]: LCM: [ Skip Set ] -logtype: [machinename]: LCM: [ End Resource ] -logtype: [machinename]: LCM: [ Start Resource ] [name2] -logtype: [machinename]: LCM: [ Start Test ] -logtype: [machinename]: LCM: [ End Test ] -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ End Set ] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ Start Test ] + logtype: [machinename]: LCM: [ End Test ] + logtype: [machinename]: LCM: [ Skip Set ] + logtype: [machinename]: LCM: [ End Resource ] + logtype: [machinename]: LCM: [ Start Resource ] [name2] + logtype: [machinename]: LCM: [ Start Test ] + logtype: [machinename]: LCM: [ End Test ] + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ End Set ] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) @@ -184,19 +184,19 @@ EOF end it "allow missing [End Resource] when its the first one and still find all the resource" do - str = <<-EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Start Test ] -logtype: [machinename]: LCM: [ End Test ] -logtype: [machinename]: LCM: [ Skip Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name2] -logtype: [machinename]: LCM: [ Start Test ] -logtype: [machinename]: LCM: [ End Test ] -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ End Set ] -logtype: [machinename]: LCM: [ End Resource ] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ Start Test ] + logtype: [machinename]: LCM: [ End Test ] + logtype: [machinename]: LCM: [ Skip Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name2] + logtype: [machinename]: LCM: [ Start Test ] + logtype: [machinename]: LCM: [ End Test ] + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ End Set ] + logtype: [machinename]: LCM: [ End Resource ] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) @@ -205,18 +205,18 @@ EOF end it "allows missing set and end resource and assume an unconverged resource in this case" do - str = <<-EOF -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Start Test ] -logtype: [machinename]: LCM: [ End Test ] -logtype: [machinename]: LCM: [ Start Resource ] [name2] -logtype: [machinename]: LCM: [ Start Test ] -logtype: [machinename]: LCM: [ End Test ] -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ End Set ] -logtype: [machinename]: LCM: [ End Resource ] -logtype: [machinename]: LCM: [ End Set ] + str = <<~EOF + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ Start Test ] + logtype: [machinename]: LCM: [ End Test ] + logtype: [machinename]: LCM: [ Start Resource ] [name2] + logtype: [machinename]: LCM: [ Start Test ] + logtype: [machinename]: LCM: [ End Test ] + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ End Set ] + logtype: [machinename]: LCM: [ End Resource ] + logtype: [machinename]: LCM: [ End Set ] EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_truthy @@ -228,17 +228,17 @@ EOF context "Incorrectly formatted output from LCM for TestDSCParser" do it "allows missing [End Resource] when its the last one and still find all the resource" do - str = <<EOF -InDesiredState : True -ResourcesInDesiredState : -ResourcesNotInDesiredState: [name] -ReturnValue : 0 -PSComputerName : . -InDesiredState : True -ResourcesInDesiredState : -ResourcesNotInDesiredState: [name2] -ReturnValue : 0 -PSComputerName : . + str = <<~EOF + InDesiredState : True + ResourcesInDesiredState : + ResourcesNotInDesiredState: [name] + ReturnValue : 0 + PSComputerName : . + InDesiredState : True + ResourcesInDesiredState : + ResourcesNotInDesiredState: [name2] + ReturnValue : 0 + PSComputerName : . EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) diff --git a/spec/unit/util/dsc/local_configuration_manager_spec.rb b/spec/unit/util/dsc/local_configuration_manager_spec.rb index 33c618f2eb..cce5a39537 100644 --- a/spec/unit/util/dsc/local_configuration_manager_spec.rb +++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb @@ -24,28 +24,28 @@ describe Chef::Util::DSC::LocalConfigurationManager do let(:lcm) { Chef::Util::DSC::LocalConfigurationManager.new(nil, "tmp") } let(:normal_lcm_output) do - <<-EOH -logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ End Resource ] [name] -logtype: [machinename]: LCM: [ End Set ] + <<~EOH + logtype: [machinename]: LCM: [ Start Set ] + logtype: [machinename]: LCM: [ Start Resource ] [name] + logtype: [machinename]: LCM: [ End Resource ] [name] + logtype: [machinename]: LCM: [ End Set ] EOH end let(:no_whatif_lcm_output) do - <<-EOH -Start-DscConfiguration : A parameter cannot be found\r\n that matches parameter name 'whatif'. -At line:1 char:123 -+ run-somecommand -whatif -+ ~~~~~~~~ - + CategoryInfo : InvalidArgument: (:) [Start-DscConfiguration], ParameterBindingException - + FullyQualifiedErrorId : NamedParameterNotFound,SomeCompany.SomeAssembly.Commands.RunSomeCommand + <<~EOH + Start-DscConfiguration : A parameter cannot be found\r\n that matches parameter name 'whatif'. + At line:1 char:123 + + run-somecommand -whatif + + ~~~~~~~~ + + CategoryInfo : InvalidArgument: (:) [Start-DscConfiguration], ParameterBindingException + + FullyQualifiedErrorId : NamedParameterNotFound,SomeCompany.SomeAssembly.Commands.RunSomeCommand EOH end let(:dsc_resource_import_failure_output) do - <<-EOH -PowerShell provider MSFT_xWebsite failed to execute Test-TargetResource functionality with error message: Please ensure that WebAdministration module is installed. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : . PowerShell provider MSFT_xWebsite failed to execute Test-TargetResource functionality with error message: Please ensure that WebAdministration module is installed. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : . The SendConfigurationApply function did not succeed. + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : MI RESULT 1 + PSComputerName : . + <<~EOH + PowerShell provider MSFT_xWebsite failed to execute Test-TargetResource functionality with error message: Please ensure that WebAdministration module is installed. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : . PowerShell provider MSFT_xWebsite failed to execute Test-TargetResource functionality with error message: Please ensure that WebAdministration module is installed. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : . The SendConfigurationApply function did not succeed. + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : MI RESULT 1 + PSComputerName : . EOH end diff --git a/spec/unit/util/file_edit_spec.rb b/spec/unit/util/file_edit_spec.rb index 1a71d1d856..5c5b04d8a5 100644 --- a/spec/unit/util/file_edit_spec.rb +++ b/spec/unit/util/file_edit_spec.rb @@ -22,29 +22,29 @@ require "tempfile" describe Chef::Util::FileEdit do let(:starting_content) do - <<-EOF -127.0.0.1 localhost -255.255.255.255 broadcasthost -::1 localhost -fe80::1%lo0 localhost + <<~EOF + 127.0.0.1 localhost + 255.255.255.255 broadcasthost + ::1 localhost + fe80::1%lo0 localhost EOF end let(:localhost_replaced) do - <<-EOF -127.0.0.1 replacement -255.255.255.255 broadcasthost -::1 replacement -fe80::1%lo0 replacement + <<~EOF + 127.0.0.1 replacement + 255.255.255.255 broadcasthost + ::1 replacement + fe80::1%lo0 replacement EOF end let(:localhost_line_replaced) do - <<-EOF -replacement line -255.255.255.255 broadcasthost -replacement line -replacement line + <<~EOF + replacement line + 255.255.255.255 broadcasthost + replacement line + replacement line EOF end @@ -54,41 +54,41 @@ replacement line end let(:localhost_line_deleted) do - <<-EOF -255.255.255.255 broadcasthost + <<~EOF + 255.255.255.255 broadcasthost EOF end let(:append_after_all_localhost) do - <<-EOF -127.0.0.1 localhost -new line inserted -255.255.255.255 broadcasthost -::1 localhost -new line inserted -fe80::1%lo0 localhost -new line inserted + <<~EOF + 127.0.0.1 localhost + new line inserted + 255.255.255.255 broadcasthost + ::1 localhost + new line inserted + fe80::1%lo0 localhost + new line inserted EOF end let(:append_after_content) do - <<-EOF -127.0.0.1 localhost -255.255.255.255 broadcasthost -::1 localhost -fe80::1%lo0 localhost -new line inserted + <<~EOF + 127.0.0.1 localhost + 255.255.255.255 broadcasthost + ::1 localhost + fe80::1%lo0 localhost + new line inserted EOF end let(:append_twice) do - <<-EOF -127.0.0.1 localhost -255.255.255.255 broadcasthost -::1 localhost -fe80::1%lo0 localhost -once -twice + <<~EOF + 127.0.0.1 localhost + 255.255.255.255 broadcasthost + ::1 localhost + fe80::1%lo0 localhost + once + twice EOF end |