Sha256: 5f32b33cbd1be6466b7c826ba74bc03a513843fac77a72d315d47e9792b12bd1

Contents?: true

Size: 959 Bytes

Versions: 11

Compression:

Stored size: 959 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Stacks
  class InstallCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Common

    banner "Installs a stack to a grid on Kontena Master"

    include Common::StackFileOrNameParam

    include Common::StackNameOption
    option '--[no-]deploy', :flag, 'Trigger deploy after installation', default: true

    include Common::StackValuesToOption
    include Common::StackValuesFromOption

    requires_current_master
    requires_current_master_token

    def execute
      stack = stack_read_and_dump(filename, name: name, values: values)

      stack['name'] = name if name
      spinner "Creating stack #{pastel.cyan(stack['name'])} " do
        create_stack(stack)
      end
      Kontena.run("stack deploy #{stack['name']}") if deploy?
    end

    def create_stack(stack)
      client.post("grids/#{current_grid}/stacks", stack)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kontena-cli-1.2.2 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.2.rc2 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.2.rc1 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.1 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.1.rc1 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.0 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.0.rc3 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.0.rc2 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.0.rc1 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.0.pre3 lib/kontena/cli/stacks/install_command.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/stacks/install_command.rb