From 3ddd8e93a161d748e5703b0856cb2eded0dd19c5 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 18 Jun 2014 23:59:05 -0700 Subject: added support for 'control files', files like the .json configuration files but contain arbitrary ruby code evaluated in the context of the node. --- lib/leap_cli/config/node.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/leap_cli/config/node.rb') diff --git a/lib/leap_cli/config/node.rb b/lib/leap_cli/config/node.rb index 740f9bb..30af5d1 100644 --- a/lib/leap_cli/config/node.rb +++ b/lib/leap_cli/config/node.rb @@ -33,6 +33,29 @@ module LeapCli; module Config return vagrant_range.include?(ip_address) end + # + # Return a hash table representation of ourselves, with the key equal to the @node.name, + # and the value equal to the fields specified in *keys. + # + # Also, the result is flattened to a single hash, so a key of 'a.b' becomes 'a_b' + # + # compare to Object#pick(*keys). This method is the sames as Config::ObjectList#pick_fields, + # but works on a single node. + # + # Example: + # + # node.pick('domain.internal') => + # + # { + # 'node1': { + # 'domain_internal': 'node1.example.i' + # } + # } + # + def pick_fields(*keys) + {@node.name => self.pick(*keys)} + end + # # can be overridden by the platform. # returns a list of node names that should be tested before this node -- cgit v1.2.3