Class: VagrantPlugins::DnsConf::Action::ConfigureDNS

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ConfigureDNS

Returns a new instance of ConfigureDNS.



8
9
10
11
12
13
# File 'lib/vagrant-dnsconf/action.rb', line 8

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

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
         return unless @config.is_set?

         logger = Log4r::Logger.new('vagrant::dnsconf')
  opts = {replaces: @config.replaces, deletes: @config.deletes}

  @ui.info "setting dns configuration"
         logger.debug "dnsconf #{opts[:replaces]}, #{opts[:deletes]}"
  @machine.guest.capability(:set_dnsconf, opts)

         @app.call(env)
end