Sha256: a446cdd7720bf633e0c077e51d9ca914c60ddd2c5cbdddcd84a728bc233c91ad

Contents?: true

Size: 670 Bytes

Versions: 5

Compression:

Stored size: 670 Bytes

Contents

module Kontena::Cli::Nodes::Labels
  class RemoveCommand < Kontena::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

5 entries across 5 versions & 1 rubygems

Version Path
kontena-cli-0.16.0.pre5 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.16.0.pre4 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.16.0.pre3 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.16.0.pre2 lib/kontena/cli/nodes/labels/remove_command.rb
kontena-cli-0.16.0.pre1 lib/kontena/cli/nodes/labels/remove_command.rb