class TestLab::Provisioner::Resolv
Resolv
Provisioner
Class
@author Zachary Patten <zachary AT jovelabs DOT com>
Public Class Methods
new(config={}, ui=nil)
click to toggle source
# File lib/testlab/provisioners/resolv.rb, line 13 def initialize(config={}, ui=nil) @config = (config || Hash.new) @ui = (ui || TestLab.ui) @config[:resolv] ||= Hash.new @config[:resolv][:servers] ||= Array.new @config[:resolv][:servers].unshift([TestLab::Network.ips]).flatten!.compact! @config[:resolv][:search] ||= Array.new @config[:resolv][:search].unshift([TestLab::Container.domains]).flatten!.compact! @ui.logger.debug { "config(#{@config.inspect})" } end
Public Instance Methods
on_container_provision(container)
click to toggle source
Resolv: Container
Provision
@param [TestLab::Container] container The container which we want to
provision.
@return [Boolean] True if successful.
# File lib/testlab/provisioners/resolv.rb, line 50 def on_container_provision(container) @ui.logger.debug { "RESOLV Provisioner: Container #{container.id}" } @config[:resolv].merge!( :object => :container ) script = ZTK::Template.render(provision_template, @config) container.lxc.attach(%(-- /bin/bash -c '#{script}')) true end
Also aliased as: on_container_up
on_node_provision(node)
click to toggle source
Resolv: Node
Provision
@param [TestLab::Node] node The node which we want to provision. @return [Boolean] True if successful.
# File lib/testlab/provisioners/resolv.rb, line 32 def on_node_provision(node) @ui.logger.debug { "RESOLV Provisioner: Node #{node.id}" } @config[:resolv].merge!( :servers => %w(127.0.0.1), :object => :node ) node.bootstrap(ZTK::Template.render(provision_template, @config)) true end
Private Instance Methods
provision_template()
click to toggle source
# File lib/testlab/provisioners/resolv.rb, line 66 def provision_template File.join(TestLab::Provisioner.template_dir, 'resolv', 'provision.erb') end