Sha256: c14cb3f9f23dee17a6734748ca070af68fe828e454fa2bdcc70f0a1c6927c414

Contents?: true

Size: 850 Bytes

Versions: 34

Compression:

Stored size: 850 Bytes

Contents

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

    option ['-A', '--all'], :flag, 'Log out from all masters. By default only log out from current master.'

    def execute
      if self.all?
        config.servers.each do |server|
          use_refresh_token(server)
          server.token = nil
          puts "Logged out of #{pastel.green(server.name)}"
        end
      elsif config.current_master
        use_refresh_token(config.current_master)
        config.current_master.token = nil
        puts "Logged out of #{pastel.green(config.current_master.name)}"
      else
        warn "Current master has not been selected"
        exit 0 # exiting with 0 not 1, it's not really an error situation (kontena logout && kontena master login...)
      end
      config.write
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
krates-1.7.11 lib/kontena/cli/master/logout_command.rb
krates-1.7.10 lib/kontena/cli/master/logout_command.rb
krates-1.7.9 lib/kontena/cli/master/logout_command.rb
krates-1.7.8 lib/kontena/cli/master/logout_command.rb
krates-1.7.7 lib/kontena/cli/master/logout_command.rb
krates-1.7.6 lib/kontena/cli/master/logout_command.rb
krates-1.7.5 lib/kontena/cli/master/logout_command.rb
krates-1.7.4 lib/kontena/cli/master/logout_command.rb
krates-1.7.3 lib/kontena/cli/master/logout_command.rb
krates-1.7.2 lib/kontena/cli/master/logout_command.rb
krates-1.7.1 lib/kontena/cli/master/logout_command.rb
krates-1.7.0 lib/kontena/cli/master/logout_command.rb
krates-1.6.9 lib/kontena/cli/master/logout_command.rb
krates-1.6.8 lib/kontena/cli/master/logout_command.rb
krates-1.6.7 lib/kontena/cli/master/logout_command.rb
krates-1.6.6 lib/kontena/cli/master/logout_command.rb
krates-1.6.5 lib/kontena/cli/master/logout_command.rb
krates-1.6.4 lib/kontena/cli/master/logout_command.rb
krates-1.6.3 lib/kontena/cli/master/logout_command.rb
krates-1.6.2 lib/kontena/cli/master/logout_command.rb