Sha256: 6412d078ab857cc475844d7bcd2731c6709d059b83f8a6fa8faf4eece6a733a0
Contents?: true
Size: 826 Bytes
Versions: 22
Compression:
Stored size: 826 Bytes
Contents
module Kontena::Cli::Nodes::DigitalOcean class RestartCommand < Clamp::Command include Kontena::Cli::Common 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
22 entries across 22 versions & 1 rubygems