Sha256: 02508bc8a495ff1af9a8478a5bf4f4c858b57449e0380ae084c7a2dcb993e0b8
Contents?: true
Size: 864 Bytes
Versions: 18
Compression:
Stored size: 864 Bytes
Contents
module Kontena::Cli::Nodes::DigitalOcean class RestartCommand < Clamp::Command include Kontena::Cli::Common include Kontena::Cli::GridOptions parameter "NAME", "Node name" option "--token", "TOKEN", "DigitalOcean API token", required: true def execute require_api_url require_current_grid require 'kontena/machine/digital_ocean' client = DropletKit::Client.new(access_token: token) droplet = client.droplets.all.find{|d| d.name == name} if droplet ShellSpinner "Restarting DigitalOcean droplet #{name.colorize(:cyan)} " do client.droplet_actions.reboot(droplet_id: droplet.id) sleep 5 until client.droplets.find(id: droplet.id).status == 'active' end else abort "Cannot find droplet #{name.colorize(:cyan)} in DigitalOcean" end end end end
Version data entries
18 entries across 18 versions & 1 rubygems