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/functional | |
parent | 35603c7ce1bd3ccf35334ed65152140f0ecaf080 (diff) | |
download | chef-dcac6762380d011f73cf53a50476d31dab0025ee.tar.gz |
fix Layout/IndentHeredoc
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/functional')
-rw-r--r-- | spec/functional/resource/dnf_package_spec.rb | 12 | ||||
-rw-r--r-- | spec/functional/resource/dsc_script_spec.rb | 184 | ||||
-rw-r--r-- | spec/functional/resource/git_spec.rb | 8 | ||||
-rw-r--r-- | spec/functional/resource/powershell_script_spec.rb | 20 | ||||
-rw-r--r-- | spec/functional/resource/yum_package_spec.rb | 12 | ||||
-rw-r--r-- | spec/functional/win32/crypto_spec.rb | 18 |
6 files changed, 127 insertions, 127 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) |