Class: VagrantPlugins::HostsProvisioner::Action::Add

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-servant-hosts-provisioner/action/add.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Add

Returns a new instance of Add.



6
7
8
9
10
# File 'lib/vagrant-servant-hosts-provisioner/action/add.rb', line 6

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

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/vagrant-servant-hosts-provisioner/action/add.rb', line 12

def call(env)
  @config.vm.provisioners.each do |provisioner|
    if provisioner.name == :hostsupdate
      Hosts.new(@machine, provisioner.config).add
    end
  end
  @app.call(env)
end