lib/cf/cli/service/create.rb in cf-1.0.1.rc1 vs lib/cf/cli/service/create.rb in cf-1.1.0

- old
+ new

@@ -42,20 +42,16 @@ s.service_plans.include? plan end end end - until offerings.size < 2 - # cast to Array since it might be given as a Service with #invoke - offerings = Array(input[:offering, offerings.sort_by(&:label)]) - input.forget(:offering) - end + selected_offerings = offerings.any? ? Array(input[:offering, offerings.sort_by(&:label)]) : [] - if offerings.empty? + if selected_offerings.empty? fail "Cannot find services matching the given criteria." end - offering = offerings.first + offering = selected_offerings.first service = client.service_instance service.name = input[:name, offering] service.service_plan = input[:plan, offering.service_plans]