summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-04-08 12:41:45 -0700
committerelijah <elijah@riseup.net>2016-04-08 12:41:45 -0700
commite4f786e229c101cb60626ce23e671c5258466724 (patch)
tree40dadd2472462c05e731c7685db819d40b18c026 /lib
parent8dfb90f0ea7364f43669fe2105c6a031066b468f (diff)
partials - add support for leap_cli's inheritable service partials (requires latest develop branch leap_cli)
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/macros/core.rb9
-rw-r--r--lib/leap_cli/macros/hosts.rb2
-rw-r--r--lib/leap_cli/macros/nodes.rb4
3 files changed, 10 insertions, 5 deletions
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
#