Class: VagrantPlugins::Parallels::Action::HandleGuestTools
- Inherits:
-
Object
- Object
- VagrantPlugins::Parallels::Action::HandleGuestTools
- Defined in:
- lib/vagrant-parallels/action/handle_guest_tools.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ HandleGuestTools
constructor
A new instance of HandleGuestTools.
Constructor Details
#initialize(app, env) ⇒ HandleGuestTools
Returns a new instance of HandleGuestTools.
5 6 7 8 |
# File 'lib/vagrant-parallels/action/handle_guest_tools.rb', line 5 def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_parallels::action::handle_guest_tools') end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vagrant-parallels/action/handle_guest_tools.rb', line 10 def call(env) @machine = env[:machine] if !@machine.provider_config.check_guest_tools @logger.info('Not checking Parallels Tools because of configuration') return @app.call(env) end env[:ui].output(I18n.t('vagrant_parallels.actions.vm.handle_guest_tools.checking')) tools_state = parallels_tools_state if tools_state == :installed @logger.info('The proper version of Parallels Tools is already installed') return @app.call(env) elsif tools_state == :outdated env[:ui].warn(I18n.t('vagrant_parallels.actions.vm.handle_guest_tools.outdated')) else env[:ui].warn(I18n.t('vagrant_parallels.actions.vm.handle_guest_tools.not_detected')) end if !@machine.provider_config.update_guest_tools @logger.info('Not updating Parallels Tools because of configuration') return @app.call(env) end # Update/Install Parallels Tools if @machine.guest.capability?(:install_parallels_tools) env[:ui].output(I18n.t('vagrant_parallels.actions.vm.handle_guest_tools.installing')) @machine.guest.capability(:install_parallels_tools) # The VM should be rebooted to enable kernel modules # bundled with Parallels Tools. env[:ui].output(I18n.t('vagrant_parallels.actions.vm.handle_guest_tools.rebooting')) @machine.action(:simple_reboot) else env[:ui].warn(I18n.t('vagrant_parallels.actions.vm.handle_guest_tools.cant_install')) end # Continue @app.call(env) end |