sahara 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +1 -5
- data/lib/sahara/session.rb +38 -20
- data/lib/sahara/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,8 +20,4 @@ This is now available as gem:
|
|
20
20
|
|
21
21
|
# Windows Notes
|
22
22
|
|
23
|
-
It works on Windows
|
24
|
-
|
25
|
-
- Vagrant 1.0.x installed (with patch for [issue#817](https://github.com/mitchellh/vagrant/issues/817))
|
26
|
-
- VBoxManage.exe in the PATH <pre>set PATH=C:\Program Files\Oracle\VirtualBox\;%PATH%</pre>
|
27
|
-
- grep.exe and cut.exe in the PATH: <pre>set PATH=D:\vagrant\embedded\bin;%PATH%</pre>
|
23
|
+
It works on Windows with Vagrant 1.0.x installed (with patch for [issue#817](https://github.com/mitchellh/vagrant/issues/817))
|
data/lib/sahara/session.rb
CHANGED
@@ -6,7 +6,24 @@ module Sahara
|
|
6
6
|
module Session
|
7
7
|
|
8
8
|
def self.determine_vboxcmd
|
9
|
-
|
9
|
+
if windows?
|
10
|
+
# On Windows, we use the VBOX_INSTALL_PATH environmental
|
11
|
+
if ENV.has_key?("VBOX_INSTALL_PATH")
|
12
|
+
# The path usually ends with a \ but we make sure here
|
13
|
+
path = File.join(ENV["VBOX_INSTALL_PATH"], "VBoxManage.exe")
|
14
|
+
return "\"#{path}\""
|
15
|
+
end
|
16
|
+
else
|
17
|
+
# for other platforms assume it is on the PATH
|
18
|
+
return "VBoxManage"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.windows?
|
23
|
+
%W[mingw mswin].each do |text|
|
24
|
+
return true if RbConfig::CONFIG["host_os"].downcase.include?(text)
|
25
|
+
end
|
26
|
+
false
|
10
27
|
end
|
11
28
|
|
12
29
|
def self.initialize
|
@@ -65,7 +82,7 @@ module Sahara
|
|
65
82
|
puts "[#{boxname}] - fastforwarding sandbox"
|
66
83
|
|
67
84
|
execute("#{@vboxcmd} snapshot \"#{instance_uuid}\" take \"#{@sandboxname}\" --pause")
|
68
|
-
|
85
|
+
|
69
86
|
end
|
70
87
|
|
71
88
|
end
|
@@ -104,15 +121,15 @@ module Sahara
|
|
104
121
|
config_boot_mode="#{@vagrant_env.vms[boxname.to_sym].config.vm.boot_mode.to_s}"
|
105
122
|
|
106
123
|
case config_boot_mode
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
124
|
+
when 'vrdp'
|
125
|
+
boot_mode='headless'
|
126
|
+
when 'headless'
|
127
|
+
boot_mode='headless'
|
128
|
+
when 'gui'
|
129
|
+
boot_mode='gui'
|
130
|
+
else
|
131
|
+
puts "Vagrantfile config.vm.boot_mode=#{config_boot_mode} setting unknown - defaulting to headless"
|
132
|
+
boot_mode='headless'
|
116
133
|
end
|
117
134
|
|
118
135
|
execute("#{@vboxcmd} startvm --type #{boot_mode} \"#{instance_uuid}\" ")
|
@@ -166,7 +183,8 @@ module Sahara
|
|
166
183
|
|
167
184
|
instance_uuid="#{@vagrant_env.vms[boxname.to_sym].uuid}"
|
168
185
|
snapshotlist=Array.new
|
169
|
-
|
186
|
+
output=execute("#{@vboxcmd} showvminfo --machinereadable \"#{instance_uuid}\"").join
|
187
|
+
snapshotresult=output.scan(/SnapshotName.*=(.*)/).flatten
|
170
188
|
snapshotresult.each do |result|
|
171
189
|
clean=result.gsub(/\"/,'').chomp
|
172
190
|
snapshotlist << clean
|
@@ -180,24 +198,24 @@ module Sahara
|
|
180
198
|
end
|
181
199
|
|
182
200
|
def self.on_selected_vms(selection,&block)
|
183
|
-
|
201
|
+
|
184
202
|
if selection.nil?
|
185
203
|
#puts "no selection was done"
|
186
204
|
@vagrant_env.vms.each do |name,vm|
|
187
205
|
#puts "Processing #{name}"
|
188
206
|
if @vagrant_env.multivm?
|
189
207
|
if name.to_s!="default"
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
208
|
+
if is_vm_created?(name)
|
209
|
+
yield name
|
210
|
+
else
|
211
|
+
puts "[#{name}] - machine not created"
|
212
|
+
end
|
194
213
|
end
|
195
|
-
end
|
196
214
|
else
|
197
215
|
if is_vm_created?(name)
|
198
216
|
yield name
|
199
217
|
else
|
200
|
-
puts "[#{name}] - machine
|
218
|
+
puts "[#{name}] - machine not created"
|
201
219
|
end
|
202
220
|
end
|
203
221
|
end
|
@@ -205,7 +223,7 @@ module Sahara
|
|
205
223
|
if is_vm_created?(selection)
|
206
224
|
yield selection
|
207
225
|
else
|
208
|
-
puts "[#{selection}] - machine
|
226
|
+
puts "[#{selection}] - machine not created"
|
209
227
|
end
|
210
228
|
end
|
211
229
|
end
|
data/lib/sahara/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sahara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 13
|
10
|
+
version: 0.0.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Debois
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-08-21 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|