+ newparam(:format) do
+ desc <<-DOC
+ Specify what data type to merge the fragments as. Valid options: 'plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'.
+ DOC
+
+ newvalues(:plain, :yaml, :json, :'json-array', :'json-pretty', :'json-array-pretty')
+
+ defaultto :plain
+ end
+
+ newparam(:force, boolean: true, parent: Puppet::Parameter::Boolean) do
+ desc 'Specifies whether to merge data structures, keeping the values with higher order.'
+
+ defaultto false
+ end
+
+ newparam(:selinux_ignore_defaults, boolean: true, parent: Puppet::Parameter::Boolean) do
+ desc <<-DOC
+ See the file type's selinux_ignore_defaults documentention:
+ https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selinux_ignore_defaults.
+ DOC
+ end
+
+ newparam(:selrange) do
+ desc "See the file type's selrange documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrange"
+ validate do |value|
+ raise ArgumentError, _('Selrange must be a String') unless value.is_a?(String)
+ end
+ end
+
+ newparam(:selrole) do
+ desc "See the file type's selrole documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrole"
+ validate do |value|
+ raise ArgumentError, _('Selrole must be a String') unless value.is_a?(String)
+ end
+ end
+
+ newparam(:seltype) do
+ desc "See the file type's seltype documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seltype"
+ validate do |value|
+ raise ArgumentError, _('Seltype must be a String') unless value.is_a?(String)
+ end
+ end
+
+ newparam(:seluser) do
+ desc "See the file type's seluser documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seluser"
+ validate do |value|
+ raise ArgumentError, _('Seluser must be a String') unless value.is_a?(String)
+ end
+ end
+
+ newparam(:show_diff, boolean: true, parent: Puppet::Parameter::Boolean) do
+ desc <<-DOC
+ Specifies whether to set the show_diff parameter for the file resource. Useful for hiding secrets stored in hiera from insecure
+ reporting methods.
+ DOC
+ end
+
+ # Autorequire the file we are generating below
+ # Why is this necessary ?
+ autorequire(:file) do
+ [self[:path]]
+ end
+
+ def fragments
+ # Collect fragments that target this resource by path, title or tag.
+ @fragments ||= catalog.resources.map { |resource|
+ next unless resource.is_a?(Puppet::Type.type(:concat_fragment))
+
+ if resource[:target] == self[:path] || resource[:target] == title ||
+ (resource[:tag] && resource[:tag] == self[:tag])
+ resource