Last active
March 14, 2024 00:11
-
-
Save ccooke/20dc9c44f5967324090eee5a7abd6c90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class collections::file_test { | |
# This resource will create File['tmp/collections-file-test'], | |
# setting content => template('collections/file-test.erb'), | |
# with a $data variable merging the stanza below with all of the | |
# following fragments. | |
collections::file { '/tmp/collections-file-test': | |
collector => 'file-test', | |
template => 'collections/file-test.erb', | |
data => { | |
list => [ 1 ], | |
hash => { one => 1 } | |
} | |
} | |
collections::file::fragment { 'Add two': | |
target => 'file-test', | |
data => { | |
list => [ 2 ], | |
hash => { two => 2 }, | |
repl => { not_two => 7 } | |
} | |
} | |
collections::file::fragment { 'Overwrite': | |
target => 'file-test', | |
data => { | |
hash => { one => 3 }, | |
repl => { not_two => 2 } | |
} | |
} | |
# With a template of "<%= @data -%>", this creates File['/tmp/collections-file-test'] | |
# with content set to: | |
# {"hash"=>{"one"=>3, "two"=>2}, "repl"=>{"not_two"=>2}, "list"=>[2, 1]} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment