Sha256: 4b5180cc6efab54dc4a3cc5ee478b17513f18ec61a00d1cfb6d33f8f20fd3607

Contents?: true

Size: 813 Bytes

Versions: 6

Compression:

Stored size: 813 Bytes

Contents

require_relative 'common'

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

    banner "Upgrades a stack in a grid on Kontena Master"

    parameter "NAME", "Stack name"
    parameter "[FILE]", "Kontena stack file", default: "kontena.yml"
    option '--deploy', :flag, 'Deploy after upgrade'

    requires_current_master
    requires_current_master_token

    def execute
      require_config_file(file)
      stack = stack_from_yaml(file)
      spinner "Upgrading stack #{pastel.cyan(name)} " do
        update_stack(stack)
      end
      Kontena.run("stack deploy #{name}") if deploy?
    end

    def update_stack(stack)
      client.put("stacks/#{current_grid}/#{name}", stack)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kontena-cli-1.0.1.rc1 lib/kontena/cli/stacks/upgrade_command.rb
kontena-cli-1.0.0 lib/kontena/cli/stacks/upgrade_command.rb
kontena-cli-1.0.0.rc2 lib/kontena/cli/stacks/upgrade_command.rb
kontena-cli-1.0.0.rc1 lib/kontena/cli/stacks/upgrade_command.rb
kontena-cli-1.0.0.pre4 lib/kontena/cli/stacks/upgrade_command.rb
kontena-cli-1.0.0.pre3 lib/kontena/cli/stacks/upgrade_command.rb