Class: VagrantPlugins::NiftyCloud::Action::SuspendInstance
- Inherits:
-
Object
- Object
- VagrantPlugins::NiftyCloud::Action::SuspendInstance
- Defined in:
- lib/vagrant-niftycloud/action/suspend_instance.rb
Overview
This suspend the running instance.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ SuspendInstance
constructor
A new instance of SuspendInstance.
Constructor Details
#initialize(app, env) ⇒ SuspendInstance
Returns a new instance of SuspendInstance.
9 10 11 12 |
# File 'lib/vagrant-niftycloud/action/suspend_instance.rb', line 9 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_niftycloud::action::suspend_instance") end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vagrant-niftycloud/action/suspend_instance.rb', line 14 def call(env) # 例外の定義は以下参照 # http://cloud.nifty.com/api/sdk/rdoc/ begin env[:niftycloud_compute].stop(env) @app.call(env) rescue NIFTY::ConfigurationError => e raise Errors::NiftyCloudConfigurationError, :message => e. rescue NIFTY::ArgumentError => e raise Errors::NiftyCloudArgumentError, :message => e. rescue NIFTY::ResponseFormatError => e raise Errors::NiftyCloudResponseFormatError, :message => e. rescue NIFTY::ResponseError => e raise Errors::NiftyCloudResponseError, :code => e.error_code, :message => e. ui.error("Could not locate server '#{env[:machine].id}'. Please verify it was provisioned in the current zone.") end end |