Created
October 16, 2014 23:14
-
-
Save justindossey/7313509e36c1b271ef24 to your computer and use it in GitHub Desktop.
Chef recipe showing order of lazy evaluation
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
node.default.bar.tags = ['tag1-bar'] | |
file "/tmp/bar.txt" do | |
content lazy { node.bar.tags.join(',') } | |
end | |
ruby_block 'update second tag' do | |
block { node.default.bar.tags << 'tag2-bar' } | |
only_if { node.default.bar.tags << 'tag3-bar' } | |
notifies :create, 'file[/tmp/bar.txt]', :delayed | |
end | |
r = resources(file: '/tmp/bar.txt') | |
r.content(Chef::DelayedEvaluator.new { | |
node.default.bar.tags << 'tag4-bar' | |
node.bar.tags.join(',') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment