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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ConfigureChefProxy

Returns a new instance of ConfigureChefProxy.



9
10
11
# File 'lib/vagrant-proxyconf/action/configure_chef_proxy.rb', line 9

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

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vagrant-proxyconf/action/configure_chef_proxy.rb', line 13

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

  if chef_provisioners(machine).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(machine, config)
  end

  @app.call env
end