Class: VagrantPlugins::Ohai::ActionInstallOhaiPlugin

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/vagrant-ohai/action_install_ohai_plugin.rb

Constant Summary collapse

OHAI_PLUGIN_PATH =
File.expand_path("../../ohai/vagrant.rb", __FILE__)

Instance Method Summary collapse

Methods included from Helpers

#chef_provisioners

Constructor Details

#initialize(app, env) ⇒ ActionInstallOhaiPlugin

Returns a new instance of ActionInstallOhaiPlugin.



10
11
12
13
14
# File 'lib/vagrant-ohai/action_install_ohai_plugin.rb', line 10

def initialize(app, env)
  @app = app
  @env = env
  @machine = env[:machine]
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vagrant-ohai/action_install_ohai_plugin.rb', line 16

def call(env)
  is_chef_used = chef_provisioners.any?
  @app.call(env)
  return unless @machine.communicate.ready?

  if is_chef_used && @machine.config.ohai.enable
    @machine.ui.info("Installing Ohai plugin")
    create_ohai_folders
    copy_ohai_plugin
  end
end