Class: Chef::Knife::DigitalOceanDropletDestroy

Inherits:
Chef::Knife
  • Object
show all
Includes:
DigitalOceanBase
Defined in:
lib/chef/knife/digital_ocean_droplet_destroy.rb

Instance Method Summary collapse

Methods included from DigitalOceanBase

#client, #h, included, load_deps, #locate_config_value, #validate!

Instance Method Details

#runObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/chef/knife/digital_ocean_droplet_destroy.rb', line 27

def run
  $stdout.sync = true

  validate!

  unless locate_config_value(:server)
    ui.error("Server cannot be empty. ALL DATA WILL BE LOST! => -S <server-id>")
    exit 1
  end

  result = client.droplets.delete locate_config_value(:server)
  puts result.status
end