Created
March 12, 2012 18:50
-
-
Save zzamboni/2023934 to your computer and use it in GitHub Desktop.
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
| body common control | |
| { | |
| bundlesequence => { "globals" }; | |
| } | |
| bundle agent foo(name) | |
| { | |
| vars: | |
| "var_$(name)" string => "Hi $(name)"; | |
| reports: | |
| cfengine:: | |
| "$(name) = $(var_$(name))"; | |
| } | |
| bundle agent globals | |
| { | |
| methods: | |
| "boo" usebundle => foo("boo"); | |
| "bar" usebundle => foo("bar"); | |
| reports: | |
| cfengine:: | |
| # Only foo.var_bar works. Why? | |
| # If I reverse the methods: promises, then only var_boo works. | |
| # It seems only the most-recently-set variable is properly expanded. | |
| # UPDATE: of course. The namespace for each bundle is cleared each time it's called. | |
| # It's not an array, it's a bundle :) | |
| "$(foo.var_boo)"; | |
| "$(foo.var_bar)"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment