Sha256: 92a31a72d332032dfba106c24eeadc16bf2a8ff57e4902fd933440fc45aab7af

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

require_relative 'common'

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

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kontena-cli-1.0.0.pre2 lib/kontena/cli/stacks/upgrade_command.rb
kontena-cli-1.0.0.pre1 lib/kontena/cli/stacks/upgrade_command.rb