def scale(cartridge, multiplier)
options.default(:min => Integer(multiplier), :max => Integer(multiplier)) if multiplier rescue raise ArgumentError, "Multiplier must be a positive integer."
raise RHC::MissingScalingValueException unless options.min || options.max
rest_app = find_app(:include => :cartridges)
rest_cartridge = check_cartridges(cartridge, :from => rest_app.cartridges).first
raise RHC::CartridgeNotScalableException unless rest_cartridge.scalable?
warn "This operation will run until the application is at the minimum scale and may take several minutes."
say "Setting scale range for #{rest_cartridge.name} ... "
cart = rest_cartridge.set_scales({
:scales_from => options.min,
:scales_to => options.max
})
success "done"
paragraph{ display_cart(cart) }
0
rescue RHC::Rest::TimeoutException => e
raise unless e.on_receive?
info "The server has closed the connection, but your scaling operation is still in progress. Please check the status of your operation via 'rhc show-app'."
1
end