Last active
August 29, 2015 14:26
-
-
Save martingehrke/ce1e5e8aa314bc0d912e to your computer and use it in GitHub Desktop.
How to get a list of values out of json in CFEngine 3.6+
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
#it can be non-intuitive to get a slist from a json data object in CFEngine | |
# this can be useful if you have a json with hostnames as keys | |
vars: | |
"data" data => parsejson("{ "key": ["one", "two", "three"] }"); | |
"values" slist => getvalues("data[key]"); #just pass the name, not the variable itself | |
#just an example, I haven't loaded moredata in this gist | |
"info" slist => getvalues("moredata[$(sys.fqhost)]"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment