lib/testlab/provisioners/apt_cacher_ng.rb in testlab-0.9.1 vs lib/testlab/provisioners/apt_cacher_ng.rb in testlab-1.0.0

- old
+ new

@@ -17,19 +17,20 @@ @config[:apt] ||= Hash.new @config[:apt][:cacher_ng] ||= Hash.new @config[:apt][:cacher_ng][:exclude_hosts] ||= Array.new @apt_conf_d_proxy_file_template = File.join(TestLab::Provisioner.template_dir, "apt_cacher_ng", "00proxy.erb") + @apt_cacher_ng_security_conf_template = File.join(TestLab::Provisioner.template_dir, "apt_cacher_ng", "security.conf.erb") @ui.logger.debug { "config(#{@config.inspect})" } end - # APT-CacherNG Provisioner Node Setup + # APT-CacherNG: Node Provision # # @param [TestLab::Node] node The node which we want to provision. # @return [Boolean] True if successful. - def on_node_setup(node) + def on_node_provision(node) @ui.logger.debug { "APT-CacherNG Provisioner: Node #{node.id}" } bootstrap_template = File.join(TestLab::Provisioner.template_dir, "apt_cacher_ng", "bootstrap.erb") node.ssh.bootstrap(ZTK::Template.render(bootstrap_template, @config)) @@ -45,18 +46,25 @@ apt_conf_d_proxy_file = %(/etc/apt/apt.conf.d/00proxy) node.ssh.file(:target => apt_conf_d_proxy_file, :chown => "root:root", :chmod => "0644") do |file| file.puts(ZTK::Template.render(@apt_conf_d_proxy_file_template, context)) end + apt_cacher_ng_security_conf_file = %(/etc/apt-cacher-ng/security.conf) + node.ssh.file(:target => apt_cacher_ng_security_conf_file, :chown => "root:root", :chmod => "0644") do |file| + file.puts(ZTK::Template.render(@apt_cacher_ng_security_conf_template, context)) + end + + node.ssh.exec(%(sudo service apt-cacher-ng restart)) + true end - # APT-CacherNG Provisioner Container Setup + # APT-CacherNG: Container Provision # # @param [TestLab::Container] container The container which we want to # provision. # @return [Boolean] True if successful. - def on_container_setup(container) + def on_container_provision(container) @ui.logger.debug { "APT-CacherNG Provisioner: Container #{container.id}" } # Ensure the container APT calls use apt-cacher-ng on the node gateway_ip = container.primary_interface.network.ip apt_conf_d_proxy_file = %(/etc/apt/apt.conf.d/00proxy)