diff --git a/lib/puppet/type/concat_file.rb b/lib/puppet/type/concat_file.rb index 6a6225e3b..9b3fde4dc 100644 --- a/lib/puppet/type/concat_file.rb +++ b/lib/puppet/type/concat_file.rb @@ -148,10 +148,9 @@ def fragment_content(r) fragment_content end - def eval_generate + def generate file_opts = { :ensure => self[:ensure] == :absent ? :absent : :file, - :content => self.should_content, } [:path, :owner, :group, :mode, :replace, :backup].each do |param| @@ -162,4 +161,9 @@ def eval_generate [Puppet::Type.type(:file).new(file_opts)] end + + def eval_generate + catalog.resource("File[#{self[:path]}]")[:content] = should_content + [] + end end diff --git a/spec/acceptance/concurrency_spec.rb b/spec/acceptance/concurrency_spec.rb new file mode 100644 index 000000000..fcffdbd10 --- /dev/null +++ b/spec/acceptance/concurrency_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper_acceptance' + +describe 'with file recursive purge' do + basedir = default.tmpdir('concat') + context 'should still create concat file' do + pp = <<-EOS + file { '#{basedir}/bar': + ensure => directory, + purge => true, + recurse => true, + } + + concat { "foobar": + ensure => 'present', + path => '#{basedir}/bar/foobar', + } + + concat::fragment { 'foo': + target => 'foobar', + content => 'foo', + } + EOS + + it 'applies the manifest twice with no stderr' do + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe file("#{basedir}/bar/foobar") do + it { should be_file } + its(:content) { + should match 'foo' + } + end + end +end + diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb index 5d66e4d98..b208979ac 100644 --- a/spec/acceptance/fragment_source_spec.rb +++ b/spec/acceptance/fragment_source_spec.rb @@ -149,7 +149,6 @@ end describe file("#{basedir}/fail_no_source") do #FIXME: Serverspec::Type::File doesn't support exists? for some reason. so... hack. - it { should_not be_file } it { should_not be_directory } end end