Sha256: 776d7077462bcb4c5e4e5aaaee98a7456c25f584ef387538847932059effeb52

Contents?: true

Size: 902 Bytes

Versions: 22

Compression:

Stored size: 902 Bytes

Contents

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

    requires_current_master
    requires_current_master_token
    requires_current_grid

    parameter "NODE ...", "Node name", attribute_name: :nodes

    option ["-l", "--label"], "LABEL", "Node label", multivalued: true
    option "--clear-labels", :flag, "Clear node labels"
    option "--availability", "active|drain", "Node scheduling availability"

    def execute
      data = {}

      data[:labels] = self.label_list unless self.label_list.empty?
      data[:labels] = [] if self.clear_labels?

      data[:availability] = availability if availability

      nodes.each do |node_name|
        spinner "Updating node #{pastel.cyan(node_name)} " do
          client.put("nodes/#{current_grid}/#{node_name}", data)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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