lib/sunzi/cloud/digital_ocean.rb in sunzi-1.3.0 vs lib/sunzi/cloud/digital_ocean.rb in sunzi-1.4.0
- old
+ new
@@ -53,9 +53,10 @@
:image_name => @attributes[:image_name],
}
end
def choose(key, result)
+ abort "no #{key} found!" if result.first.nil?
result.each{|i| say "#{i.id}: #{i.name}" }
@attributes[:"#{key}_id"] = ask("which #{key}?: ", Integer) {|q| q.in = result.map(&:id); q.default = result.first.id }
@attributes[:"#{key}_name"] = result.find{|i| i.id == @attributes[:"#{key}_id"] }.name
end