Created
August 9, 2013 02:34
-
-
Save bodepd/6190728 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| addresses = server.addresses | |
| host = addresses[config.public_network_name].last['addr'] rescue nil | |
| unless host | |
| floating_ips = [] | |
| addresses.each do |net_name, addresses| | |
| Array(addresses).each do |address| | |
| # is OS-EXT-IPS:type part of the API? | |
| floating_ips.push(address['addr']) if address['OS-EXT-IPS:type'] == 'floating' | |
| end | |
| #raise(Exception, 'Did not find any floating ip addresses, cannot login') if floating_ips.size == 0 | |
| #raise(Exception, 'Found more than one floating ip address, confused and failing') if floating_ips.size > 1 | |
| host = floating_ips.last | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment