3 # Sets up so that you can use fragments to build a final config file,
10 # The path to the final file. Use this in case you want to differentiate
11 # between the name of a resource and the file path. Note: Use the name you
12 # provided in the target of your fragments.
14 # Who will own the file
16 # Who will own the file
18 # The mode of the final file
20 # Adds a normal shell style comment top of the file indicating that it is
23 # Controls the filebucketing behavior of the final file and see File type
24 # reference for its use. Defaults to 'puppet'
26 # Whether to replace a file that already exists on the local system
28 # Select whether to order associated fragments by 'alpha' or 'numeric'.
29 # Defaults to 'alpha'.
31 # Specifies whether to ensure there's a new line at the end of each fragment.
32 # Valid options: 'true' and 'false'. Default value: 'false'.
34 # Specifies a validation command to apply to the destination file.
35 # Requires Puppet version 3.5 or newer. Valid options: a string to be passed
36 # to a file resource. Default value: undefined.
50 $ensure_newline = false,
51 $validate_cmd = undef,
53 validate_re($ensure, '^present$|^absent$')
54 validate_absolute_path($path)
55 validate_string($owner)
56 validate_string($group)
57 validate_string($mode)
58 if ! (is_string($warn) or $warn == true or $warn == false) {
59 fail('$warn is not a string or boolean')
61 if ! is_bool($backup) and ! is_string($backup) {
62 fail('$backup must be string or bool!')
64 validate_bool($replace)
65 validate_re($order, '^alpha$|^numeric$')
66 validate_bool($ensure_newline)
68 if $validate_cmd and ! is_string($validate_cmd) {
69 fail('$validate_cmd must be a string')
73 warning('The $force parameter to concat is deprecated and has no effect.')
76 $safe_name = regsubst($name, '[/:\n\s]', '_', 'G')
77 $default_warn_message = "# This file is managed by Puppet. DO NOT EDIT.\n"
81 $warn_message = $default_warn_message
82 $_append_header = true
86 $_append_header = false
90 $_append_header = true
94 if $ensure == 'present' {
104 ensure_newline => $ensure_newline,
105 validate_cmd => $validate_cmd,
109 concat_fragment { "${name}_header":
111 content => $warn_message,