Created
July 26, 2012 12:09
-
-
Save jan-matejka/3181697 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 => { | |
| base, | |
| g, | |
| }; | |
| inputs => { | |
| "cfengine_stdlib.cf", | |
| }; | |
| } | |
| bundle agent base { | |
| vars: | |
| "sys" slist => { | |
| "A", "B", "C" | |
| }; | |
| commands: | |
| "/bin/true" | |
| classes => if_ok("${sys}"); | |
| reports: | |
| linux:: | |
| "setting up ${sys}"; | |
| } | |
| bundle agent g { | |
| vars: | |
| A:: | |
| "fok[1]" string => "foka"; | |
| B:: | |
| "fok[2]" string => "fokb"; | |
| C:: | |
| "fok[3]" string => "fokc"; | |
| any:: | |
| "fok_idx" slist => getindices("fok"); | |
| reports: | |
| linux:: | |
| "foks: ${fok_idx}"; | |
| "${fok[1]}"; | |
| } | |
| # cf-agent -f test.cf result: | |
| # R: setting up A | |
| # R: setting up B | |
| # R: setting up C | |
| # R: foka |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another one related to this bug: https://cfengine.com/bugtracker/view.php?id=904
You need to condition getindices() so that it happens on the second pass, like this: