class Kontena::Cli::Nodes::ResetTokenCommand

Public Instance Methods

execute() click to toggle source
# File lib/kontena/cli/nodes/reset_token_command.rb, line 17
def execute
  confirm("Resetting the node token will disconnect the agent (unless using --no-reset-connection), and require you to reconfigure the kontena-agent using the new `kontena node env` values before it will be able to reconnect. Are you sure?")

  spinner "Resetting node #{pastel.cyan(self.node)} websocket connection token" do
    if self.clear_token?
      client.delete("nodes/#{current_grid}/#{self.node}/token",
        reset_connection: self.reset_connection?,
      )
    else
      client.put("nodes/#{current_grid}/#{self.node}/token",
        token: self.token,
        reset_connection: self.reset_connection?,
      )
    end
  end
end