From 6f86a98066eab35f5e3162232fd8fe233309379f Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 11 Sep 2014 15:41:41 -0400 Subject: [PATCH] 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