Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active March 10, 2020 02:30
Show Gist options
  • Save binford2k/ea7a172e15ba4d30c4521c1dcd434b96 to your computer and use it in GitHub Desktop.
Save binford2k/ea7a172e15ba4d30c4521c1dcd434b96 to your computer and use it in GitHub Desktop.
[~]$ cat tmp/append.pp
class foo::bar($foo = []) {
inline_template('<%= @foo.push("bar") %>')
# do things
inline_template('<%= @foo.push("foo") %>')
# more things
inline_template('<%= @foo.push("hello") %>')
# even more things
inline_template('<%= @foo.push("test") %>')
notify{$foo.join(','):}
}
$foo = []
class { 'foo::bar':
foo => $foo,
}
notify{'another':
message => $foo.join(','),
}
[~]$ puppet apply tmp/append.pp
Notice: Compiled catalog for nyx.local in environment production in 0.03 seconds
Notice: bar,foo,hello,test
Notice: /Stage[main]/Foo::Bar/Notify[bar,foo,hello,test]/message: defined 'message' as 'bar,foo,hello,test'
Notice:
Notice: /Stage[main]/Main/Notify[another]/message: defined 'message' as ''
Notice: Applied catalog in 0.02 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment