summaryrefslogtreecommitdiff
path: root/lib/leap_cli/macros
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-04-08 10:41:54 -0700
committerelijah <elijah@riseup.net>2016-04-08 10:41:54 -0700
commit82b15a8a071ba099cf52bb00c66caebdbd265273 (patch)
tree3f27b0673839be7d10ed5b401216ab79e43ce751 /lib/leap_cli/macros
parent44666c42ce836fb611dfd9c1b549e955c470814c (diff)
parenteac3056c237d523f4786593922fe8f88eb65dff7 (diff)
Merge branch 'feature/mxtest' into develop
Diffstat (limited to 'lib/leap_cli/macros')
-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]