Created
November 5, 2012 14:30
-
-
Save dcarley/4017458 to your computer and use it in GitHub Desktop.
Puppet eager/lazy evaluation test
This file contains hidden or 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
define test_define( | |
$param_one = 'one', | |
$param_two = $param_one | |
) { | |
if $param_one == $param_two { | |
notice('eagar evaluation') | |
} else { | |
notice('lazy evaluation') | |
} | |
} | |
class test_class_noparams( | |
$param_one = 'one', | |
$param_two = $param_one | |
) { | |
if $param_one == $param_two { | |
notice('eagar evaluation') | |
} else { | |
notice('lazy evaluation') | |
} | |
} | |
class test_class_param( | |
$param_one = 'one', | |
$param_two = $param_one | |
) { | |
if $param_one == $param_two { | |
notice('eagar evaluation') | |
} else { | |
notice('lazy evaluation') | |
} | |
} | |
test_define { 'noparams': } | |
test_define { 'param': | |
param_one => 'ONE', | |
} | |
class { 'test_class_noparams': } | |
class { 'test_class_param': | |
param_one => 'ONE', | |
} |
This file contains hidden or 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
$ for i in $(seq 1 5); do puppet apply eval_test.pp; done | |
notice: Scope(Class[Test_class_noparams]): eagar evaluation | |
notice: Scope(Class[Test_class_param]): eagar evaluation | |
notice: Scope(Test_define[noparams]): eagar evaluation | |
notice: Scope(Test_define[param]): eagar evaluation | |
notice: Finished catalog run in 0.01 seconds | |
notice: Scope(Class[Test_class_noparams]): lazy evaluation | |
notice: Scope(Class[Test_class_param]): eagar evaluation | |
notice: Scope(Test_define[noparams]): lazy evaluation | |
notice: Scope(Test_define[param]): eagar evaluation | |
notice: Finished catalog run in 0.01 seconds | |
notice: Scope(Class[Test_class_noparams]): lazy evaluation | |
notice: Scope(Class[Test_class_param]): eagar evaluation | |
notice: Scope(Test_define[noparams]): lazy evaluation | |
notice: Scope(Test_define[param]): eagar evaluation | |
notice: Finished catalog run in 0.01 seconds | |
notice: Scope(Class[Test_class_noparams]): eagar evaluation | |
notice: Scope(Class[Test_class_param]): eagar evaluation | |
notice: Scope(Test_define[noparams]): eagar evaluation | |
notice: Scope(Test_define[param]): eagar evaluation | |
notice: Finished catalog run in 0.01 seconds | |
notice: Scope(Class[Test_class_noparams]): eagar evaluation | |
notice: Scope(Class[Test_class_param]): eagar evaluation | |
notice: Scope(Test_define[noparams]): eagar evaluation | |
notice: Scope(Test_define[param]): eagar evaluation | |
notice: Finished catalog run in 0.01 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment