class Kontena::Cli::Apps::ScaleCommand

Attributes

services[R]

Public Instance Methods

execute() click to toggle source
# File lib/kontena/cli/apps/scale_command.rb, line 17
def execute
  require_config_file(filename)
  yml_service = services_from_yaml(filename, [service], service_prefix, true)
  if yml_service[service]
    options = yml_service[service]
    exit_with_error("Service has already instances defined in #{filename}. Please update #{filename} and deploy service instead") if options['instances']
    spinner "Scaling #{service.colorize(:cyan)} " do
      deployment = scale_service(require_token, prefixed_name(service), instances)
      wait_for_deploy_to_finish(token, deployment)
    end

  else
    exit_with_error("Service not found")
  end
end