handle blank usernames / passwords

git-svn-id: file:///home/svn/framework3/trunk@12851 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Jonathan Cran 2011-06-04 03:11:49 +00:00
parent 1c4bf118e8
commit edece92f91
5 changed files with 26 additions and 25 deletions

View File

@ -27,8 +27,8 @@ class RemoteWorkstationDriver < VmDriver
# TODO - Currently only implemented for the first set
if @credentials.count > 0
@vm_user = filter_input(@credentials[0]['user'])
@vm_pass = filter_input(@credentials[0]['pass'])
@vm_user = filter_input(@credentials[0]['user']) || "\'\'"
@vm_pass = filter_input(@credentials[0]['pass']) || "\'\'"
@vm_keyfile = filter_input(@credentials[0]['keyfile'])
end
end

View File

@ -35,8 +35,8 @@ module Drivers
# TODO - Currently only implemented for the first set
if @credentials.count > 0
@vm_user = filter_input(@credentials[0]['user'])
@vm_pass = filter_input(@credentials[0]['pass'])
@vm_user = filter_input(@credentials[0]['user']) || "\'\'"
@vm_pass = filter_input(@credentials[0]['pass']) || "\'\'"
end
end

View File

@ -125,6 +125,7 @@ private
end
def system_command(command)
puts "DEBUG: Running commmand #{command}"
system(command)
end
end

View File

@ -23,58 +23,58 @@ class WorkstationDriver < VmDriver
# TODO - Currently only implemented for the first set
if @credentials.count > 0
@vm_user = filter_input(@credentials[0]['user'])
@vm_pass = filter_input(@credentials[0]['pass'])
@vm_user = filter_input(@credentials[0]['user']) || "\'\'"
@vm_pass = filter_input(@credentials[0]['pass']) || "\'\'"
end
end
def start
system_command("vmrun -T ws start " + "\"#{@location}\"")
system_command("vmrun -T ws start " + "\'#{@location}\'")
end
def stop
system_command("vmrun -T ws stop " + "\"#{@location}\"")
system_command("vmrun -T ws stop " + "\'#{@location}\'")
end
def suspend
system_command("vmrun -T ws suspend " + "\"#{@location}\"")
system_command("vmrun -T ws suspend " + "\'#{@location}\'")
end
def pause
system_command("vmrun -T ws pause " + "\"#{@location}\"")
system_command("vmrun -T ws pause " + "\'#{@location}\'")
end
def reset
system_command("vmrun -T ws reset " + "\"#{@location}\"")
system_command("vmrun -T ws reset " + "\'#{@location}\'")
end
def create_snapshot(snapshot)
snapshot = filter_input(snapshot)
system_command("vmrun -T ws snapshot " + "\"#{@location}\" \"#{snapshot}\"")
system_command("vmrun -T ws snapshot " + "\'#{@location}\' \'#{snapshot}\'")
end
def revert_snapshot(snapshot)
snapshot = filter_input(snapshot)
system_command("vmrun -T ws revertToSnapshot " + "\"#{@location}\" \"#{snapshot}\"")
system_command("vmrun -T ws revertToSnapshot " + "\'#{@location}\' \'#{snapshot}\'")
end
def delete_snapshot(snapshot)
snapshot = filter_input(snapshot)
system_command("vmrun -T ws deleteSnapshot " + "\"#{@location}\" \"#{snapshot}\"" )
system_command("vmrun -T ws deleteSnapshot " + "\'#{@location}\' \'#{snapshot}\'" )
end
def run_command(command)
command = filter_input(command)
vmrunstr = "vmrun -T ws -gu \"#{@vm_user}\" -gp \"#{@vm_pass}\" " +
"runProgramInGuest \"#{@location}\" \"#{command}\""
vmrunstr = "vmrun -T ws -gu \'#{@vm_user}\' -gp \'#{@vm_pass}\' " +
"runProgramInGuest \'#{@location}\' \'#{command}\'"
system_command(vmrunstr)
end
def copy_from(from, to)
from = filter_input(from)
to = filter_input(to)
vmrunstr = "vmrun -T ws -gu \"#{@vm_user}\" -gp \"#{@vm_pass}\" copyFileFromGuestToHost" +
" \"#{@location}\" \"#{from}\" \"#{to}\""
vmrunstr = "vmrun -T ws -gu \'#{@vm_user}\' -gp \'#{@vm_pass}\' copyFileFromGuestToHost" +
" \'#{@location}\' \'#{from}\' \'#{to}\'"
system_command(vmrunstr)
end
@ -82,21 +82,21 @@ class WorkstationDriver < VmDriver
from = filter_input(from)
to = filter_input(to)
vmrunstr = "vmrun -T ws -gu #{@vm_user} -gp #{@vm_pass} copyFileFromHostToGuest" +
" \"#{@location}\" \"#{from}\" \"#{to}\""
" \'#{@location}\' \'#{from}\' \'#{to}\'"
system_command(vmrunstr)
end
def check_file_exists(file)
file = filter_input(file)
vmrunstr = "vmrun -T ws -gu \"#{@vm_user}\" -gp \"#{@vm_pass}\" fileExistsInGuest " +
"\"#{@location}\" \"#{file}\" "
vmrunstr = "vmrun -T ws -gu \'#{@vm_user}\' -gp \'#{@vm_pass}\' fileExistsInGuest " +
"\'#{@location}\' \'#{file}\' "
system_command(vmrunstr)
end
def create_directory(directory)
directory = filter_input(directory)
vmrunstr = "vmrun -T ws -gu \"#{@vm_user}\" -gp \"#{@vm_pass}\" createDirectoryInGuest " +
" \"#{@location}\" \"#{directory}\" "
vmrunstr = "vmrun -T ws -gu \'#{@vm_user}\' -gp \'#{@vm_pass}\' createDirectoryInGuest " +
" \'#{@location}\' \'#{directory}\' "
system_command(vmrunstr)
end

View File

@ -32,8 +32,8 @@ class WorkstationVixrDriver < VmDriver
# TODO - Currently only implemented for the first set
if @credentials.count > 0
@vm_user = filter_input(@credentials[0]['user'])
@vm_pass = filter_input(@credentials[0]['pass'])
@vm_user = filter_input(@credentials[0]['user']) || "\'\'"
@vm_pass = filter_input(@credentials[0]['pass']) || "\'\'"
end
host = VixR.connect()