Skip to content

Commit

Permalink
Merge pull request #317 from bmjen/tableflip
Browse files Browse the repository at this point in the history
MODULES-2054 - fixes dependency bug in creating the target file
  • Loading branch information
Morgan Haskel committed May 27, 2015
2 parents bb55d80 + 2292759 commit 02c5f4b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/puppet/type/concat_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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
37 changes: 37 additions & 0 deletions spec/acceptance/concurrency_spec.rb
Original file line number Diff line number Diff line change
@@ -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

1 change: 0 additions & 1 deletion spec/acceptance/fragment_source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02c5f4b

Please sign in to comment.