Sha256: 3632d983fc8523dc7deccf6e53e644a46257d027d39b0acbd802957428aa89d4
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'log4r' require 'fog/arubacloud/error' module VagrantPlugins module ArubaCloud module Action # This deletes the running server, if there is one. class DeleteServer def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_arubacloud::action::delete_server') end def call(env) if env[:machine].id config = env[:machine].provider_config arubacloud_dc = config.endpoint env[:ui].info(" [#{arubacloud_dc}] " + I18n.t('vagrant_arubacloud.deleting_server')) # On fog side, get will call get_service_details, I must be sure # that the returned object has the "id" parameters not nil server = env[:arubacloud_compute].servers.get(env[:machine].id) begin server.delete rescue Fog::ArubaCloud::Errors::VmStatus env[:ui].warn(I18n.t('vagrant_arubacloud.bad_state')) end env[:machine].id = nil end @app.call(env) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems