1 # Sets up so that you can use fragments to build a final config file,
6 # The path to the final file. Use this in case you want to differentiate
7 # between the name of a resource and the file path. Note: Use the name you
8 # provided in the target of your fragments.
10 # Who will own the file
12 # Who will own the file
14 # The mode of the final file
16 # Use metaparam for files to show/hide diffs for reporting when using eyaml
17 # secrets. Defaults to true
19 # Adds a normal shell style comment top of the file indicating that it is
21 # Before 2.0.0, this parameter would add a newline at the end of the warn
22 # message. To improve flexibilty, this was removed. Please add it explicitely
25 # Controls the filebucketing behavior of the final file and see File type
26 # reference for its use. Defaults to 'puppet'
28 # Whether to replace a file that already exists on the local system
30 # Select whether to order associated fragments by 'alpha' or 'numeric'.
31 # Defaults to 'alpha'.
32 # @param ensure_newline
33 # Specifies whether to ensure there's a new line at the end of each fragment.
34 # Valid options: 'true' and 'false'. Default value: 'false'.
35 # @param selinux_ignore_defaults
41 # Specifies a validation command to apply to the destination file.
42 # Requires Puppet version 3.5 or newer. Valid options: a string to be passed
43 # to a file resource. Default value: undefined.
46 Enum['present', 'absent'] $ensure = 'present',
47 Stdlib::Absolutepath $path = $name,
48 Optional[Variant[String, Integer]] $owner = undef,
49 Optional[Variant[String, Integer]] $group = undef,
50 String $mode = '0644',
51 Variant[Boolean, String] $warn = false,
52 Boolean $show_diff = true,
53 Variant[Boolean, String] $backup = 'puppet',
54 Boolean $replace = true,
55 Enum['alpha','numeric'] $order = 'alpha',
56 Boolean $ensure_newline = false,
57 Optional[String] $validate_cmd = undef,
58 Optional[Boolean] $selinux_ignore_defaults = undef,
59 Optional[String] $selrange = undef,
60 Optional[String] $selrole = undef,
61 Optional[String] $seltype = undef,
62 Optional[String] $seluser = undef,
65 $safe_name = regsubst($name, '[/:~\n\s\+\*\(\)@]', '_', 'G')
66 $default_warn_message = "# This file is managed by Puppet. DO NOT EDIT.\n"
70 $warn_message = $default_warn_message
71 $_append_header = true
75 $_append_header = false
79 $_append_header = true
83 if $ensure == 'present' {
90 selinux_ignore_defaults => $selinux_ignore_defaults,
91 selrange => $selrange,
97 show_diff => $show_diff,
99 ensure_newline => $ensure_newline,
100 validate_cmd => $validate_cmd,
104 concat_fragment { "${name}_header":
107 content => $warn_message,