Sha256: 01720c89287965dd23fcf184eff299cd6904ba954b3b0ac73a427b5fbe939404

Contents?: true

Size: 1.29 KB

Versions: 20

Compression:

Stored size: 1.29 KB

Contents

module Kontena::Cli::Nodes
  class ResetTokenCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    requires_current_master
    requires_current_master_token
    requires_current_grid

    parameter "NODE", "Node name"

    option ["--token"], "TOKEN", "Use given node token instead of generating a random token"
    option ["--clear-token"], :flag, "Clear node token, reverting to grid token"
    option "--[no-]reset-connection", :flag, "Reset agent websocket connection", default: true
    option "--force", :flag, "Force token update"

    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 #{self.node.colorize(:cyan)} 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
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
kontena-cli-1.4.3 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.3.rc1 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.2 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.2.rc1 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.2.pre1 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.1 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.1.rc1 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.1.pre1 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.rc2 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.rc1 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre14 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre13 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre12 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre11 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre10 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre9 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre8 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre7 lib/kontena/cli/nodes/reset_token_command.rb
kontena-cli-1.4.0.pre6 lib/kontena/cli/nodes/reset_token_command.rb