Sha256: 5436e9109065f7732e0b577adcbd21ae21a9e12dc216959909378ea2e5aa5d74

Contents?: true

Size: 949 Bytes

Versions: 22

Compression:

Stored size: 949 Bytes

Contents

module Kontena::Cli::Master
  class UseCommand < Kontena::Command
    include Kontena::Cli::Common

    parameter "[NAME]", "Master name to use"

    option '--clear', :flag, "Clear current master setting"

    def execute
      if clear?
        config.current_master = nil
        config.write
        exit 0
      elsif name.nil?
        signal_usage_error Clamp.message(:parameter_argument_error, :param => 'NAME', :message => "missing")
        exit 1
      end

      master = config.find_server(name)
      if master.nil?
        exit_with_error p"Could not resolve master by name '#{name}'." +
              "\nFor a list of known masters please run: kontena master list"
      else
        config.current_master = master['name']
        config.write
        puts "Using master: #{pastel.cyan(master['name'])} (#{master['url']})"
        puts "Using grid: #{current_grid ? pastel.cyan(current_grid) : "<none>"}"
      end
    end
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kontena-cli-1.3.5 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/master/use_command.rb
kontena-cli-1.4.0.pre6 lib/kontena/cli/master/use_command.rb
kontena-cli-1.4.0.pre5 lib/kontena/cli/master/use_command.rb
kontena-cli-1.4.0.pre4 lib/kontena/cli/master/use_command.rb
kontena-cli-1.4.0.pre3 lib/kontena/cli/master/use_command.rb
kontena-cli-1.4.0.pre2 lib/kontena/cli/master/use_command.rb
kontena-cli-1.4.0.pre1 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.4 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.4.rc1 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.3 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.3.rc1 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.2 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.2.rc2 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.2.rc1 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.1 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.1.rc2 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.1.rc1 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.0 lib/kontena/cli/master/use_command.rb
kontena-cli-1.3.0.rc4 lib/kontena/cli/master/use_command.rb