Module: Rackspace::Scaling::CmdUtil
- Defined in:
- lib/rackspace-scaling/cmd_util.rb
Instance Method Summary collapse
Instance Method Details
#find_image_by_name(name, images) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rackspace-scaling/cmd_util.rb', line 19 def find_image_by_name(name, images) images.sort!{ |a, b| b['created'] <=> a['created']} found_image = nil images.each do |image| if(image['name'] == name) found_image = image break end end found_image end |
#find_instance_by_ip(target_ip, server_list) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rackspace-scaling/cmd_util.rb', line 5 def find_instance_by_ip(target_ip, server_list) server_list.each do |server| server['addresses'].each do |k, v| v.each do |ip| if(ip['addr'] == target_ip) return server end end end end nil end |