class Kontena::Plugin::Cloud::Node::RebootCommand

Public Instance Methods

default_organization() click to toggle source
# File lib/kontena/plugin/cloud/node/reboot_command.rb, line 28
def default_organization
  unless current_master
    exit_with_error "Organization is required"
  end
  org, _ = parse_platform_name(current_master.name)
  org
end
execute() click to toggle source
# File lib/kontena/plugin/cloud/node/reboot_command.rb, line 15
def execute
  node = find_node(name)
  exit_with_error "Node not found" unless node
  spinner "Sending reboot request to #{pastel.cyan(name)}" do
    compute_client.post("/organizations/#{self.organization}/nodes/#{node.dig('id')}/reboot", {})
  end
end
find_node(name) click to toggle source
# File lib/kontena/plugin/cloud/node/reboot_command.rb, line 23
def find_node(name)
  nodes = compute_client.get("/organizations/#{self.organization}/nodes")['data']
  nodes.find { |n| n.dig('attributes', 'name') == name }
end