vmserver 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.textile +31 -0
- data/Rakefile.rb +17 -0
- data/VERSION +1 -0
- data/doc/classes/VMServer.html +349 -0
- data/doc/classes/VMServer.src/M000001.html +22 -0
- data/doc/classes/VMServer.src/M000002.html +18 -0
- data/doc/classes/VMServer.src/M000003.html +24 -0
- data/doc/classes/VMServer.src/M000004.html +23 -0
- data/doc/classes/VMServer.src/M000005.html +23 -0
- data/doc/classes/VMServer.src/M000006.html +23 -0
- data/doc/classes/VMServer.src/M000007.html +23 -0
- data/doc/classes/VMServer.src/M000008.html +20 -0
- data/doc/classes/VMServer.src/M000009.html +24 -0
- data/doc/classes/VMServer.src/M000010.html +23 -0
- data/doc/created.rid +1 -0
- data/doc/files/Rakefile_rb.html +110 -0
- data/doc/files/lib/vmserver_rb.html +101 -0
- data/doc/fr_class_index.html +27 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +36 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/vmserver.rb +122 -0
- data/vmserver.gemspec +61 -0
- metadata +91 -0
data/.gitignore
ADDED
data/README.textile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
h1. A gem to simplify interaction with VMServer.
|
2
|
+
|
3
|
+
Let's see how to configure and use the gem.
|
4
|
+
Place all your configuartion in the initialize block.
|
5
|
+
Now interacting with VMServer should be a piece of cake :)
|
6
|
+
|
7
|
+
|
8
|
+
bc. vmserver = VMServer.new do |vm|
|
9
|
+
vm.host = 'https://xx.xx.xx.xx:8333/sdk'
|
10
|
+
vm.vm_user = 'root'
|
11
|
+
vm.vm_password = 'xxxxxxxx'
|
12
|
+
vm.guest_password = 'xxxxxxxxxx'
|
13
|
+
vm.guest_user = 'administrator'
|
14
|
+
vm.datastore = '[standard] img/img.vmx'
|
15
|
+
vm.logging_enabled = true
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
*To start the VMServer*
|
20
|
+
|
21
|
+
bc. vmserver.start
|
22
|
+
|
23
|
+
*To create a directory in the Guest OS*
|
24
|
+
|
25
|
+
bc. vmserver.mkdir('dir')
|
26
|
+
|
27
|
+
*To copy a file from Host OS to Guest OS*
|
28
|
+
|
29
|
+
bc. vmserver.copy_file_from_host_to_guest('src','dest')
|
30
|
+
|
31
|
+
*_Note_* The src and dest need to be absolute paths.
|
data/Rakefile.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gemspec|
|
7
|
+
gemspec.name = "vmserver"
|
8
|
+
gemspec.summary = "A gem to simplify VMServer handling from ruby"
|
9
|
+
gemspec.description = "This gem simplifies the interaction of ruby code with VMServer if you need to automate the process."
|
10
|
+
gemspec.email = "sriram.varahan@gmail.com"
|
11
|
+
gemspec.homepage = "http://github.com/sriram/vmserver"
|
12
|
+
gemspec.authors = ["Sriram Varahan"]
|
13
|
+
end
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
|
+
rescue LoadError
|
16
|
+
p "Jeweler not available. Install it with: gem install jeweler"
|
17
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
@@ -0,0 +1,349 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: VMServer</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">VMServer</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/vmserver_rb.html">
|
59
|
+
lib/vmserver.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000007">copy_file_from_guest_to_host</a>
|
90
|
+
<a href="#M000006">copy_file_from_host_to_guest</a>
|
91
|
+
<a href="#M000003">file_exists_in_guest?</a>
|
92
|
+
<a href="#M000008">get_processes_in_guest</a>
|
93
|
+
<a href="#M000010">kill_process_in_guest</a>
|
94
|
+
<a href="#M000002">log</a>
|
95
|
+
<a href="#M000005">mkdir</a>
|
96
|
+
<a href="#M000001">new</a>
|
97
|
+
<a href="#M000009">run_program_in_guest</a>
|
98
|
+
<a href="#M000004">start</a>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if includes -->
|
106
|
+
|
107
|
+
<div id="section">
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<div id="attribute-list">
|
114
|
+
<h3 class="section-bar">Attributes</h3>
|
115
|
+
|
116
|
+
<div class="name-list">
|
117
|
+
<table>
|
118
|
+
<tr class="top-aligned-row context-row">
|
119
|
+
<td class="context-item-name">datastore</td>
|
120
|
+
<td class="context-item-value"> [RW] </td>
|
121
|
+
<td class="context-item-desc"></td>
|
122
|
+
</tr>
|
123
|
+
<tr class="top-aligned-row context-row">
|
124
|
+
<td class="context-item-name">guest_password</td>
|
125
|
+
<td class="context-item-value"> [RW] </td>
|
126
|
+
<td class="context-item-desc"></td>
|
127
|
+
</tr>
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">guest_user</td>
|
130
|
+
<td class="context-item-value"> [RW] </td>
|
131
|
+
<td class="context-item-desc"></td>
|
132
|
+
</tr>
|
133
|
+
<tr class="top-aligned-row context-row">
|
134
|
+
<td class="context-item-name">host</td>
|
135
|
+
<td class="context-item-value"> [RW] </td>
|
136
|
+
<td class="context-item-desc"></td>
|
137
|
+
</tr>
|
138
|
+
<tr class="top-aligned-row context-row">
|
139
|
+
<td class="context-item-name">logging_enabled</td>
|
140
|
+
<td class="context-item-value"> [RW] </td>
|
141
|
+
<td class="context-item-desc"></td>
|
142
|
+
</tr>
|
143
|
+
<tr class="top-aligned-row context-row">
|
144
|
+
<td class="context-item-name">url</td>
|
145
|
+
<td class="context-item-value"> [RW] </td>
|
146
|
+
<td class="context-item-desc"></td>
|
147
|
+
</tr>
|
148
|
+
<tr class="top-aligned-row context-row">
|
149
|
+
<td class="context-item-name">vm_password</td>
|
150
|
+
<td class="context-item-value"> [RW] </td>
|
151
|
+
<td class="context-item-desc"></td>
|
152
|
+
</tr>
|
153
|
+
<tr class="top-aligned-row context-row">
|
154
|
+
<td class="context-item-name">vm_user</td>
|
155
|
+
<td class="context-item-value"> [RW] </td>
|
156
|
+
<td class="context-item-desc"></td>
|
157
|
+
</tr>
|
158
|
+
</table>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
<!-- if method_list -->
|
165
|
+
<div id="methods">
|
166
|
+
<h3 class="section-bar">Public Class methods</h3>
|
167
|
+
|
168
|
+
<div id="method-M000001" class="method-detail">
|
169
|
+
<a name="M000001"></a>
|
170
|
+
|
171
|
+
<div class="method-heading">
|
172
|
+
<a href="VMServer.src/M000001.html" target="Code" class="method-signature"
|
173
|
+
onclick="popupCode('VMServer.src/M000001.html');return false;">
|
174
|
+
<span class="method-name">new</span><span class="method-args">() {|self| ...}</span>
|
175
|
+
</a>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div class="method-description">
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
183
|
+
|
184
|
+
<div id="method-M000007" class="method-detail">
|
185
|
+
<a name="M000007"></a>
|
186
|
+
|
187
|
+
<div class="method-heading">
|
188
|
+
<a href="VMServer.src/M000007.html" target="Code" class="method-signature"
|
189
|
+
onclick="popupCode('VMServer.src/M000007.html');return false;">
|
190
|
+
<span class="method-name">copy_file_from_guest_to_host</span><span class="method-args">(src,dest)</span>
|
191
|
+
</a>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div class="method-description">
|
195
|
+
<p>
|
196
|
+
Copy a file from Guest OS to Host OS
|
197
|
+
</p>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div id="method-M000006" class="method-detail">
|
202
|
+
<a name="M000006"></a>
|
203
|
+
|
204
|
+
<div class="method-heading">
|
205
|
+
<a href="VMServer.src/M000006.html" target="Code" class="method-signature"
|
206
|
+
onclick="popupCode('VMServer.src/M000006.html');return false;">
|
207
|
+
<span class="method-name">copy_file_from_host_to_guest</span><span class="method-args">(src, dest)</span>
|
208
|
+
</a>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div class="method-description">
|
212
|
+
<p>
|
213
|
+
Copy a file from host OS to Guest OS
|
214
|
+
</p>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="method-M000003" class="method-detail">
|
219
|
+
<a name="M000003"></a>
|
220
|
+
|
221
|
+
<div class="method-heading">
|
222
|
+
<a href="VMServer.src/M000003.html" target="Code" class="method-signature"
|
223
|
+
onclick="popupCode('VMServer.src/M000003.html');return false;">
|
224
|
+
<span class="method-name">file_exists_in_guest?</span><span class="method-args">(file)</span>
|
225
|
+
</a>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
<div class="method-description">
|
229
|
+
<p>
|
230
|
+
Checks if a file exists in the guest OS
|
231
|
+
</p>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<div id="method-M000008" class="method-detail">
|
236
|
+
<a name="M000008"></a>
|
237
|
+
|
238
|
+
<div class="method-heading">
|
239
|
+
<a href="VMServer.src/M000008.html" target="Code" class="method-signature"
|
240
|
+
onclick="popupCode('VMServer.src/M000008.html');return false;">
|
241
|
+
<span class="method-name">get_processes_in_guest</span><span class="method-args">()</span>
|
242
|
+
</a>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div class="method-description">
|
246
|
+
<p>
|
247
|
+
Get a list of processes running in the Guest OS
|
248
|
+
</p>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<div id="method-M000010" class="method-detail">
|
253
|
+
<a name="M000010"></a>
|
254
|
+
|
255
|
+
<div class="method-heading">
|
256
|
+
<a href="VMServer.src/M000010.html" target="Code" class="method-signature"
|
257
|
+
onclick="popupCode('VMServer.src/M000010.html');return false;">
|
258
|
+
<span class="method-name">kill_process_in_guest</span><span class="method-args">(pid)</span>
|
259
|
+
</a>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div class="method-description">
|
263
|
+
<p>
|
264
|
+
Kill a process with the given PID in the Guest OS
|
265
|
+
</p>
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div id="method-M000002" class="method-detail">
|
270
|
+
<a name="M000002"></a>
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
<a href="VMServer.src/M000002.html" target="Code" class="method-signature"
|
274
|
+
onclick="popupCode('VMServer.src/M000002.html');return false;">
|
275
|
+
<span class="method-name">log</span><span class="method-args">(msg)</span>
|
276
|
+
</a>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div class="method-description">
|
280
|
+
<p>
|
281
|
+
Logs if logging is enabled
|
282
|
+
</p>
|
283
|
+
</div>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
<div id="method-M000005" class="method-detail">
|
287
|
+
<a name="M000005"></a>
|
288
|
+
|
289
|
+
<div class="method-heading">
|
290
|
+
<a href="VMServer.src/M000005.html" target="Code" class="method-signature"
|
291
|
+
onclick="popupCode('VMServer.src/M000005.html');return false;">
|
292
|
+
<span class="method-name">mkdir</span><span class="method-args">(dir)</span>
|
293
|
+
</a>
|
294
|
+
</div>
|
295
|
+
|
296
|
+
<div class="method-description">
|
297
|
+
<p>
|
298
|
+
Create a directory in the Virtual Machine
|
299
|
+
</p>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div id="method-M000009" class="method-detail">
|
304
|
+
<a name="M000009"></a>
|
305
|
+
|
306
|
+
<div class="method-heading">
|
307
|
+
<a href="VMServer.src/M000009.html" target="Code" class="method-signature"
|
308
|
+
onclick="popupCode('VMServer.src/M000009.html');return false;">
|
309
|
+
<span class="method-name">run_program_in_guest</span><span class="method-args">(program,prog_args={})</span>
|
310
|
+
</a>
|
311
|
+
</div>
|
312
|
+
|
313
|
+
<div class="method-description">
|
314
|
+
<p>
|
315
|
+
Execute a program in the Guest OS
|
316
|
+
</p>
|
317
|
+
</div>
|
318
|
+
</div>
|
319
|
+
|
320
|
+
<div id="method-M000004" class="method-detail">
|
321
|
+
<a name="M000004"></a>
|
322
|
+
|
323
|
+
<div class="method-heading">
|
324
|
+
<a href="VMServer.src/M000004.html" target="Code" class="method-signature"
|
325
|
+
onclick="popupCode('VMServer.src/M000004.html');return false;">
|
326
|
+
<span class="method-name">start</span><span class="method-args">()</span>
|
327
|
+
</a>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
<div class="method-description">
|
331
|
+
<p>
|
332
|
+
Start up the Virtual Machine
|
333
|
+
</p>
|
334
|
+
</div>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
|
338
|
+
</div>
|
339
|
+
|
340
|
+
|
341
|
+
</div>
|
342
|
+
|
343
|
+
|
344
|
+
<div id="validator-badges">
|
345
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
346
|
+
</div>
|
347
|
+
|
348
|
+
</body>
|
349
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 5</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
15
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span>
|
16
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Please make sure you have set host ,vm_user and vm_password in the configuration!"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@host</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@vm_user</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@vm_password</span>
|
17
|
+
|
18
|
+
<span class="ruby-comment cmt"># This is the base command used for all the commands.</span>
|
19
|
+
<span class="ruby-ivar">@base_command</span> = <span class="ruby-node">"vmrun -T server -h #{@host} -u #{@vm_user} -p #{@vm_password}"</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>log (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 17</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>(<span class="ruby-identifier">msg</span>)
|
15
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{Time.now} #{msg}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@logging_enabled</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>file_exists_in_guest? (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 25</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">file_exists_in_guest?</span>(<span class="ruby-identifier">file</span>)
|
15
|
+
<span class="ruby-identifier">vm_command</span> = <span class="ruby-node">"#{@base_command} -gu #{@guest_user} -gp #{@guest_password} fileExistsInGuest \'#{datastore}\' #{file}"</span>
|
16
|
+
<span class="ruby-identifier">output</span> = <span class="ruby-identifier">system</span>(<span class="ruby-identifier">vm_command</span>)
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">output</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/The file exists/</span>
|
18
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
19
|
+
<span class="ruby-keyword kw">else</span>
|
20
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
23
|
+
</body>
|
24
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>start (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 39</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
|
15
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-value str">'start'</span>
|
16
|
+
<span class="ruby-identifier">vm_command</span> = <span class="ruby-node">"#{@base_command} #{command} \'#{@datastore}\'"</span>
|
17
|
+
<span class="ruby-identifier">log</span> <span class="ruby-identifier">vm_command</span>
|
18
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">system</span>(<span class="ruby-identifier">vm_command</span>)
|
19
|
+
<span class="ruby-identifier">result</span> <span class="ruby-value">? </span><span class="ruby-identifier">log</span>(<span class="ruby-value str">"VM started successfully has been executed."</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">log</span>(<span class="ruby-value str">"Error! VM could not be started."</span>)
|
20
|
+
<span class="ruby-identifier">result</span>
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>mkdir (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 52</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mkdir</span>(<span class="ruby-identifier">dir</span>)
|
15
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-value str">'createDirectoryInGuest'</span>
|
16
|
+
<span class="ruby-identifier">vm_command</span> = <span class="ruby-node">"#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \'#{@datastore}\' \'#{dir}\'"</span>
|
17
|
+
<span class="ruby-identifier">log</span> <span class="ruby-identifier">vm_command</span>
|
18
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">system</span>(<span class="ruby-identifier">vm_command</span>)
|
19
|
+
<span class="ruby-identifier">result</span> <span class="ruby-value">? </span><span class="ruby-identifier">log</span>(<span class="ruby-value str">"Directory created successfully in guest."</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">log</span>(<span class="ruby-value str">"Error! Directory could not be created."</span>)
|
20
|
+
<span class="ruby-identifier">result</span>
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>copy_file_from_host_to_guest (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 65</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">copy_file_from_host_to_guest</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">dest</span>)
|
15
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-value str">'copyFileFromHostToGuest'</span>
|
16
|
+
<span class="ruby-identifier">vm_command</span> = <span class="ruby-node">"#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \'#{@datastore}\' \'#{src}\' \'#{dest}\'"</span>
|
17
|
+
<span class="ruby-identifier">log</span> <span class="ruby-identifier">vm_command</span>
|
18
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">system</span>(<span class="ruby-identifier">vm_command</span>)
|
19
|
+
<span class="ruby-identifier">result</span> <span class="ruby-value">? </span><span class="ruby-identifier">log</span>(<span class="ruby-value str">"Copy successful."</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">log</span>(<span class="ruby-value str">"Error! Copy failed."</span>)
|
20
|
+
<span class="ruby-identifier">result</span>
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>copy_file_from_guest_to_host (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 78</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">copy_file_from_guest_to_host</span>(<span class="ruby-identifier">src</span>,<span class="ruby-identifier">dest</span>)
|
15
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-value str">'copyFileFromGuestToHost'</span>
|
16
|
+
<span class="ruby-identifier">vm_command</span> = <span class="ruby-node">"#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \'#{@datastore}\' \'#{src}\' \'#{dest}\'"</span>
|
17
|
+
<span class="ruby-identifier">log</span> <span class="ruby-identifier">vm_command</span>
|
18
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">system</span>(<span class="ruby-identifier">vm_command</span>)
|
19
|
+
<span class="ruby-identifier">result</span> <span class="ruby-value">? </span><span class="ruby-identifier">log</span>(<span class="ruby-value str">"Copy successful."</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">log</span>(<span class="ruby-value str">"Error! Copy failed."</span>)
|
20
|
+
<span class="ruby-identifier">result</span>
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>get_processes_in_guest (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 91</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_processes_in_guest</span>
|
15
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-value str">'listProcessesInGuest'</span>
|
16
|
+
<span class="ruby-identifier">processes</span> = <span class="ruby-node">`#{@base_command} -gu #{@guest_user} -gp #{guest_password} #{command} \'#{@datastore}\'`</span>
|
17
|
+
<span class="ruby-identifier">processes</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>run_program_in_guest (VMServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/vmserver.rb, line 101</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_program_in_guest</span>(<span class="ruby-identifier">program</span>,<span class="ruby-identifier">prog_args</span>={})
|
15
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-value str">'runProgramInGuest'</span>
|
16
|
+
<span class="ruby-identifier">prog_args</span> = <span class="ruby-identifier">prog_args</span>[<span class="ruby-identifier">:prog_args</span>]
|
17
|
+
<span class="ruby-identifier">vm_command</span> = <span class="ruby-node">"#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \'#{@datastore}\' -activeWindow #{program} #{prog_args}"</span>
|
18
|
+
<span class="ruby-identifier">log</span> <span class="ruby-identifier">vm_command</span>
|
19
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">system</span>(<span class="ruby-identifier">vm_command</span>)
|
20
|
+
<span class="ruby-identifier">result</span> <span class="ruby-value">? </span><span class="ruby-identifier">log</span>(<span class="ruby-value str">"Program executed successfully in guest."</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">log</span>(<span class="ruby-value str">"Error! Failed to execute program in guest."</span>)
|
21
|
+
<span class="ruby-identifier">result</span>
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
23
|
+
</body>
|
24
|
+
</html>
|