Sha256: 0ffe6d71679833f8befbbe9ba3b062b8941a66e9f4215f0b759fc6fc9e75e663
Contents?: true
Size: 1.05 KB
Versions: 12
Compression:
Stored size: 1.05 KB
Contents
module Kontena::Cli::Nodes class RemoveCommand < Kontena::Command include Kontena::Cli::Common include Kontena::Cli::GridOptions parameter "NODE ...", "Node name", attribute_name: :nodes option "--force", :flag, "Force remove", default: false, attribute_name: :forced def execute require_api_url require_current_grid token = require_token nodes.each do |node_name| node = client(token).get("nodes/#{current_grid}/#{node_name}") if node['has_token'] && node['connected'] warning "Node #{node['name']} is still connected using a node token, but will be force-disconnected" elsif node['connected'] exit_with_error "Node #{node['name']} is still connected using a grid token. You must terminate the node before removing it." end confirm_command(node_name) unless forced? spinner "Removing #{pastel.cyan(node_name)} node from #{pastel.cyan(current_grid)} grid " do client(token).delete("nodes/#{node['id']}") end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems