Class: VagrantRubydns::Action::Setup
- Inherits:
-
Object
- Object
- VagrantRubydns::Action::Setup
- Defined in:
- lib/vagrant-rubydns/action/setup.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Setup
constructor
A new instance of Setup.
- #setup_machine_dns(env) ⇒ Object
- #setup_static_dns(env) ⇒ Object
- #start_server_if_necessary(env) ⇒ Object
Constructor Details
#initialize(app, env) ⇒ Setup
Returns a new instance of Setup.
4 5 6 |
# File 'lib/vagrant-rubydns/action/setup.rb', line 4 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vagrant-rubydns/action/setup.rb', line 8 def call(env) if env[:global_config].rubydns.enabled? DependentVMs.add(env[:machine]) start_server_if_necessary(env) setup_machine_dns(env) setup_static_dns(env) env[:machine].config.vm.provision :rubydns end @app.call(env) end |
#setup_machine_dns(env) ⇒ Object
28 29 30 31 32 |
# File 'lib/vagrant-rubydns/action/setup.rb', line 28 def setup_machine_dns(env) hostname, ip_address = Util.host_and_ip(env[:machine]) env[:ui].info "[rubydns] adding machine entry: #{hostname} => #{ip_address}" Store.hosts.set(hostname, ip_address) end |
#setup_static_dns(env) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/vagrant-rubydns/action/setup.rb', line 34 def setup_static_dns(env) env[:global_config].rubydns.hosts.each do |hostname, ip_address| env[:ui].info "[rubydns] adding static entry: #{hostname} => #{ip_address}" Store.hosts.set hostname, ip_address end end |