Sha256: 0754b43ed4041f5edb76456dce9c65c97b0e59fbce8e698240ae899e609fd328

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 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"

    include Common::StackFileOrNameParam
    include Common::StackValuesFromOption

    option '--deploy', :flag, 'Deploy after upgrade'

    requires_current_master
    requires_current_master_token

    def execute
      require_config_file(filename)
      stack = stack_from_yaml(filename, name: name, values: values, from_registry: from_registry)
      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

1 entries across 1 versions & 1 rubygems

Version Path
kontena-cli-1.1.0.rc1 lib/kontena/cli/stacks/upgrade_command.rb