lib/rspec-system/node_set/vagrant.rb in rspec-system-1.2.0 vs lib/rspec-system/node_set/vagrant.rb in rspec-system-1.2.1
- old
+ new
@@ -4,10 +4,11 @@
module RSpecSystem
# A NodeSet implementation for Vagrant.
class NodeSet::Vagrant < RSpecSystem::NodeSet::Base
include RSpecSystem::Log
+ include RSpecSystem::Util
ENV_TYPE = 'vagrant'
# Creates a new instance of RSpecSystem::NodeSet::Vagrant
#
@@ -66,11 +67,11 @@
cmd = opts[:c]
ssh_channels = RSpec.configuration.ssh_channels
puts "-----------------"
puts "#{dest}$ #{cmd}"
- result = ssh_exec!(ssh_channels[dest], "cd /tmp && sudo sh -c '#{cmd}'")
+ result = ssh_exec!(ssh_channels[dest], "cd /tmp && sudo sh -c #{shellescape(cmd)}")
puts "-----------------"
result
end
# Transfer files to a host in the NodeSet.
@@ -120,10 +121,10 @@
# @api private
def create_vagrantfile
log.info "[Vagrant#create_vagrantfile] Creating vagrant file here: #{@vagrant_path}"
FileUtils.mkdir_p(@vagrant_path)
File.open(File.expand_path(File.join(@vagrant_path, "Vagrantfile")), 'w') do |f|
- f.write('Vagrant::Config.run do |c|')
+ f.write("Vagrant::Config.run do |c|\n")
nodes.each do |k,v|
log.debug "Filling in content for #{k}"
ps = v.provider_specifics['vagrant']