class TestLab class Provisioner # HostsFile Provisioner Error Class class HostsFileError < ProvisionerError; end # HostsFile Provisioner Class # # @author Zachary Patten class HostsFile include TestLab::Utility::Misc def initialize(config={}, ui=nil) @config = (config || Hash.new) @ui = (ui || TestLab.ui) @command = ZTK::Command.new(:ui => @ui, :silence => true, :ignore_exit_status => true) @ui.logger.debug { "config(#{@config.inspect})" } end # HostsFile: Container Provision def on_container_callback(container) remove_hosts add_hosts(container) true end alias :on_container_create :on_container_callback alias :on_container_up :on_container_callback alias :on_container_provision :on_container_callback alias :on_container_deprovision:on_container_callback alias :on_container_down :on_container_callback alias :on_container_destroy :on_container_callback private def add_hosts(container) script = <<-EOF cat <