Class: VagrantPlugins::ProviderVirtualBox::Action::Unmount

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-mount/actions/providers/virtualbox/action/unmount.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Unmount

Returns a new instance of Unmount.



6
7
8
9
# File 'lib/vagrant-mount/actions/providers/virtualbox/action/unmount.rb', line 6

def initialize(app, env)
  @app = app
  @env = env
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-mount/actions/providers/virtualbox/action/unmount.rb', line 11

def call(env)
  if env[:mount_point]
    env[:ui].info(I18n.t('vagrant_mount.actions.vm.unmount.unmounting', mount: env[:mount_point]))
  else
    env[:ui].info(I18n.t('vagrant_mount.actions.vm.unmount.unmounting_all'))
  end
  env[:result] = env[:machine].provider.driver.unmount(env[:mount_point], env[:remove_device])
  if env[:mount_point]
    env[:ui].info(I18n.t('vagrant_mount.actions.vm.unmount.unmounted', mount: env[:mount_point]))
  else
    env[:ui].info(I18n.t('vagrant_mount.actions.vm.unmount.unmounted_all'))
  end
  @app.call(env)
end