wf_node_api 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/Gemfile +28 -0
  4. data/Gemfile.lock +66 -0
  5. data/LICENSE +340 -0
  6. data/Makefile +19 -0
  7. data/README.md +78 -0
  8. data/Rakefile +2 -0
  9. data/Vagrantfile +102 -0
  10. data/_docs/api/Api/NodeApi.html +123 -0
  11. data/_docs/api/Api.html +149 -0
  12. data/_docs/api/Config/Check.html +331 -0
  13. data/_docs/api/Config.html +115 -0
  14. data/_docs/api/ConfigCheck.html +365 -0
  15. data/_docs/api/ContainerManager.html +1632 -0
  16. data/_docs/api/ContainerManagerAdapter/Lxc.html +1352 -0
  17. data/_docs/api/ContainerManagerAdapter/Vserver.html +1358 -0
  18. data/_docs/api/ContainerManagerAdapter.html +151 -0
  19. data/_docs/api/Error/NotFound.html +134 -0
  20. data/_docs/api/Error.html +115 -0
  21. data/_docs/api/NotFoundError.html +157 -0
  22. data/_docs/api/OS.html +234 -0
  23. data/_docs/api/ResourceManager.html +322 -0
  24. data/_docs/api/ResourceManagerAdapter/Linux.html +326 -0
  25. data/_docs/api/ResourceManagerAdapter.html +149 -0
  26. data/_docs/api/WfNodeApi.html +163 -0
  27. data/_docs/api/_index.html +239 -0
  28. data/_docs/api/class_list.html +58 -0
  29. data/_docs/api/css/common.css +1 -0
  30. data/_docs/api/css/full_list.css +57 -0
  31. data/_docs/api/css/style.css +339 -0
  32. data/_docs/api/file.README.html +146 -0
  33. data/_docs/api/file_list.html +60 -0
  34. data/_docs/api/frames.html +26 -0
  35. data/_docs/api/index.html +146 -0
  36. data/_docs/api/js/app.js +219 -0
  37. data/_docs/api/js/full_list.js +181 -0
  38. data/_docs/api/js/jquery.js +4 -0
  39. data/_docs/api/method_list.html +273 -0
  40. data/_docs/api/top-level-namespace.html +244 -0
  41. data/_docs/rest/api_data.js +1 -0
  42. data/_docs/rest/api_data.json +1 -0
  43. data/_docs/rest/api_project.js +1 -0
  44. data/_docs/rest/api_project.json +1 -0
  45. data/_docs/rest/css/style.css +538 -0
  46. data/_docs/rest/header.md +3 -0
  47. data/_docs/rest/img/favicon.ico +0 -0
  48. data/_docs/rest/img/glyphicons-halflings-white.png +0 -0
  49. data/_docs/rest/img/glyphicons-halflings.png +0 -0
  50. data/_docs/rest/index.html +658 -0
  51. data/_docs/rest/locales/de.js +25 -0
  52. data/_docs/rest/locales/fr.js +25 -0
  53. data/_docs/rest/locales/locale.js +43 -0
  54. data/_docs/rest/locales/nl.js +25 -0
  55. data/_docs/rest/locales/pl.js +25 -0
  56. data/_docs/rest/locales/pt_br.js +25 -0
  57. data/_docs/rest/locales/ru.js +25 -0
  58. data/_docs/rest/locales/zh.js +25 -0
  59. data/_docs/rest/main.js +691 -0
  60. data/_docs/rest/utils/handlebars_helper.js +327 -0
  61. data/_docs/rest/utils/send_sample_request.js +158 -0
  62. data/_docs/rest/vendor/bootstrap-responsive.min.css +9 -0
  63. data/_docs/rest/vendor/bootstrap.min.css +9 -0
  64. data/_docs/rest/vendor/bootstrap.min.js +6 -0
  65. data/_docs/rest/vendor/diff_match_patch.min.js +49 -0
  66. data/_docs/rest/vendor/handlebars.min.js +28 -0
  67. data/_docs/rest/vendor/jquery.min.js +4 -0
  68. data/_docs/rest/vendor/lodash.min.js +61 -0
  69. data/_docs/rest/vendor/path-to-regexp/LICENSE +21 -0
  70. data/_docs/rest/vendor/path-to-regexp/index.js +205 -0
  71. data/_docs/rest/vendor/polyfill.js +100 -0
  72. data/_docs/rest/vendor/prettify/lang-apollo.js +2 -0
  73. data/_docs/rest/vendor/prettify/lang-basic.js +3 -0
  74. data/_docs/rest/vendor/prettify/lang-clj.js +18 -0
  75. data/_docs/rest/vendor/prettify/lang-css.js +2 -0
  76. data/_docs/rest/vendor/prettify/lang-dart.js +3 -0
  77. data/_docs/rest/vendor/prettify/lang-erlang.js +2 -0
  78. data/_docs/rest/vendor/prettify/lang-go.js +1 -0
  79. data/_docs/rest/vendor/prettify/lang-hs.js +2 -0
  80. data/_docs/rest/vendor/prettify/lang-lisp.js +3 -0
  81. data/_docs/rest/vendor/prettify/lang-llvm.js +1 -0
  82. data/_docs/rest/vendor/prettify/lang-lua.js +2 -0
  83. data/_docs/rest/vendor/prettify/lang-matlab.js +6 -0
  84. data/_docs/rest/vendor/prettify/lang-ml.js +2 -0
  85. data/_docs/rest/vendor/prettify/lang-mumps.js +2 -0
  86. data/_docs/rest/vendor/prettify/lang-n.js +4 -0
  87. data/_docs/rest/vendor/prettify/lang-pascal.js +3 -0
  88. data/_docs/rest/vendor/prettify/lang-proto.js +1 -0
  89. data/_docs/rest/vendor/prettify/lang-r.js +2 -0
  90. data/_docs/rest/vendor/prettify/lang-rd.js +1 -0
  91. data/_docs/rest/vendor/prettify/lang-scala.js +2 -0
  92. data/_docs/rest/vendor/prettify/lang-sql.js +2 -0
  93. data/_docs/rest/vendor/prettify/lang-tcl.js +3 -0
  94. data/_docs/rest/vendor/prettify/lang-tex.js +1 -0
  95. data/_docs/rest/vendor/prettify/lang-vb.js +2 -0
  96. data/_docs/rest/vendor/prettify/lang-vhdl.js +3 -0
  97. data/_docs/rest/vendor/prettify/lang-wiki.js +2 -0
  98. data/_docs/rest/vendor/prettify/lang-xq.js +3 -0
  99. data/_docs/rest/vendor/prettify/lang-yaml.js +2 -0
  100. data/_docs/rest/vendor/prettify/prettify.css +1 -0
  101. data/_docs/rest/vendor/prettify/prettify.js +30 -0
  102. data/_docs/rest/vendor/prettify/run_prettify.js +34 -0
  103. data/_docs/rest/vendor/prettify.css +101 -0
  104. data/_docs/rest/vendor/require.min.js +36 -0
  105. data/apidoc.json +23 -0
  106. data/bin/wf_node_api +80 -0
  107. data/lib/wf_node_api/api/node_api.rb +360 -0
  108. data/lib/wf_node_api/config/config_template.erb +50 -0
  109. data/lib/wf_node_api/config_check.rb +50 -0
  110. data/lib/wf_node_api/container_manager.rb +286 -0
  111. data/lib/wf_node_api/container_manager_adapter/lxc.rb +431 -0
  112. data/lib/wf_node_api/container_manager_adapter/vserver.rb +448 -0
  113. data/lib/wf_node_api/error/not_found.rb +27 -0
  114. data/lib/wf_node_api/os.rb +32 -0
  115. data/lib/wf_node_api/resource_manager.rb +49 -0
  116. data/lib/wf_node_api/resource_manager_adapter/linux.rb +53 -0
  117. data/lib/wf_node_api/translations.rb +38 -0
  118. data/lib/wf_node_api/version.rb +28 -0
  119. data/lib/wf_node_api.rb +57 -0
  120. data/manifests/files/dhozac-vserver.repo +4 -0
  121. data/wf-node-api.gemspec +53 -0
  122. metadata +221 -0
@@ -0,0 +1,1352 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: ContainerManagerAdapter::Lxc
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!ContainerManagerAdapter/Lxc.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (L)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../ContainerManagerAdapter.html" title="ContainerManagerAdapter (module)">ContainerManagerAdapter</a></span></span>
36
+ &raquo;
37
+ <span class="title">Lxc</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: ContainerManagerAdapter::Lxc
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ContainerManagerAdapter::Lxc</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/wf_node_api/container_manager_adapter/lxc.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Container adapter for LXC. Encapsulates all LXC specific command line
106
+ wrapping</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ <h2>
123
+ Instance Method Summary
124
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
125
+ </h2>
126
+
127
+ <ul class="summary">
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#container-instance_method" title="#container (instance method)">- (Hash) <strong>container</strong>(name) </a>
133
+
134
+
135
+
136
+ </span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'>
147
+ <p>Returns information for a single container.</p>
148
+ </div></span>
149
+
150
+ </li>
151
+
152
+
153
+ <li class="public ">
154
+ <span class="summary_signature">
155
+
156
+ <a href="#containers-instance_method" title="#containers (instance method)">- (Array) <strong>containers</strong> </a>
157
+
158
+
159
+
160
+ </span>
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <span class="summary_desc"><div class='inline'>
171
+ <p>Lists all available containers.</p>
172
+ </div></span>
173
+
174
+ </li>
175
+
176
+
177
+ <li class="public ">
178
+ <span class="summary_signature">
179
+
180
+ <a href="#create_container-instance_method" title="#create_container (instance method)">- (String) <strong>create_container</strong>(name, ip_address, disk_size_gb, memory_limit_mb, cpu_core_count) </a>
181
+
182
+
183
+
184
+ </span>
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'>
195
+ <p>Creates a container with the given parameters.</p>
196
+ </div></span>
197
+
198
+ </li>
199
+
200
+
201
+ <li class="public ">
202
+ <span class="summary_signature">
203
+
204
+ <a href="#delete-instance_method" title="#delete (instance method)">- (String) <strong>delete</strong>(name) </a>
205
+
206
+
207
+
208
+ </span>
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+ <span class="summary_desc"><div class='inline'>
219
+ <p>Deletes a container with the given name.</p>
220
+ </div></span>
221
+
222
+ </li>
223
+
224
+
225
+ <li class="public ">
226
+ <span class="summary_signature">
227
+
228
+ <a href="#exist%3F-instance_method" title="#exist? (instance method)">- (Boolean) <strong>exist?</strong>(name) </a>
229
+
230
+
231
+
232
+ </span>
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+ <span class="summary_desc"><div class='inline'>
243
+ <p>Checks if a container with the given name exists.</p>
244
+ </div></span>
245
+
246
+ </li>
247
+
248
+
249
+ <li class="public ">
250
+ <span class="summary_signature">
251
+
252
+ <a href="#free_cpu_core_count-instance_method" title="#free_cpu_core_count (instance method)">- (Integer) <strong>free_cpu_core_count</strong>(resman) </a>
253
+
254
+
255
+
256
+ </span>
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+ <span class="summary_desc"><div class='inline'>
267
+ <p>Returns the amount of free cpu cores.</p>
268
+ </div></span>
269
+
270
+ </li>
271
+
272
+
273
+ <li class="public ">
274
+ <span class="summary_signature">
275
+
276
+ <a href="#kill-instance_method" title="#kill (instance method)">- (String) <strong>kill</strong>(name) </a>
277
+
278
+
279
+
280
+ </span>
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+ <span class="summary_desc"><div class='inline'>
291
+ <p>Kills a container with the given name.</p>
292
+ </div></span>
293
+
294
+ </li>
295
+
296
+
297
+ <li class="public ">
298
+ <span class="summary_signature">
299
+
300
+ <a href="#start-instance_method" title="#start (instance method)">- (String) <strong>start</strong>(name) </a>
301
+
302
+
303
+
304
+ </span>
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+ <span class="summary_desc"><div class='inline'>
315
+ <p>Starts a container with the given name.</p>
316
+ </div></span>
317
+
318
+ </li>
319
+
320
+
321
+ <li class="public ">
322
+ <span class="summary_signature">
323
+
324
+ <a href="#stop-instance_method" title="#stop (instance method)">- (String) <strong>stop</strong>(name) </a>
325
+
326
+
327
+
328
+ </span>
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+ <span class="summary_desc"><div class='inline'>
339
+ <p>Stops a container with the given name.</p>
340
+ </div></span>
341
+
342
+ </li>
343
+
344
+
345
+ </ul>
346
+
347
+
348
+
349
+
350
+ <div id="instance_method_details" class="method_details_list">
351
+ <h2>Instance Method Details</h2>
352
+
353
+
354
+ <div class="method_details first">
355
+ <h3 class="signature first" id="container-instance_method">
356
+
357
+ - (<tt>Hash</tt>) <strong>container</strong>(name)
358
+
359
+
360
+
361
+
362
+
363
+ </h3><div class="docstring">
364
+ <div class="discussion">
365
+
366
+ <p>Returns information for a single container</p>
367
+
368
+
369
+ </div>
370
+ </div>
371
+ <div class="tags">
372
+ <p class="tag_title">Parameters:</p>
373
+ <ul class="param">
374
+
375
+ <li>
376
+
377
+ <span class='name'>name</span>
378
+
379
+
380
+ <span class='type'>(<tt>String</tt>)</span>
381
+
382
+
383
+
384
+ &mdash;
385
+ <div class='inline'>
386
+ <p>The container name</p>
387
+ </div>
388
+
389
+ </li>
390
+
391
+ </ul>
392
+
393
+ <p class="tag_title">Returns:</p>
394
+ <ul class="return">
395
+
396
+ <li>
397
+
398
+
399
+ <span class='type'>(<tt>Hash</tt>)</span>
400
+
401
+
402
+
403
+ &mdash;
404
+ <div class='inline'>
405
+ <p>Hash with information about the container</p>
406
+ </div>
407
+
408
+ </li>
409
+
410
+ </ul>
411
+
412
+ </div><table class="source_code">
413
+ <tr>
414
+ <td>
415
+ <pre class="lines">
416
+
417
+
418
+ 124
419
+ 125
420
+ 126
421
+ 127
422
+ 128
423
+ 129
424
+ 130
425
+ 131
426
+ 132
427
+ 133
428
+ 134
429
+ 135
430
+ 136
431
+ 137
432
+ 138</pre>
433
+ </td>
434
+ <td>
435
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 124</span>
436
+
437
+ <span class='kw'>def</span> <span class='id identifier rubyid_container'>container</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
438
+ <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
439
+
440
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
441
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:state</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_translate_state'>translate_state</span><span class='lparen'>(</span><span class='id identifier rubyid_state'>state</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
442
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:ip_address</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_ip_addr'>ip_addr</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
443
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:cpu_cores</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_assigned_cpu_cores'>assigned_cpu_cores</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
444
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:memory_limit_bytes</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_memory_limit'>memory_limit</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
445
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:memory_usage_bytes</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_memory_usage'>memory_usage</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
446
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:disk_space_gb</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
447
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:disk_usage_gb</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
448
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:container_type</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>lxc</span><span class='tstring_end'>&#39;</span></span>
449
+
450
+ <span class='id identifier rubyid_data'>data</span>
451
+ <span class='kw'>end</span></pre>
452
+ </td>
453
+ </tr>
454
+ </table>
455
+ </div>
456
+
457
+ <div class="method_details ">
458
+ <h3 class="signature " id="containers-instance_method">
459
+
460
+ - (<tt>Array</tt>) <strong>containers</strong>
461
+
462
+
463
+
464
+
465
+
466
+ </h3><div class="docstring">
467
+ <div class="discussion">
468
+
469
+ <p>Lists all available containers</p>
470
+
471
+
472
+ </div>
473
+ </div>
474
+ <div class="tags">
475
+
476
+ <p class="tag_title">Returns:</p>
477
+ <ul class="return">
478
+
479
+ <li>
480
+
481
+
482
+ <span class='type'>(<tt>Array</tt>)</span>
483
+
484
+
485
+
486
+ </li>
487
+
488
+ </ul>
489
+
490
+ </div><table class="source_code">
491
+ <tr>
492
+ <td>
493
+ <pre class="lines">
494
+
495
+
496
+ 33
497
+ 34
498
+ 35
499
+ 36
500
+ 37
501
+ 38
502
+ 39
503
+ 40
504
+ 41</pre>
505
+ </td>
506
+ <td>
507
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 33</span>
508
+
509
+ <span class='kw'>def</span> <span class='id identifier rubyid_containers'>containers</span>
510
+ <span class='id identifier rubyid_container_list'>container_list</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
511
+
512
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_container_names'>container_names</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
513
+ <span class='id identifier rubyid_container_list'>container_list</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_container'>container</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
514
+ <span class='kw'>end</span>
515
+
516
+ <span class='id identifier rubyid_container_list'>container_list</span>
517
+ <span class='kw'>end</span></pre>
518
+ </td>
519
+ </tr>
520
+ </table>
521
+ </div>
522
+
523
+ <div class="method_details ">
524
+ <h3 class="signature " id="create_container-instance_method">
525
+
526
+ - (<tt>String</tt>) <strong>create_container</strong>(name, ip_address, disk_size_gb, memory_limit_mb, cpu_core_count)
527
+
528
+
529
+
530
+
531
+
532
+ </h3><div class="docstring">
533
+ <div class="discussion">
534
+
535
+ <p>Creates a container with the given parameters</p>
536
+
537
+
538
+ </div>
539
+ </div>
540
+ <div class="tags">
541
+ <p class="tag_title">Parameters:</p>
542
+ <ul class="param">
543
+
544
+ <li>
545
+
546
+ <span class='name'>name</span>
547
+
548
+
549
+ <span class='type'>(<tt>String</tt>)</span>
550
+
551
+
552
+
553
+ &mdash;
554
+ <div class='inline'>
555
+ <p>The container name</p>
556
+ </div>
557
+
558
+ </li>
559
+
560
+ <li>
561
+
562
+ <span class='name'>ip_address</span>
563
+
564
+
565
+ <span class='type'>(<tt>String</tt>)</span>
566
+
567
+
568
+
569
+ &mdash;
570
+ <div class='inline'>
571
+ <p>A valid IPv4 address</p>
572
+ </div>
573
+
574
+ </li>
575
+
576
+ <li>
577
+
578
+ <span class='name'>disk_size_gb</span>
579
+
580
+
581
+ <span class='type'>(<tt>Integer</tt>)</span>
582
+
583
+
584
+
585
+ &mdash;
586
+ <div class='inline'>
587
+ <p>The disk size in GB</p>
588
+ </div>
589
+
590
+ </li>
591
+
592
+ <li>
593
+
594
+ <span class='name'>memory_limit_mb</span>
595
+
596
+
597
+ <span class='type'>(<tt>Integer</tt>)</span>
598
+
599
+
600
+
601
+ &mdash;
602
+ <div class='inline'>
603
+ <p>The memory limit in MB</p>
604
+ </div>
605
+
606
+ </li>
607
+
608
+ <li>
609
+
610
+ <span class='name'>cpu_core_count</span>
611
+
612
+
613
+ <span class='type'>(<tt>Integer</tt>)</span>
614
+
615
+
616
+
617
+ &mdash;
618
+ <div class='inline'>
619
+ <p>Amount of Vcores to assign. 0 if no limit should be set</p>
620
+ </div>
621
+
622
+ </li>
623
+
624
+ </ul>
625
+
626
+ <p class="tag_title">Returns:</p>
627
+ <ul class="return">
628
+
629
+ <li>
630
+
631
+
632
+ <span class='type'>(<tt>String</tt>)</span>
633
+
634
+
635
+
636
+ &mdash;
637
+ <div class='inline'>
638
+ <p>CLI output</p>
639
+ </div>
640
+
641
+ </li>
642
+
643
+ </ul>
644
+ <p class="tag_title">Raises:</p>
645
+ <ul class="raise">
646
+
647
+ <li>
648
+
649
+
650
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
651
+
652
+
653
+
654
+ </li>
655
+
656
+ </ul>
657
+
658
+ </div><table class="source_code">
659
+ <tr>
660
+ <td>
661
+ <pre class="lines">
662
+
663
+
664
+ 151
665
+ 152
666
+ 153
667
+ 154
668
+ 155
669
+ 156
670
+ 157
671
+ 158
672
+ 159
673
+ 160
674
+ 161
675
+ 162
676
+ 163
677
+ 164
678
+ 165
679
+ 166
680
+ 167
681
+ 168
682
+ 169
683
+ 170
684
+ 171
685
+ 172
686
+ 173
687
+ 174
688
+ 175
689
+ 176
690
+ 177
691
+ 178
692
+ 179
693
+ 180
694
+ 181
695
+ 182
696
+ 183
697
+ 184
698
+ 185
699
+ 186
700
+ 187
701
+ 188
702
+ 189</pre>
703
+ </td>
704
+ <td>
705
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 151</span>
706
+
707
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_container'>create_container</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_ip_address'>ip_address</span><span class='comma'>,</span> <span class='id identifier rubyid_disk_size_gb'>disk_size_gb</span><span class='comma'>,</span> <span class='id identifier rubyid_memory_limit_mb'>memory_limit_mb</span><span class='comma'>,</span> <span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span><span class='rparen'>)</span>
708
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
709
+
710
+ <span class='kw'>begin</span>
711
+ <span class='kw'>if</span> <span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span> <span class='op'>!=</span> <span class='int'>0</span>
712
+ <span class='id identifier rubyid_cpuset'>cpuset</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_generate_cpu_set'>generate_cpu_set</span><span class='lparen'>(</span><span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span><span class='comma'>,</span> <span class='const'>ResourceManager</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>linux</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
713
+ <span class='kw'>end</span>
714
+
715
+ <span class='id identifier rubyid_create_result'>create_result</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$lxc_cmd_create</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
716
+
717
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>+=</span> <span class='id identifier rubyid_create_result'>create_result</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
718
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>+=</span> <span class='id identifier rubyid_create_result'>create_result</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
719
+
720
+ <span class='id identifier rubyid_config_path'>config_path</span> <span class='op'>=</span> <span class='gvar'>$lxc_container_config_path</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
721
+
722
+ <span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_config_path'>config_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>a</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
723
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>lxc.network.ipv4=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ip_address'>ip_address</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='gvar'>$lxc_ip_netmask</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
724
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>lxc.start.auto=1\n</span><span class='tstring_end'>&quot;</span></span>
725
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>lxc.start.delay=5\n</span><span class='tstring_end'>&quot;</span></span>
726
+
727
+ <span class='kw'>if</span> <span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span> <span class='op'>!=</span> <span class='int'>0</span>
728
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>lxc.cgroup.cpuset.cpus=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cpuset'>cpuset</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
729
+ <span class='kw'>end</span>
730
+
731
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>lxc.cgroup.memory.limit_in_bytes=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_memory_limit_mb'>memory_limit_mb</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'>M\n</span><span class='tstring_end'>&quot;</span></span>
732
+ <span class='kw'>end</span>
733
+
734
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>creation of container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successful</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
735
+ <span class='kw'>return</span> <span class='id identifier rubyid_output'>output</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
736
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
737
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be created, rolling back...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
738
+
739
+ <span class='comment'># rollback
740
+ </span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
741
+
742
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>+=</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
743
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_output'>output</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
744
+ <span class='kw'>end</span>
745
+ <span class='kw'>end</span></pre>
746
+ </td>
747
+ </tr>
748
+ </table>
749
+ </div>
750
+
751
+ <div class="method_details ">
752
+ <h3 class="signature " id="delete-instance_method">
753
+
754
+ - (<tt>String</tt>) <strong>delete</strong>(name)
755
+
756
+
757
+
758
+
759
+
760
+ </h3><div class="docstring">
761
+ <div class="discussion">
762
+
763
+ <p>Deletes a container with the given name</p>
764
+
765
+
766
+ </div>
767
+ </div>
768
+ <div class="tags">
769
+ <p class="tag_title">Parameters:</p>
770
+ <ul class="param">
771
+
772
+ <li>
773
+
774
+ <span class='name'>name</span>
775
+
776
+
777
+ <span class='type'>(<tt>String</tt>)</span>
778
+
779
+
780
+
781
+ &mdash;
782
+ <div class='inline'>
783
+ <p>The container name</p>
784
+ </div>
785
+
786
+ </li>
787
+
788
+ </ul>
789
+
790
+ <p class="tag_title">Returns:</p>
791
+ <ul class="return">
792
+
793
+ <li>
794
+
795
+
796
+ <span class='type'>(<tt>String</tt>)</span>
797
+
798
+
799
+
800
+ &mdash;
801
+ <div class='inline'>
802
+ <p>CLI output</p>
803
+ </div>
804
+
805
+ </li>
806
+
807
+ </ul>
808
+ <p class="tag_title">Raises:</p>
809
+ <ul class="raise">
810
+
811
+ <li>
812
+
813
+
814
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
815
+
816
+
817
+
818
+ </li>
819
+
820
+ </ul>
821
+
822
+ </div><table class="source_code">
823
+ <tr>
824
+ <td>
825
+ <pre class="lines">
826
+
827
+
828
+ 107
829
+ 108
830
+ 109
831
+ 110
832
+ 111
833
+ 112
834
+ 113
835
+ 114
836
+ 115
837
+ 116
838
+ 117</pre>
839
+ </td>
840
+ <td>
841
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 107</span>
842
+
843
+ <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
844
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$lxc_cmd_destroy</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
845
+
846
+ <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span>
847
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successfully deleted</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
848
+ <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
849
+ <span class='kw'>end</span>
850
+
851
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be deleted</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
852
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
853
+ <span class='kw'>end</span></pre>
854
+ </td>
855
+ </tr>
856
+ </table>
857
+ </div>
858
+
859
+ <div class="method_details ">
860
+ <h3 class="signature " id="exist?-instance_method">
861
+
862
+ - (<tt>Boolean</tt>) <strong>exist?</strong>(name)
863
+
864
+
865
+
866
+
867
+
868
+ </h3><div class="docstring">
869
+ <div class="discussion">
870
+
871
+ <p>Checks if a container with the given name exists</p>
872
+
873
+
874
+ </div>
875
+ </div>
876
+ <div class="tags">
877
+ <p class="tag_title">Parameters:</p>
878
+ <ul class="param">
879
+
880
+ <li>
881
+
882
+ <span class='name'>name</span>
883
+
884
+
885
+ <span class='type'>(<tt>String</tt>)</span>
886
+
887
+
888
+
889
+ &mdash;
890
+ <div class='inline'>
891
+ <p>The container name</p>
892
+ </div>
893
+
894
+ </li>
895
+
896
+ </ul>
897
+
898
+ <p class="tag_title">Returns:</p>
899
+ <ul class="return">
900
+
901
+ <li>
902
+
903
+
904
+ <span class='type'>(<tt>Boolean</tt>)</span>
905
+
906
+
907
+
908
+ &mdash;
909
+ <div class='inline'>
910
+ <p>Existing/not existing</p>
911
+ </div>
912
+
913
+ </li>
914
+
915
+ </ul>
916
+
917
+ </div><table class="source_code">
918
+ <tr>
919
+ <td>
920
+ <pre class="lines">
921
+
922
+
923
+ 196
924
+ 197
925
+ 198</pre>
926
+ </td>
927
+ <td>
928
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 196</span>
929
+
930
+ <span class='kw'>def</span> <span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
931
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_container_names'>container_names</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
932
+ <span class='kw'>end</span></pre>
933
+ </td>
934
+ </tr>
935
+ </table>
936
+ </div>
937
+
938
+ <div class="method_details ">
939
+ <h3 class="signature " id="free_cpu_core_count-instance_method">
940
+
941
+ - (<tt>Integer</tt>) <strong>free_cpu_core_count</strong>(resman)
942
+
943
+
944
+
945
+
946
+
947
+ </h3><div class="docstring">
948
+ <div class="discussion">
949
+
950
+ <p>Returns the amount of free cpu cores</p>
951
+
952
+
953
+ </div>
954
+ </div>
955
+ <div class="tags">
956
+ <p class="tag_title">Parameters:</p>
957
+ <ul class="param">
958
+
959
+ <li>
960
+
961
+ <span class='name'>resman</span>
962
+
963
+
964
+ <span class='type'>(<tt><span class='object_link'><a href="../ResourceManager.html" title="ResourceManager (class)">ResourceManager</a></span></tt>)</span>
965
+
966
+
967
+
968
+ &mdash;
969
+ <div class='inline'>
970
+ <p>A ResourceManager instance</p>
971
+ </div>
972
+
973
+ </li>
974
+
975
+ </ul>
976
+
977
+ <p class="tag_title">Returns:</p>
978
+ <ul class="return">
979
+
980
+ <li>
981
+
982
+
983
+ <span class='type'>(<tt>Integer</tt>)</span>
984
+
985
+
986
+
987
+ &mdash;
988
+ <div class='inline'>
989
+ <p>The amount of free cpu cores</p>
990
+ </div>
991
+
992
+ </li>
993
+
994
+ </ul>
995
+
996
+ </div><table class="source_code">
997
+ <tr>
998
+ <td>
999
+ <pre class="lines">
1000
+
1001
+
1002
+ 205
1003
+ 206
1004
+ 207</pre>
1005
+ </td>
1006
+ <td>
1007
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 205</span>
1008
+
1009
+ <span class='kw'>def</span> <span class='id identifier rubyid_free_cpu_core_count'>free_cpu_core_count</span><span class='lparen'>(</span><span class='id identifier rubyid_resman'>resman</span><span class='rparen'>)</span>
1010
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_free_cpu_cores'>free_cpu_cores</span><span class='lparen'>(</span><span class='id identifier rubyid_resman'>resman</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
1011
+ <span class='kw'>end</span></pre>
1012
+ </td>
1013
+ </tr>
1014
+ </table>
1015
+ </div>
1016
+
1017
+ <div class="method_details ">
1018
+ <h3 class="signature " id="kill-instance_method">
1019
+
1020
+ - (<tt>String</tt>) <strong>kill</strong>(name)
1021
+
1022
+
1023
+
1024
+
1025
+
1026
+ </h3><div class="docstring">
1027
+ <div class="discussion">
1028
+
1029
+ <p>Kills a container with the given name</p>
1030
+
1031
+
1032
+ </div>
1033
+ </div>
1034
+ <div class="tags">
1035
+ <p class="tag_title">Parameters:</p>
1036
+ <ul class="param">
1037
+
1038
+ <li>
1039
+
1040
+ <span class='name'>name</span>
1041
+
1042
+
1043
+ <span class='type'>(<tt>String</tt>)</span>
1044
+
1045
+
1046
+
1047
+ &mdash;
1048
+ <div class='inline'>
1049
+ <p>The container name</p>
1050
+ </div>
1051
+
1052
+ </li>
1053
+
1054
+ </ul>
1055
+
1056
+ <p class="tag_title">Returns:</p>
1057
+ <ul class="return">
1058
+
1059
+ <li>
1060
+
1061
+
1062
+ <span class='type'>(<tt>String</tt>)</span>
1063
+
1064
+
1065
+
1066
+ &mdash;
1067
+ <div class='inline'>
1068
+ <p>CLI output</p>
1069
+ </div>
1070
+
1071
+ </li>
1072
+
1073
+ </ul>
1074
+ <p class="tag_title">Raises:</p>
1075
+ <ul class="raise">
1076
+
1077
+ <li>
1078
+
1079
+
1080
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
1081
+
1082
+
1083
+
1084
+ </li>
1085
+
1086
+ </ul>
1087
+
1088
+ </div><table class="source_code">
1089
+ <tr>
1090
+ <td>
1091
+ <pre class="lines">
1092
+
1093
+
1094
+ 88
1095
+ 89
1096
+ 90
1097
+ 91
1098
+ 92
1099
+ 93
1100
+ 94
1101
+ 95
1102
+ 96
1103
+ 97
1104
+ 98</pre>
1105
+ </td>
1106
+ <td>
1107
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 88</span>
1108
+
1109
+ <span class='kw'>def</span> <span class='id identifier rubyid_kill'>kill</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1110
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$lxc_cmd_kill</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
1111
+
1112
+ <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span>
1113
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successfully killed</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1114
+ <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1115
+ <span class='kw'>end</span>
1116
+
1117
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be killed</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1118
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1119
+ <span class='kw'>end</span></pre>
1120
+ </td>
1121
+ </tr>
1122
+ </table>
1123
+ </div>
1124
+
1125
+ <div class="method_details ">
1126
+ <h3 class="signature " id="start-instance_method">
1127
+
1128
+ - (<tt>String</tt>) <strong>start</strong>(name)
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+ </h3><div class="docstring">
1135
+ <div class="discussion">
1136
+
1137
+ <p>Starts a container with the given name</p>
1138
+
1139
+
1140
+ </div>
1141
+ </div>
1142
+ <div class="tags">
1143
+ <p class="tag_title">Parameters:</p>
1144
+ <ul class="param">
1145
+
1146
+ <li>
1147
+
1148
+ <span class='name'>name</span>
1149
+
1150
+
1151
+ <span class='type'>(<tt>String</tt>)</span>
1152
+
1153
+
1154
+
1155
+ &mdash;
1156
+ <div class='inline'>
1157
+ <p>The container name</p>
1158
+ </div>
1159
+
1160
+ </li>
1161
+
1162
+ </ul>
1163
+
1164
+ <p class="tag_title">Returns:</p>
1165
+ <ul class="return">
1166
+
1167
+ <li>
1168
+
1169
+
1170
+ <span class='type'>(<tt>String</tt>)</span>
1171
+
1172
+
1173
+
1174
+ &mdash;
1175
+ <div class='inline'>
1176
+ <p>CLI output</p>
1177
+ </div>
1178
+
1179
+ </li>
1180
+
1181
+ </ul>
1182
+ <p class="tag_title">Raises:</p>
1183
+ <ul class="raise">
1184
+
1185
+ <li>
1186
+
1187
+
1188
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
1189
+
1190
+
1191
+
1192
+ </li>
1193
+
1194
+ </ul>
1195
+
1196
+ </div><table class="source_code">
1197
+ <tr>
1198
+ <td>
1199
+ <pre class="lines">
1200
+
1201
+
1202
+ 50
1203
+ 51
1204
+ 52
1205
+ 53
1206
+ 54
1207
+ 55
1208
+ 56
1209
+ 57
1210
+ 58
1211
+ 59
1212
+ 60</pre>
1213
+ </td>
1214
+ <td>
1215
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 50</span>
1216
+
1217
+ <span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1218
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$lxc_cmd_start</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
1219
+
1220
+ <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span>
1221
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successfully started</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1222
+ <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1223
+ <span class='kw'>end</span>
1224
+
1225
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be started</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1226
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1227
+ <span class='kw'>end</span></pre>
1228
+ </td>
1229
+ </tr>
1230
+ </table>
1231
+ </div>
1232
+
1233
+ <div class="method_details ">
1234
+ <h3 class="signature " id="stop-instance_method">
1235
+
1236
+ - (<tt>String</tt>) <strong>stop</strong>(name)
1237
+
1238
+
1239
+
1240
+
1241
+
1242
+ </h3><div class="docstring">
1243
+ <div class="discussion">
1244
+
1245
+ <p>Stops a container with the given name</p>
1246
+
1247
+
1248
+ </div>
1249
+ </div>
1250
+ <div class="tags">
1251
+ <p class="tag_title">Parameters:</p>
1252
+ <ul class="param">
1253
+
1254
+ <li>
1255
+
1256
+ <span class='name'>name</span>
1257
+
1258
+
1259
+ <span class='type'>(<tt>String</tt>)</span>
1260
+
1261
+
1262
+
1263
+ &mdash;
1264
+ <div class='inline'>
1265
+ <p>The container name</p>
1266
+ </div>
1267
+
1268
+ </li>
1269
+
1270
+ </ul>
1271
+
1272
+ <p class="tag_title">Returns:</p>
1273
+ <ul class="return">
1274
+
1275
+ <li>
1276
+
1277
+
1278
+ <span class='type'>(<tt>String</tt>)</span>
1279
+
1280
+
1281
+
1282
+ &mdash;
1283
+ <div class='inline'>
1284
+ <p>CLI output</p>
1285
+ </div>
1286
+
1287
+ </li>
1288
+
1289
+ </ul>
1290
+ <p class="tag_title">Raises:</p>
1291
+ <ul class="raise">
1292
+
1293
+ <li>
1294
+
1295
+
1296
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
1297
+
1298
+
1299
+
1300
+ </li>
1301
+
1302
+ </ul>
1303
+
1304
+ </div><table class="source_code">
1305
+ <tr>
1306
+ <td>
1307
+ <pre class="lines">
1308
+
1309
+
1310
+ 69
1311
+ 70
1312
+ 71
1313
+ 72
1314
+ 73
1315
+ 74
1316
+ 75
1317
+ 76
1318
+ 77
1319
+ 78
1320
+ 79</pre>
1321
+ </td>
1322
+ <td>
1323
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/lxc.rb', line 69</span>
1324
+
1325
+ <span class='kw'>def</span> <span class='id identifier rubyid_stop'>stop</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1326
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$lxc_cmd_stop</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
1327
+
1328
+ <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span>
1329
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successfully stopped</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1330
+ <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1331
+ <span class='kw'>end</span>
1332
+
1333
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be stopped</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1334
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1335
+ <span class='kw'>end</span></pre>
1336
+ </td>
1337
+ </tr>
1338
+ </table>
1339
+ </div>
1340
+
1341
+ </div>
1342
+
1343
+ </div>
1344
+
1345
+ <div id="footer">
1346
+ Generated on Mon Jul 20 18:09:05 2015 by
1347
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1348
+ 0.8.7.6 (ruby-2.0.0).
1349
+ </div>
1350
+
1351
+ </body>
1352
+ </html>