class Chef::Knife::ScalewayImageDestroy

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/scaleway_image_destroy.rb, line 27
def run
  $stdout.sync = true

  validate!

  unless locate_config_value(:id)
    ui.error('Image ID cannot be empty. => -I <image-id>')
    exit 1
  end

  result = client.images.delete(id: locate_config_value(:id))
  ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
end