lib/testlab/provisioners/bind.rb in testlab-0.9.1 vs lib/testlab/provisioners/bind.rb in testlab-1.0.0
- old
+ new
@@ -18,22 +18,34 @@
@config[:bind][:domain] ||= "default.zone"
@ui.logger.debug { "config(#{@config.inspect})" }
end
- # Bind Provisioner Node Setup
+ # Bind: Node Provision
#
- # @param [TestLab::Node] node The node which we want to provision.
+ # @param [TestLab::Node] node The node that is being provisioned.
# @return [Boolean] True if successful.
- def on_node_setup(node)
+ def on_node_provision(node)
@ui.logger.debug { "BIND Provisioner: Node #{node.id}" }
- bind_setup(node.ssh)
+ bind_provision(node)
true
end
+ # Bind: Network Up
+ #
+ # @param [TestLab::Network] network The network that is being onlined.
+ # @return [Boolean] True if successful.
+ def on_network_up(network)
+ @ui.logger.debug { "BIND Provisioner: Network #{network.id}" }
+
+ bind_reload(network.node)
+
+ true
+ end
+
# Builds the main bind configuration sections
def build_bind_main_partial(file)
bind_conf_template = File.join(TestLab::Provisioner.template_dir, "bind", "bind.erb")
file.puts(ZTK::Template.do_not_edit_notice(:message => "TestLab v#{TestLab::VERSION} BIND Configuration", :char => '//'))
@@ -110,18 +122,18 @@
def bind_install(ssh)
ssh.exec(%(sudo apt-get -y install bind9))
ssh.exec(%(sudo rm -fv /etc/bind/{*.arpa,*.zone,*.conf*}))
end
- def bind_reload(ssh)
- ssh.exec(%(sudo chown -Rv bind:bind /etc/bind))
- ssh.exec(%(sudo rndc reload))
+ def bind_reload(node)
+ node.ssh.exec(%(sudo chown -Rv bind:bind /etc/bind))
+ node.ssh.exec(%(sudo rndc reload))
end
- def bind_setup(ssh)
- bind_install(ssh)
- build_bind_conf(ssh)
- bind_reload(ssh)
+ def bind_provision(node)
+ bind_install(node.ssh)
+ build_bind_conf(node.ssh)
+ bind_reload(node)
end
end
end