X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fconcat%2Flib%2Fpuppet%2Ftype%2Fconcat_fragment.rb;h=45f080194aa4cbe1834515c099e27842b0e6526a;hb=33d8a6c91f60158a8d6aeaa5f911c000f0bcc280;hp=3a1e722b8b34984378e19602d45cbbedacf03bb2;hpb=23d29143ac40015ce61cf83a4067466f8f7d66dc;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/concat/lib/puppet/type/concat_fragment.rb b/3rdparty/modules/concat/lib/puppet/type/concat_fragment.rb index 3a1e722b8..45f080194 100644 --- a/3rdparty/modules/concat/lib/puppet/type/concat_fragment.rb +++ b/3rdparty/modules/concat/lib/puppet/type/concat_fragment.rb @@ -17,6 +17,10 @@ Puppet::Type.newtype(:concat_fragment) do desc "Unique name" end + newparam(:target) do + desc "Target" + end + newparam(:content) do desc "Content" end @@ -38,7 +42,19 @@ Puppet::Type.newtype(:concat_fragment) do desc "Tag name to be used by concat to collect all concat_fragments by tag name" end + autorequire(:file) do + if catalog.resources.select {|x| x.class == Puppet::Type.type(:concat_file) and (x[:path] == self[:target] || x.title == self[:target]) }.empty? + warning "Target Concat_file with path of #{self[:target]} not found in the catalog" + end + end + validate do + # Check if target is set + fail Puppet::ParseError, "Target not set" if self[:target].nil? + + # Check if tag is set + fail Puppet::ParseError, "Tag not set" if self[:tag].nil? + # Check if either source or content is set. raise error if none is set fail Puppet::ParseError, "Set either 'source' or 'content'" if self[:source].nil? && self[:content].nil?