From 7aef706f86a4a22a85e08a2482c36e500d62331c Mon Sep 17 00:00:00 2001 From: Michelle Tran Date: Fri, 30 Oct 2015 11:33:41 +0000 Subject: [PATCH] Hacky way to get the ips for find droplet --- lib/tugboat/middleware/find_droplet.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/tugboat/middleware/find_droplet.rb b/lib/tugboat/middleware/find_droplet.rb index 0982522..9fb06dd 100644 --- a/lib/tugboat/middleware/find_droplet.rb +++ b/lib/tugboat/middleware/find_droplet.rb @@ -113,10 +113,17 @@ def call(env) end say choice = ask "Please choose a droplet:", :limited_to => choices + for ip_list in found_droplets[choice.to_i].networks.v4 do + if ip_list.type == "private" + private_ip = ip_list.ip_address + elsif ip_list.type == "public" + public_ip = ip_list.ip_address + end + end env["droplet_id"] = found_droplets[choice.to_i].id env["droplet_name"] = found_droplets[choice.to_i].name - env["droplet_ip"] = found_droplets[choice.to_i].ip_address - env["droplet_ip_private"] = found_droplets[choice.to_i].private_ip_address + env["droplet_ip"] = public_ip + env["droplet_ip_private"] = private_ip env["droplet_status"] = found_droplets[choice.to_i].status end