summaryrefslogtreecommitdiff
path: root/lib/leap_cli/macros/hosts.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-03-29 13:27:01 -0700
committerelijah <elijah@riseup.net>2016-04-05 09:52:01 -0700
commiteac3056c237d523f4786593922fe8f88eb65dff7 (patch)
tree4eb33d64139f65aa1444543d72fbe07dc97314ae /lib/leap_cli/macros/hosts.rb
parent90e1d3ec113d2644b659fd6ed9af7d2b94393407 (diff)
testing: adds mx delivery tests
Diffstat (limited to 'lib/leap_cli/macros/hosts.rb')
-rw-r--r--lib/leap_cli/macros/hosts.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/leap_cli/macros/hosts.rb b/lib/leap_cli/macros/hosts.rb
index 8281329f..541bbc13 100644
--- a/lib/leap_cli/macros/hosts.rb
+++ b/lib/leap_cli/macros/hosts.rb
@@ -4,6 +4,24 @@ module LeapCli
module Macro
##
+ ## IPs
+ ##
+
+ #
+ # returns a simple array of all the IPs for the specified node list
+ #
+ def host_ips(node_list)
+ if self.vagrant?
+ node_list = node_list['environment' => 'local']
+ else
+ node_list = node_list['environment' => '!local']
+ end
+ node_list.map {|name, n|
+ [n.ip_address, (global.facts[name]||{})['ec2_public_ipv4']]
+ }.flatten.compact.uniq
+ end
+
+ ##
## HOSTS
##
@@ -48,6 +66,10 @@ module LeapCli
'domain_full' => node.domain.full,
'port' => node.ssh.port
}
+ if node.dns['aliases'] && node.dns['aliases'].any?
+ # include aliases, but without domain.full
+ hosts[node.name]['aliases'] = node.dns['aliases'] - [node.domain.full]
+ end
node_location = node['location'] ? node['location']['name'] : nil
if my_location == node_location
if facts = @node.manager.facts[node.name]