vmserver 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/vmserver.rb +10 -10
- data/vmserver.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
data/lib/vmserver.rb
CHANGED
@@ -152,7 +152,7 @@ class VMServer
|
|
152
152
|
|
153
153
|
def mkdir(dir)
|
154
154
|
command = 'createDirectoryInGuest'
|
155
|
-
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}"
|
155
|
+
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" "#{dir}"}
|
156
156
|
log vm_command
|
157
157
|
result = system(vm_command)
|
158
158
|
result ? log("Directory created successfully in guest.") : log("Error! Directory could not be created.")
|
@@ -165,7 +165,7 @@ class VMServer
|
|
165
165
|
|
166
166
|
def rmdir(dir)
|
167
167
|
command = 'deleteDirectoryInGuest'
|
168
|
-
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}"
|
168
|
+
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" "#{dir}"}
|
169
169
|
log vm_command
|
170
170
|
result = system(vm_command)
|
171
171
|
result ? log("Directory deleted successfully.") : log("Error! Failed to delete directory.")
|
@@ -178,7 +178,7 @@ class VMServer
|
|
178
178
|
|
179
179
|
def rmfile(file)
|
180
180
|
command = 'deleteFileInGuest'
|
181
|
-
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}"
|
181
|
+
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" "#{file}"}
|
182
182
|
log vm_command
|
183
183
|
result = system(vm_command)
|
184
184
|
result ? log("File deleted successfully.") : log("Error! Failed to delete file.")
|
@@ -191,7 +191,7 @@ class VMServer
|
|
191
191
|
|
192
192
|
def ls(dir)
|
193
193
|
command = 'listDirectoryInGuest'
|
194
|
-
entries = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \
|
194
|
+
entries = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \"#{@datastore}\" \"#{dir}\"`
|
195
195
|
# The entries would be a list of entries separated by new line. Convert this to an array.
|
196
196
|
entries = entries.split("\n")
|
197
197
|
entries
|
@@ -202,7 +202,7 @@ class VMServer
|
|
202
202
|
# Checks if a file exists in the guest OS
|
203
203
|
|
204
204
|
def file_exists_in_guest?(file)
|
205
|
-
output = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} fileExistsInGuest "#{datastore}"
|
205
|
+
output = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} fileExistsInGuest "#{datastore}" "#{file}"`
|
206
206
|
# output = system(vm_command)
|
207
207
|
if output =~ /The file exists/
|
208
208
|
return true
|
@@ -217,7 +217,7 @@ class VMServer
|
|
217
217
|
|
218
218
|
def copy_file_from_host_to_guest(src, dest)
|
219
219
|
command = 'copyFileFromHostToGuest'
|
220
|
-
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}"
|
220
|
+
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" "#{src}" "#{dest}"}
|
221
221
|
log vm_command
|
222
222
|
result = system(vm_command)
|
223
223
|
result ? log("Copy successful.") : log("Error! Copy failed.")
|
@@ -230,7 +230,7 @@ class VMServer
|
|
230
230
|
|
231
231
|
def copy_file_from_guest_to_host(src,dest)
|
232
232
|
command = 'copyFileFromGuestToHost'
|
233
|
-
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}"
|
233
|
+
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" "#{src}" "#{dest}"}
|
234
234
|
log vm_command
|
235
235
|
result = system(vm_command)
|
236
236
|
result ? log("Copy successful.") : log("Error! Copy failed.")
|
@@ -243,7 +243,7 @@ class VMServer
|
|
243
243
|
|
244
244
|
def get_processes_in_guest
|
245
245
|
command = 'listProcessesInGuest'
|
246
|
-
processes = `#{@base_command} -gu #{@guest_user} -gp #{guest_password} #{command} \
|
246
|
+
processes = `#{@base_command} -gu #{@guest_user} -gp #{guest_password} #{command} \"#{@datastore}\"`
|
247
247
|
processes
|
248
248
|
end
|
249
249
|
|
@@ -254,7 +254,7 @@ class VMServer
|
|
254
254
|
def run_program_in_guest(program,prog_args={})
|
255
255
|
command = 'runProgramInGuest'
|
256
256
|
prog_args = prog_args[:prog_args]
|
257
|
-
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" -activeWindow
|
257
|
+
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" -activeWindow "#{program}" #{prog_args}}
|
258
258
|
log vm_command
|
259
259
|
result = system(vm_command)
|
260
260
|
result ? log("Program executed successfully in guest.") : log("Error! Failed to execute program in guest.")
|
@@ -280,7 +280,7 @@ class VMServer
|
|
280
280
|
|
281
281
|
def capture_screen(output_file)
|
282
282
|
command = 'captureScreen'
|
283
|
-
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}"
|
283
|
+
vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" "#{output_file}"}
|
284
284
|
log vm_command
|
285
285
|
result = system(vm_command)
|
286
286
|
result ? log("File deleted successfully.") : log("Error! Failed to delete file.")
|
data/vmserver.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 6
|
10
|
+
version: 0.3.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sriram Varahan
|