Sha256: db7a326e1fedd012a858c17b991302e6166a6d572db28ae28ef89f874d10151f

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

command :delete do |c|
  c.summary = 'Delete a host in your provider account'
  c.syntax = 'ops delete [DNS_name]'
  c.description = "Delete the host, based on DNS_name, which (not need but) should be described in its #{Ops::HOSTS_DIR}/[DNS_name].yml file  "
  c.example 'Delete the host example.com in your DigitalOcean console', 'ops delete example.com'
  c.action do |args, options|
    cli = DigitalOcean::client
    id = cli.find_droplet_by_name(args[0]).id
    resp = cli.droplets.delete id: id
    if resp.is_a?(TrueClass)
      say "Droplet #{args[0]} succesfully deleted!"
    else
      raise resp
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
open-dock-0.0.12 lib/open-dock/commands/delete_host.rb
open-dock-0.0.11 lib/open-dock/commands/delete_host.rb