Sha256: 1c5f4c7bb96448ebadce328a090143b799fcbe54eadd82856b29450279362468

Contents?: true

Size: 668 Bytes

Versions: 28

Compression:

Stored size: 668 Bytes

Contents

module Kontena::Cli::Nodes::Labels
  class RemoveCommand < Clamp::Command
    include Kontena::Cli::Common

    parameter "NODE_ID", "Node id"
    parameter "LABEL", "Label"

    def execute
      require_api_url
      require_current_grid
      token = require_token

      node = client(token).get("grids/#{current_grid}/nodes/#{node_id}")
      unless node['labels'].include?(label)
        abort("Node #{node['name']} does not have label #{label}")
      end
      node['labels'].delete(label)
      data = {}
      data[:labels] = node['labels']
      client.put("nodes/#{node['id']}", data, {}, {'Kontena-Grid-Token' => node['grid']['token']})
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
kontena-cli-0.15.5 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.5.rc2 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.5.rc1 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.4 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.4.rc2 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.4.rc1 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.4.pre1 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.3 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.2 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.1 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.0 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.0.rc3 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.0.rc2 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.15.0.rc1 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.14.7 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.14.6 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.14.5 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.14.4 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.14.3 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.14.2 lib/kontena/cli/nodes/labels/remove_command.rb