class Kontena::Cli::Master::Token::CurrentCommand

Public Instance Methods

execute() click to toggle source
# File lib/kontena/cli/master/token/current_command.rb, line 17
def execute
  if self.token?
    puts current_master.token.access_token
    return
  end

  if self.refresh_token?
    if current_master.token.refresh_token
      puts current_master.token.refresh_token
    end
    return
  end

  if self.expires_in?
    if current_master.token.expires_at.to_i > 0
      puts current_master.token.expires_at - Time.now.utc.to_i
    end
    return
  end

  if self.id?
    Kontena.run!(['master', 'token', 'show',  '--id', current_master.token.access_token])
  else
    Kontena.run!(['master', 'token', 'show',  current_master.token.access_token])
  end
end