Class: VagrantPlugins::WinAzure::Action::StopInstance
- Inherits:
-
Object
- Object
- VagrantPlugins::WinAzure::Action::StopInstance
- Defined in:
- lib/vagrant-azure/action/stop_instance.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ StopInstance
constructor
A new instance of StopInstance.
Constructor Details
#initialize(app, env) ⇒ StopInstance
Returns a new instance of StopInstance.
12 13 14 15 |
# File 'lib/vagrant-azure/action/stop_instance.rb', line 12 def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_azure::action::stop_instance') end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vagrant-azure/action/stop_instance.rb', line 17 def call(env) if env[:machine].state.id == :StoppedDeallocated env[:ui].info( I18n.t('vagrant_azure.already_status', :status => 'stopped.') ) else env[:machine].id =~ /@/ env[:ui].info( I18n.t( 'vagrant_azure.stopping', :vm_name => $`, :cloud_service_name => $' ) ) env[:azure_vm_service].shutdown_virtual_machine($`, $') end @app.call(env) end |