Sha256: ce48d66b0f15f009539edd69626ec08953efc64a6ef6f59219fe20d8954e3548

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require_relative 'common'

module Kontena::Cli::Apps
  class ScaleCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Common

    option ['-f', '--file'], 'FILE', 'Specify an alternate Kontena compose file', attribute_name: :filename, default: 'kontena.yml'
    option ['-p', '--project-name'], 'NAME', 'Specify an alternate project name (default: directory name)'

    parameter "SERVICE", "Service to show"
    parameter "INSTANCES", "Scales service to given number of instances"

    attr_reader :services

    def execute
      require_config_file(filename)
      yml_service = services_from_yaml(filename, [service], service_prefix)
      if yml_service[service]
        options = yml_service[service]
        abort("Service has already instances defined in #{filename}. Please update #{filename} and deploy service instead") if options['container_count']
        scale_service(require_token, prefixed_name(service), instances)
      else
        abort("Service not found")
      end
    end


  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kontena-cli-0.16.0.pre5 lib/kontena/cli/apps/scale_command.rb
kontena-cli-0.16.0.pre4 lib/kontena/cli/apps/scale_command.rb
kontena-cli-0.16.0.pre3 lib/kontena/cli/apps/scale_command.rb
kontena-cli-0.16.0.pre2 lib/kontena/cli/apps/scale_command.rb
kontena-cli-0.16.0.pre1 lib/kontena/cli/apps/scale_command.rb