From e4f786e229c101cb60626ce23e671c5258466724 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 8 Apr 2016 12:41:45 -0700 Subject: partials - add support for leap_cli's inheritable service partials (requires latest develop branch leap_cli) --- lib/leap_cli/macros/core.rb | 9 +++++++-- lib/leap_cli/macros/hosts.rb | 2 +- lib/leap_cli/macros/nodes.rb | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/leap_cli/macros/core.rb b/lib/leap_cli/macros/core.rb index ebea3a6e..873da358 100644 --- a/lib/leap_cli/macros/core.rb +++ b/lib/leap_cli/macros/core.rb @@ -47,8 +47,13 @@ module LeapCli # applies a JSON partial to this node # def apply_partial(partial_path) - manager.partials(partial_path).each do |partial_data| - self.deep_merge!(partial_data) + if env.partials[partial_path] + self.deep_merge!(env.partials[partial_path]) + else + raise ArgumentError.new( + "No such partial `%s`. Available partials include:\n%s" % + [partial_path, env.partials.keys.join(", ")] + ) end end diff --git a/lib/leap_cli/macros/hosts.rb b/lib/leap_cli/macros/hosts.rb index 541bbc13..963857ae 100644 --- a/lib/leap_cli/macros/hosts.rb +++ b/lib/leap_cli/macros/hosts.rb @@ -17,7 +17,7 @@ module LeapCli node_list = node_list['environment' => '!local'] end node_list.map {|name, n| - [n.ip_address, (global.facts[name]||{})['ec2_public_ipv4']] + [n.ip_address, (manager.facts[name]||{})['ec2_public_ipv4']] }.flatten.compact.uniq end diff --git a/lib/leap_cli/macros/nodes.rb b/lib/leap_cli/macros/nodes.rb index 8b961cbc..0e23831d 100644 --- a/lib/leap_cli/macros/nodes.rb +++ b/lib/leap_cli/macros/nodes.rb @@ -11,14 +11,14 @@ module LeapCli # the list of all the nodes # def nodes - global.nodes + env.nodes end # # simple alias for global.provider # def provider - global.provider + env.provider end # -- cgit v1.2.3