Skip to content

Loading…

Quick fix for Windows when using Vagrant 1.0.1 #1

Merged
merged 1 commit into from

2 participants

@tknerr

just tried to use sahara on Windows after bumping the versions: had to fix quoting in the commandline to make it work at all. you still need to have VBoxManage and grep / cut in the PATH (see README)

@temsa temsa merged commit 8985647 into temsa:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2012
  1. @tknerr
Showing with 17 additions and 9 deletions.
  1. +9 −1 README.md
  2. +8 −8 lib/sahara/session.rb
View
10 README.md
@@ -16,4 +16,12 @@ Many kudos go to the creators of [vagrant](http://vagrantup.com)
This is now available as gem:
-<pre>gem install sahara</pre>
+<pre>gem install sahara</pre>
+
+# Windows Notes
+
+It works on Windows, but you need to have:
+
+- Vagrant 1.0.x installed (with patch for [issue#817](https://github.com/mitchellh/vagrant/issues/817))
+- VBoxManage.exe in the PATH <pre>set PATH=C:\Program Files\Oracle\VirtualBox\;%PATH%</pre>
+- grep.exe and cut.exe in the PATH: <pre>set PATH=D:\vagrant\embedded\bin;%PATH%</pre>
View
16 lib/sahara/session.rb
@@ -40,7 +40,7 @@ def self.on(selection)
#Creating a snapshot
puts "[#{boxname}] - Enabling sandbox"
- execute("#{@vboxcmd} snapshot '#{instance_uuid}' take '#{@sandboxname}' --pause")
+ execute("#{@vboxcmd} snapshot \"#{instance_uuid}\" take \"#{@sandboxname}\" --pause")
end
end
@@ -59,12 +59,12 @@ def self.commit(selection)
#Discard snapshot so current state is the latest state
puts "[#{boxname}] - unwinding sandbox"
- execute("#{@vboxcmd} snapshot '#{instance_uuid}' delete '#{@sandboxname}'")
+ execute("#{@vboxcmd} snapshot \"#{instance_uuid}\" delete \"#{@sandboxname}\"")
#Now retake the snapshot
puts "[#{boxname}] - fastforwarding sandbox"
- execute("#{@vboxcmd} snapshot '#{instance_uuid}' take '#{@sandboxname}' --pause")
+ execute("#{@vboxcmd} snapshot \"#{instance_uuid}\" take \"#{@sandboxname}\" --pause")
end
@@ -85,7 +85,7 @@ def self.rollback(selection)
puts "[#{boxname}] - powering off machine"
#Poweroff machine
- execute("#{@vboxcmd} controlvm '#{instance_uuid}' poweroff")
+ execute("#{@vboxcmd} controlvm \"#{instance_uuid}\" poweroff")
#Poweroff takes a second or so to complete; Virtualbox will throw errors
#if you try to restore a snapshot before it's ready.
@@ -94,7 +94,7 @@ def self.rollback(selection)
puts "[#{boxname}] - roll back machine"
#Rollback until snapshot
- execute("#{@vboxcmd} snapshot '#{instance_uuid}' restore '#{@sandboxname}'")
+ execute("#{@vboxcmd} snapshot \"#{instance_uuid}\" restore \"#{@sandboxname}\"")
puts "[#{boxname}] - starting the machine again"
@@ -115,7 +115,7 @@ def self.rollback(selection)
boot_mode='headless'
end
- execute("#{@vboxcmd} startvm --type #{boot_mode} '#{instance_uuid}' ")
+ execute("#{@vboxcmd} startvm --type #{boot_mode} \"#{instance_uuid}\" ")
end
@@ -140,7 +140,7 @@ def self.off(selection)
# We might wanna check for sandbox changes or not
#Discard snapshot
- execute("#{@vboxcmd} snapshot '#{instance_uuid}' delete '#{@sandboxname}' ")
+ execute("#{@vboxcmd} snapshot \"#{instance_uuid}\" delete \"#{@sandboxname}\" ")
end
@@ -166,7 +166,7 @@ def self.list_snapshots(boxname)
instance_uuid="#{@vagrant_env.vms[boxname.to_sym].uuid}"
snapshotlist=Array.new
- snapshotresult=execute("#{@vboxcmd} showvminfo --machinereadable '#{instance_uuid}' |grep ^SnapshotName| cut -d '=' -f 2")
+ snapshotresult=execute("#{@vboxcmd} showvminfo --machinereadable \"#{instance_uuid}\" |grep ^SnapshotName| cut -d '=' -f 2")
snapshotresult.each do |result|
clean=result.gsub(/\"/,'').chomp
snapshotlist << clean
Something went wrong with that request. Please try again.