Nice! I didn't know about JsonPath until today, but it sounds really useful for accessing node attributes, especially in light of the recent discussions on this list. Like! :-)
Hi,FWIW, I've released a new version of chef-helpers.gem - my collection of utils and extra methods I use in recipes. It's available at https://github.com/3ofcoins/chef-helpers/One feature that may be particularly useful (and if it's interesting, it may be worth extracting to a separate gem) is overloading Chef::Node#[] to allow reading nested attributes using JSONPath notation (http://goessner.net/articles/JsonPath/):chef > require 'chef-helpers'=> truechef > node['$..name']=> ["portinari-2.local", "Java(TM) SE Runtime Environment", "Java HotSpot(TM) 64-Bit Server VM", "Darwin"]chef > node['$.kernel.name']=> ["Darwin"]You can read about more sophisticated use cases at http://3ofcoins.net/2013/07/21/access-chef-nodes-attributes-by-jsonpath/ - I bump into such situations quite often, and easy access to deep attributes saves me a lot of effort (and prevents confusing tracebacks if the code is not defensive enough). I'm curious to hear your thoughts.-- M
Archive powered by MHonArc 2.6.16.