Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
define array_file($lines) {
        $template = "<%= lines * '\n' %>"
        debug $lines
        file { $name: content => inline_template($template) }
}

class master_concat_file {
        array_file { "/tmp/arrayed": lines => [], }
}

define entry_line() {
        include master_concat_file
        debug "entry_line $name"
        Array_file <| title == "/tmp/arrayed" |> {
                lines +> [ "$name" ],
        }
}

define special_line($env) {
        debug "special_line $name env $env"
        entry_line { "export $env special_$name": }
}

class test {
        entry_line { "cron": }
        special_line { "foo": env => "FOO=BAR", }
        entry_line { "huzzah": }
}

include test


> puppet master_concat.pp -d
debug: Scope(Entry_line[cron]): entry_line cron
debug: Scope(Special_line[foo]): special_line foo env FOO=BAR
debug: Scope(Entry_line[huzzah]): entry_line huzzah
debug: Scope(Array_file[/tmp/arrayed]): cron huzzah
debug: template[inline]: Bound template variables for inline template in 0.00 seconds
debug: template[inline]: Interpolated template inline template in 0.00 seconds
debug: Scope(Entry_line[export FOO=BAR special_foo]): entry_line export FOO=BAR special_foo
debug: Creating default schedules
debug: Finishing transaction -617798568 with 0 changes
debug: Failed to load library 'ldap' for feature 'ldap'
info: Applying configuration version '1265715541'
debug: Finishing transaction -617800368 with 0 changes