Class: VagrantPlugins::Utm::Action::CheckGuestAdditions

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_utm/action/check_guest_additions.rb

Overview

This action checks if the guest additions are installed. Currently only check’s if qemu-guest-agent is installed and running. TODO: Add other checks, Drivers(eg Virt), SPICE Agent, SPICE WebDAV, VirtFS

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ CheckGuestAdditions

Returns a new instance of CheckGuestAdditions.



12
13
14
15
# File 'lib/vagrant_utm/action/check_guest_additions.rb', line 12

def initialize(app, _env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant_utm::action::check_guest_additions")
end

Instance Method Details

#call(env) ⇒ Object

rubocop:disable Metrics/AbcSize



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vagrant_utm/action/check_guest_additions.rb', line 17

def call(env) # rubocop:disable Metrics/AbcSize
  unless env[:machine].provider_config.check_guest_additions
    @logger.info("Not checking guest additions because configuration")
    return @app.call(env)
  end

  env[:ui].output(I18n.t("vagrant_utm.utm.checking_guest_additions"))

  if env[:machine].provider.driver.check_qemu_guest_agent
    env[:ui].detail(I18n.t("vagrant_utm.actions.vm.check_guest_additions.detected"))
  else
    env[:ui].detail(I18n.t("vagrant_utm.actions.vm.check_guest_additions.not_detected"))
  end

  # Continue
  @app.call(env)
end