Class: VagrantPlugins::ProxyConf::Action::ConfigureChefProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-proxyconf/action/configure_chef_proxy.rb

Overview

Action for configuring Chef provisioners

Constant Summary collapse

CHEF_PROVISIONER_TYPES =

Array of Chef provisioner types which include proxy configuration

[:chef_client, :chef_solo, :chef_zero]

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ConfigureChefProxy

Returns a new instance of ConfigureChefProxy.



13
14
15
# File 'lib/vagrant-proxyconf/action/configure_chef_proxy.rb', line 13

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

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant-proxyconf/action/configure_chef_proxy.rb', line 17

def call(env)
  @machine = env[:machine]

  if chef_provisioners.empty?
    logger.info I18n.t("vagrant_proxyconf.chef_proxy.no_provisioners")
  elsif !config.enabled?
    logger.info I18n.t("vagrant_proxyconf.chef_proxy.not_enabled")
  else
    env[:ui].info I18n.t("vagrant_proxyconf.chef_proxy.configuring")
    configure_chef_provisioners
  end

  @app.call env
end