Last active
May 15, 2017 19:39
-
-
Save BenLiyanage/2e3eb30ca872b4554d2e49bcf9d104a0 to your computer and use it in GitHub Desktop.
Recipe Demonstrating how chef's two pass model, and lazy evaluation interacts
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.set[:lazy] = false | |
log 'compile evaluation' do | |
message node[:lazy].to_s | |
end | |
# false | |
log 'execute evaluation' do | |
message lazy { node[:lazy].to_s } | |
end | |
# true | |
ruby_block 'set lazy during execute' do | |
block do | |
node.set[:lazy] = true | |
end | |
end | |
log 'after ruby block not lazy' do | |
message node[:lazy].to_s | |
end | |
# false | |
log 'lazy' do | |
message lazy { node[:lazy].to_s } | |
end | |
# true | |
node.set[:lazy] = true | |
log ' after compile not lazy' do | |
message node[:lazy].to_s | |
end | |
# true | |
log 'lazy' do | |
message lazy { node[:lazy].to_s } | |
end | |
# true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment