lib/testlab/provisioners/hosts_file.rb in testlab-1.20.3 vs lib/testlab/provisioners/hosts_file.rb in testlab-1.20.4
- old
+ new
@@ -35,17 +35,24 @@
alias :on_container_destroy :on_container_callback
private
def add_hosts(container)
- @command.exec(<<-EOF)
-set -x
+ script = <<-EOF
cat <<EOI | #{sudo} tee -a /etc/hosts
#{def_tag}
#{hosts_blob(container)}
#{end_tag}
EOI
EOF
+
+ tempfile = Tempfile.new('script')
+ tempfile.write(script)
+ tempfile.flush
+
+ command = %(/bin/bash -x #{tempfile.path})
+
+ @command.exec(command)
end
def remove_hosts
@command.exec(sed_hostsfile)
end