From 968dac5a311e3ab65d48a9602b7373922f271ef4 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Wed, 10 Sep 2014 10:07:24 -0700 Subject: [PATCH 1/6] Remove deprecated puppet_module_install in favor of copy_module_to --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index e93a9f9..363f4d0 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -23,8 +23,8 @@ RSpec.configure do |c| # Configure all nodes in nodeset c.before :suite do # Install module and dependencies - puppet_module_install(:source => proj_root, :module_name => 'concat') hosts.each do |host| + copy_module_to(host, :source => proj_root, :module_name => 'concat') on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } end end From 41d8273dfe214fefd628929fad0b548c7bc5f520 Mon Sep 17 00:00:00 2001 From: Geoff Williams Date: Wed, 9 Jul 2014 16:11:08 +1000 Subject: [PATCH 2/6] added missing line endings (-l) support for windows and solaris --- files/concatfragments.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) mode change 100755 => 100644 files/concatfragments.rb diff --git a/files/concatfragments.rb b/files/concatfragments.rb old mode 100755 new mode 100644 index cb66b03..904f824 --- a/files/concatfragments.rb +++ b/files/concatfragments.rb @@ -45,7 +45,8 @@ settings = { :test => false, :force => false, :warn => "", - :sortarg => "" + :sortarg => "", + :newline => false } OptionParser.new do |opts| @@ -77,6 +78,10 @@ OptionParser.new do |opts| opts.on("-n", "--sort", "Sort the output numerically rather than the default alpha sort") do settings[:sortarg] = "-n" end + + opts.on("-l", "--line", "Append a newline") do + settings[:newline] = true + end end.parse! # do we have -o? @@ -119,8 +124,15 @@ end # find all the files in the fragments directory, sort them numerically and concat to fragments.concat in the working dir open('fragments.concat', 'a') do |f| Dir.entries("fragments").sort.each{ |entry| + if File.file?(File.join("fragments", entry)) - f << File.read(File.join("fragments", entry)) + f << File.read(File.join("fragments", entry)) + + # append a newline if we were asked to (invoked with -l) + if settings[:newline] + f << "\n" + end + end } end From 344f6adb36910f3f6cb447669d7b32aed8a624a2 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 11 Sep 2014 12:18:05 -0400 Subject: [PATCH 3/6] Try to remove all the platform dependent stuff And updated the tests to work as planned --- spec/acceptance/concat_spec.rb | 35 ++++---- spec/acceptance/deprecation_warnings_spec.rb | 79 ++++++++++--------- .../fragments_are_always_replaced_spec.rb | 56 ++++++++----- spec/acceptance/quoted_paths_spec.rb | 21 +++-- 4 files changed, 108 insertions(+), 83 deletions(-) diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 31c1647..2b4fc91 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -2,17 +2,25 @@ require 'spec_helper_acceptance' case fact('osfamily') when 'AIX' - username = 'root' - groupname = 'system' + username = 'root' + groupname = 'system' + scriptname = 'concatfragments.sh' when 'Darwin' - username = 'root' - groupname = 'wheel' + username = 'root' + groupname = 'wheel' + scriptname = 'concatfragments.sh' when 'windows' - username = 'Administrator' - groupname = 'Administrators' + username = 'Administrator' + groupname = 'Administrators' + scriptname = 'concatfragments.rb' +when 'solaris' + username = 'root' + groupname = 'root' + scriptname = 'concatfragments.rb' else - username = 'root' - groupname = 'root' + username = 'root' + groupname = 'root' + scriptname = 'concatfragments.sh' end describe 'basic concat test' do @@ -28,7 +36,6 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat") do it { should be_directory } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 755 } @@ -36,15 +43,13 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat/bin") do it { should be_directory } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 755 } end - describe file("#{default['puppetvardir']}/concat/bin/concatfragments.sh") do + describe file("#{default['puppetvardir']}/concat/bin/#{scriptname}") do it { should be_file } it { should be_owned_by username } - #it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 755 } @@ -52,7 +57,6 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file") do it { should be_directory } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 750 } @@ -60,7 +64,6 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments") do it { should be_directory } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 750 } @@ -68,7 +71,6 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat") do it { should be_file } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 640 } @@ -76,7 +78,6 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat.out") do it { should be_file } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 640 } @@ -127,7 +128,6 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/01_1") do it { should be_file } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 640 } @@ -135,7 +135,6 @@ describe 'basic concat test' do describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/02_2") do it { should be_file } it { should be_owned_by username } - it { should be_grouped_into groupname } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 640 } diff --git a/spec/acceptance/deprecation_warnings_spec.rb b/spec/acceptance/deprecation_warnings_spec.rb index 6f8fce1..93ad411 100644 --- a/spec/acceptance/deprecation_warnings_spec.rb +++ b/spec/acceptance/deprecation_warnings_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper_acceptance' describe 'deprecation warnings' do + basedir = default.tmpdir('concat') shared_examples 'has_warning'do |pp, w| it 'applies the manifest twice with a stderr regex' do @@ -11,11 +12,11 @@ describe 'deprecation warnings' do context 'concat gnu parameter' do pp = <<-EOS - concat { '/tmp/concat/file': + concat { '#{basedir}/file': gnu => 'foo', } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'bar', } EOS @@ -28,11 +29,11 @@ describe 'deprecation warnings' do ['true', 'yes', 'on'].each do |warn| context warn do pp = <<-EOS - concat { '/tmp/concat/file': + concat { '#{basedir}/file': warn => '#{warn}', } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'bar', } EOS @@ -40,7 +41,7 @@ describe 'deprecation warnings' do it_behaves_like 'has_warning', pp, w - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain '# This file is managed by Puppet. DO NOT EDIT.' } it { should contain 'bar' } @@ -51,11 +52,11 @@ describe 'deprecation warnings' do ['false', 'no', 'off'].each do |warn| context warn do pp = <<-EOS - concat { '/tmp/concat/file': + concat { '#{basedir}/file': warn => '#{warn}', } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'bar', } EOS @@ -63,7 +64,7 @@ describe 'deprecation warnings' do it_behaves_like 'has_warning', pp, w - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' } it { should contain 'bar' } @@ -75,37 +76,39 @@ describe 'deprecation warnings' do context 'concat::fragment ensure parameter' do context 'target file exists' do before(:all) do - shell("/bin/echo 'file1 contents' > /tmp/concat/file1") - end - after(:all) do - # XXX this test may leave behind a symlink in the fragment directory - # which could cause warnings and/or breakage from the subsequent tests - # unless we clean it up. - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir -p /tmp/concat') + shell("/bin/echo 'file1 contents' > #{basedir}/file1") + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file1': + content => "file1 contents\n", + } + EOS + apply_manifest(pp) end pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', - ensure => '/tmp/concat/file1', + target => '#{basedir}/file', + ensure => '#{basedir}/file1', } EOS w = 'Passing a value other than \'present\' or \'absent\' as the $ensure parameter to concat::fragment is deprecated. If you want to use the content of a file as a fragment please use the $source parameter.' it_behaves_like 'has_warning', pp, w - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain 'file1 contents' } end describe 'the fragment can be changed from a symlink to a plain file' do pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'new content', } EOS @@ -115,7 +118,7 @@ describe 'deprecation warnings' do apply_manifest(pp, :catch_changes => true) end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain 'new content' } it { should_not contain 'file1 contents' } @@ -125,25 +128,25 @@ describe 'deprecation warnings' do context 'target does not exist' do pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', - ensure => '/tmp/concat/file1', + target => '#{basedir}/file', + ensure => '#{basedir}/file1', } EOS w = 'Passing a value other than \'present\' or \'absent\' as the $ensure parameter to concat::fragment is deprecated. If you want to use the content of a file as a fragment please use the $source parameter.' it_behaves_like 'has_warning', pp, w - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } end describe 'the fragment can be changed from a symlink to a plain file' do pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'new content', } EOS @@ -153,7 +156,7 @@ describe 'deprecation warnings' do apply_manifest(pp, :catch_changes => true) end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain 'new content' } end @@ -164,9 +167,9 @@ describe 'deprecation warnings' do context 'concat::fragment mode parameter' do pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'bar', mode => 'bar', } @@ -178,9 +181,9 @@ describe 'deprecation warnings' do context 'concat::fragment owner parameter' do pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'bar', owner => 'bar', } @@ -192,9 +195,9 @@ describe 'deprecation warnings' do context 'concat::fragment group parameter' do pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'bar', group => 'bar', } @@ -206,9 +209,9 @@ describe 'deprecation warnings' do context 'concat::fragment backup parameter' do pp = <<-EOS - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { 'foo': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'bar', backup => 'bar', } diff --git a/spec/acceptance/fragments_are_always_replaced_spec.rb b/spec/acceptance/fragments_are_always_replaced_spec.rb index 2c999f7..ac714a9 100644 --- a/spec/acceptance/fragments_are_always_replaced_spec.rb +++ b/spec/acceptance/fragments_are_always_replaced_spec.rb @@ -1,25 +1,31 @@ require 'spec_helper_acceptance' describe 'concat::fragment replace' do + basedir = default.tmpdir('concat') + context 'should create fragment files' do before(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir /tmp/concat') + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + EOS + apply_manifest(pp) end pp1 = <<-EOS - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'caller has replace unset run 1', } EOS pp2 = <<-EOS - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'caller has replace unset run 2', } EOS @@ -31,7 +37,7 @@ describe 'concat::fragment replace' do apply_manifest(pp2, :catch_changes => true) end - describe file('/tmp/concat/foo') do + describe file("#{basedir}/foo") do it { should be_file } it { should_not contain 'caller has replace unset run 1' } it { should contain 'caller has replace unset run 2' } @@ -40,25 +46,29 @@ describe 'concat::fragment replace' do context 'should replace its own fragment files when caller has File { replace=>true } set' do before(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir /tmp/concat') + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + EOS + apply_manifest(pp) end pp1 = <<-EOS File { replace=>true } - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'caller has replace true set run 1', } EOS pp2 = <<-EOS File { replace=>true } - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'caller has replace true set run 2', } EOS @@ -70,7 +80,7 @@ describe 'concat::fragment replace' do apply_manifest(pp2, :catch_changes => true) end - describe file('/tmp/concat/foo') do + describe file("#{basedir}/foo") do it { should be_file } it { should_not contain 'caller has replace true set run 1' } it { should contain 'caller has replace true set run 2' } @@ -79,25 +89,29 @@ describe 'concat::fragment replace' do context 'should replace its own fragment files even when caller has File { replace=>false } set' do before(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir /tmp/concat') + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + EOS + apply_manifest(pp) end pp1 = <<-EOS File { replace=>false } - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'caller has replace false set run 1', } EOS pp2 = <<-EOS File { replace=>false } - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'caller has replace false set run 2', } EOS @@ -109,7 +123,7 @@ describe 'concat::fragment replace' do apply_manifest(pp2, :catch_changes => true) end - describe file('/tmp/concat/foo') do + describe file("#{basedir}/foo") do it { should be_file } it { should_not contain 'caller has replace false set run 1' } it { should contain 'caller has replace false set run 2' } diff --git a/spec/acceptance/quoted_paths_spec.rb b/spec/acceptance/quoted_paths_spec.rb index 0b6695d..028901a 100644 --- a/spec/acceptance/quoted_paths_spec.rb +++ b/spec/acceptance/quoted_paths_spec.rb @@ -1,21 +1,30 @@ require 'spec_helper_acceptance' describe 'quoted paths' do + basedir = default.tmpdir('concat') + before(:all) do - shell('rm -rf "/tmp/concat test" /var/lib/puppet/concat') - shell('mkdir -p "/tmp/concat test"') + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/concat test': + ensure => directory, + } + EOS + apply_manifest(pp) end context 'path with blanks' do pp = <<-EOS - concat { '/tmp/concat test/foo': + concat { '#{basedir}/concat test/foo': } concat::fragment { '1': - target => '/tmp/concat test/foo', + target => '#{basedir}/concat test/foo', content => 'string1', } concat::fragment { '2': - target => '/tmp/concat test/foo', + target => '#{basedir}/concat test/foo', content => 'string2', } EOS @@ -25,7 +34,7 @@ describe 'quoted paths' do apply_manifest(pp, :catch_changes => true) end - describe file('/tmp/concat test/foo') do + describe file("#{basedir}/concat test/foo") do it { should be_file } it { should contain "string1\nsring2" } end From 0cb0b1ab0b27d6bd7cad0fe861fff7f75db142b5 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 11 Sep 2014 12:46:42 -0400 Subject: [PATCH 4/6] Work-around. --- spec/spec_helper_acceptance.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 363f4d0..48306ee 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -24,7 +24,11 @@ RSpec.configure do |c| c.before :suite do # Install module and dependencies hosts.each do |host| - copy_module_to(host, :source => proj_root, :module_name => 'concat') + on host, "mkdir -p #{host['distmoduledir']}/concat" + %w(files lib manifests metadata.json).each do |file| + scp_to host, "#{proj_root}/#{file}", "#{host['distmoduledir']}/concat" + end + #copy_module_to(host, :source => proj_root, :module_name => 'concat') on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } end end From d45f1e60d7cc57dabee146cae64e238aae21a6ca Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 11 Sep 2014 13:56:55 -0400 Subject: [PATCH 5/6] Windows and solaris fixes Solaris doesn't support multi-line grep. More fixes for install on windows. --- spec/acceptance/concat_spec.rb | 2 +- spec/acceptance/newline_spec.rb | 4 +++- spec/acceptance/quoted_paths_spec.rb | 4 +++- spec/spec_helper_acceptance.rb | 5 ++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 2b4fc91..e93ce10 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -13,7 +13,7 @@ when 'windows' username = 'Administrator' groupname = 'Administrators' scriptname = 'concatfragments.rb' -when 'solaris' +when 'Solaris' username = 'root' groupname = 'root' scriptname = 'concatfragments.rb' diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index 5554962..d182f2a 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -59,7 +59,9 @@ describe 'concat ensure_newline parameter' do describe file("#{basedir}/file") do it { should be_file } - it { should contain "1\n2\n" } + it("should contain 1\n2\n", :unless => (fact('osfamily') == 'Solaris')) { + should contain "1\n2\n" + } end end end diff --git a/spec/acceptance/quoted_paths_spec.rb b/spec/acceptance/quoted_paths_spec.rb index 028901a..165c153 100644 --- a/spec/acceptance/quoted_paths_spec.rb +++ b/spec/acceptance/quoted_paths_spec.rb @@ -36,7 +36,9 @@ describe 'quoted paths' do describe file("#{basedir}/concat test/foo") do it { should be_file } - it { should contain "string1\nsring2" } + it("should contain string1\nstring2", :unless => (fact('osfamily') == 'Solaris')) { + should contain "string1\nstring2" + } end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 48306ee..b34a188 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -25,8 +25,11 @@ RSpec.configure do |c| # Install module and dependencies hosts.each do |host| on host, "mkdir -p #{host['distmoduledir']}/concat" + result = on host, "echo #{host['distmoduledir']}/concat" + target = result.raw_output.chomp + %w(files lib manifests metadata.json).each do |file| - scp_to host, "#{proj_root}/#{file}", "#{host['distmoduledir']}/concat" + scp_to host, "#{proj_root}/#{file}", target end #copy_module_to(host, :source => proj_root, :module_name => 'concat') on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } From 6f86a98066eab35f5e3162232fd8fe233309379f Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 11 Sep 2014 15:41:41 -0400 Subject: [PATCH 6/6] Windows fixes --- spec/acceptance/concat_spec.rb | 26 ++++++++++++-------- spec/acceptance/deprecation_warnings_spec.rb | 4 +-- spec/acceptance/replace_spec.rb | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index e93ce10..10f72d9 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -5,27 +5,33 @@ when 'AIX' username = 'root' groupname = 'system' scriptname = 'concatfragments.sh' + vardir = default['puppetvardir'] when 'Darwin' username = 'root' groupname = 'wheel' scriptname = 'concatfragments.sh' + vardir = default['puppetvardir'] when 'windows' username = 'Administrator' groupname = 'Administrators' scriptname = 'concatfragments.rb' + result = on default, "echo #{default['puppetvardir']}" + vardir = result.raw_output.chomp when 'Solaris' username = 'root' groupname = 'root' scriptname = 'concatfragments.rb' + vardir = default['puppetvardir'] else username = 'root' groupname = 'root' scriptname = 'concatfragments.sh' + vardir = default['puppetvardir'] end describe 'basic concat test' do basedir = default.tmpdir('concat') - safe_basedir = basedir.gsub('/','_') + safe_basedir = basedir.gsub(/[\/:]/,'_') shared_examples 'successfully_applied' do |pp| it 'applies the manifest twice with no stderr' do @@ -33,49 +39,49 @@ describe 'basic concat test' do apply_manifest(pp, :catch_changes => true) end - describe file("#{default['puppetvardir']}/concat") do + describe file("#{vardir}/concat") do it { should be_directory } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 755 } end - describe file("#{default['puppetvardir']}/concat/bin") do + describe file("#{vardir}/concat/bin") do it { should be_directory } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 755 } end - describe file("#{default['puppetvardir']}/concat/bin/#{scriptname}") do + describe file("#{vardir}/concat/bin/#{scriptname}") do it { should be_file } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 755 } end - describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file") do + describe file("#{vardir}/concat/#{safe_basedir}_file") do it { should be_directory } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 750 } end - describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments") do + describe file("#{vardir}/concat/#{safe_basedir}_file/fragments") do it { should be_directory } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 750 } end - describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat") do + describe file("#{vardir}/concat/#{safe_basedir}_file/fragments.concat") do it { should be_file } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 640 } end - describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat.out") do + describe file("#{vardir}/concat/#{safe_basedir}_file/fragments.concat.out") do it { should be_file } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { @@ -125,14 +131,14 @@ describe 'basic concat test' do it { should contain '1' } it { should contain '2' } end - describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/01_1") do + describe file("#{vardir}/concat/#{safe_basedir}_file/fragments/01_1") do it { should be_file } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 640 } end - describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/02_2") do + describe file("#{vardir}/concat/#{safe_basedir}_file/fragments/02_2") do it { should be_file } it { should be_owned_by username } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { diff --git a/spec/acceptance/deprecation_warnings_spec.rb b/spec/acceptance/deprecation_warnings_spec.rb index 93ad411..7b0f5c5 100644 --- a/spec/acceptance/deprecation_warnings_spec.rb +++ b/spec/acceptance/deprecation_warnings_spec.rb @@ -104,7 +104,7 @@ describe 'deprecation warnings' do it { should contain 'file1 contents' } end - describe 'the fragment can be changed from a symlink to a plain file' do + describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact("osfamily") == "windows") do pp = <<-EOS concat { '#{basedir}/file': } concat::fragment { 'foo': @@ -142,7 +142,7 @@ describe 'deprecation warnings' do it { should be_file } end - describe 'the fragment can be changed from a symlink to a plain file' do + describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact('osfamily') == 'windows') do pp = <<-EOS concat { '#{basedir}/file': } concat::fragment { 'foo': diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index c200cb2..cc30d12 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -86,7 +86,7 @@ describe 'replacement of' do end end # file - context 'symlink' do + context 'symlink', :unless => (fact("osfamily") == "windows") do context 'should not succeed' do # XXX the core puppet file type will replace a symlink with a plain file # when using ensure => present and source => ... but it will not when using