def find_cartridge(sought, options={})
debug "Finding cartridge #{sought} in app #{name}"
type = options[:type]
cartridges.each { |cart| return cart if cart.name == sought and (type.nil? or cart.type == type) }
suggested_msg = ""
valid_cartridges = cartridges.select {|c| type.nil? or c.type == type}
unless valid_cartridges.empty?
suggested_msg = "\n\nValid cartridges:"
valid_cartridges.each { |cart| suggested_msg += "\n#{cart.name}" }
end
raise RHC::CartridgeNotFoundException.new("Cartridge #{sought} can't be found in application #{name}.#{suggested_msg}")
end