elevage 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +21 -0
  4. data/.rubocop.yml +8 -0
  5. data/.ruby-version +1 -0
  6. data/.simplecov +8 -0
  7. data/.travis.yml +3 -0
  8. data/.yardoc/checksums +12 -0
  9. data/.yardoc/object_types +0 -0
  10. data/.yardoc/objects/root.dat +0 -0
  11. data/.yardoc/proxy_types +0 -0
  12. data/Gemfile +4 -0
  13. data/Guardfile +10 -0
  14. data/LICENSE.txt +203 -0
  15. data/README.md +112 -0
  16. data/Rakefile +20 -0
  17. data/bin/elevage +4 -0
  18. data/coverage/.resultset.json.lock +0 -0
  19. data/doc/Elevage/Build.html +435 -0
  20. data/doc/Elevage/CLI.html +282 -0
  21. data/doc/Elevage/Environment.html +950 -0
  22. data/doc/Elevage/Generate.html +346 -0
  23. data/doc/Elevage/Health.html +359 -0
  24. data/doc/Elevage/New.html +411 -0
  25. data/doc/Elevage/Platform.html +1119 -0
  26. data/doc/Elevage/Provisioner.html +804 -0
  27. data/doc/Elevage/ProvisionerRunQueue.html +765 -0
  28. data/doc/Elevage/Runner.html +319 -0
  29. data/doc/Elevage.html +501 -0
  30. data/doc/_index.html +239 -0
  31. data/doc/class_list.html +58 -0
  32. data/doc/css/common.css +1 -0
  33. data/doc/css/full_list.css +57 -0
  34. data/doc/css/style.css +339 -0
  35. data/doc/file.README.html +187 -0
  36. data/doc/file_list.html +60 -0
  37. data/doc/frames.html +26 -0
  38. data/doc/index.html +187 -0
  39. data/doc/js/app.js +219 -0
  40. data/doc/js/full_list.js +181 -0
  41. data/doc/js/jquery.js +4 -0
  42. data/doc/method_list.html +369 -0
  43. data/doc/top-level-namespace.html +112 -0
  44. data/elevage.gemspec +39 -0
  45. data/features/archive +314 -0
  46. data/features/build.feature +237 -0
  47. data/features/elevage.feature +24 -0
  48. data/features/generate.feature +235 -0
  49. data/features/health_env_failure.feature +292 -0
  50. data/features/health_failure.feature +291 -0
  51. data/features/health_success.feature +279 -0
  52. data/features/list.feature +315 -0
  53. data/features/new.feature +68 -0
  54. data/features/step_definitions/elevage_steps.rb +27 -0
  55. data/features/support/env.rb +9 -0
  56. data/lib/elevage/build.rb +109 -0
  57. data/lib/elevage/constants.rb +113 -0
  58. data/lib/elevage/environment.rb +223 -0
  59. data/lib/elevage/generate.rb +48 -0
  60. data/lib/elevage/health.rb +27 -0
  61. data/lib/elevage/new.rb +30 -0
  62. data/lib/elevage/platform.rb +105 -0
  63. data/lib/elevage/provisioner.rb +169 -0
  64. data/lib/elevage/provisionerrunqueue.rb +114 -0
  65. data/lib/elevage/runner.rb +39 -0
  66. data/lib/elevage/templates/compute.yml.tt +18 -0
  67. data/lib/elevage/templates/environment.yml.tt +20 -0
  68. data/lib/elevage/templates/network.yml.tt +16 -0
  69. data/lib/elevage/templates/platform.yml.tt +110 -0
  70. data/lib/elevage/templates/vcenter.yml.tt +77 -0
  71. data/lib/elevage/version.rb +4 -0
  72. data/lib/elevage.rb +45 -0
  73. data/spec/spec_helper.rb +4 -0
  74. metadata +357 -0
@@ -0,0 +1,804 @@
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: Elevage::Provisioner
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#!Elevage/Provisioner.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 (P)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Elevage.html" title="Elevage (module)">Elevage</a></span></span>
36
+ &raquo;
37
+ <span class="title">Provisioner</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: Elevage::Provisioner
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">Elevage::Provisioner</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/elevage/provisioner.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>Provisioner class</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#component-instance_method" title="#component (instance method)">- (Object) <strong>component</strong> </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <span class="summary_desc"><div class='inline'>
141
+ <p>Returns the value of attribute component.</p>
142
+ </div></span>
143
+
144
+ </li>
145
+
146
+
147
+ <li class="public ">
148
+ <span class="summary_signature">
149
+
150
+ <a href="#environment-instance_method" title="#environment (instance method)">- (Object) <strong>environment</strong> </a>
151
+
152
+
153
+
154
+ </span>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'>
168
+ <p>Returns the value of attribute environment.</p>
169
+ </div></span>
170
+
171
+ </li>
172
+
173
+
174
+ <li class="public ">
175
+ <span class="summary_signature">
176
+
177
+ <a href="#instance-instance_method" title="#instance (instance method)">- (Object) <strong>instance</strong> </a>
178
+
179
+
180
+
181
+ </span>
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'>
195
+ <p>Returns the value of attribute instance.</p>
196
+ </div></span>
197
+
198
+ </li>
199
+
200
+
201
+ <li class="public ">
202
+ <span class="summary_signature">
203
+
204
+ <a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong> </a>
205
+
206
+
207
+
208
+ </span>
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+ <span class="summary_desc"><div class='inline'>
222
+ <p>Returns the value of attribute name.</p>
223
+ </div></span>
224
+
225
+ </li>
226
+
227
+
228
+ <li class="public ">
229
+ <span class="summary_signature">
230
+
231
+ <a href="#vcenter-instance_method" title="#vcenter (instance method)">- (Object) <strong>vcenter</strong> </a>
232
+
233
+
234
+
235
+ </span>
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'>
249
+ <p>Returns the value of attribute vcenter.</p>
250
+ </div></span>
251
+
252
+ </li>
253
+
254
+
255
+ </ul>
256
+
257
+
258
+
259
+
260
+
261
+ <h2>
262
+ Instance Method Summary
263
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
264
+ </h2>
265
+
266
+ <ul class="summary">
267
+
268
+ <li class="public ">
269
+ <span class="summary_signature">
270
+
271
+ <a href="#build-instance_method" title="#build (instance method)">- (Object) <strong>build</strong> </a>
272
+
273
+
274
+
275
+ </span>
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+ <span class="summary_desc"><div class='inline'>
286
+ <p>Public: Build the node rubocop:disable MethodLength, LineLength,
287
+ GlobalVars, CyclomaticComplexity.</p>
288
+ </div></span>
289
+
290
+ </li>
291
+
292
+
293
+ <li class="public ">
294
+ <span class="summary_signature">
295
+
296
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Provisioner) <strong>initialize</strong>(name, component, instance, environment, options) </a>
297
+
298
+
299
+
300
+ </span>
301
+
302
+
303
+ <span class="note title constructor">constructor</span>
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+ <span class="summary_desc"><div class='inline'>
313
+ <p>Set us up to build the specified instance of component.</p>
314
+ </div></span>
315
+
316
+ </li>
317
+
318
+
319
+ <li class="public ">
320
+ <span class="summary_signature">
321
+
322
+ <a href="#to_s-instance_method" title="#to_s (instance method)">- (Object) <strong>to_s</strong> </a>
323
+
324
+
325
+
326
+ </span>
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+ <span class="summary_desc"><div class='inline'></div></span>
337
+
338
+ </li>
339
+
340
+
341
+ </ul>
342
+
343
+
344
+ <div id="constructor_details" class="method_details_list">
345
+ <h2>Constructor Details</h2>
346
+
347
+ <div class="method_details first">
348
+ <h3 class="signature first" id="initialize-instance_method">
349
+
350
+ - (<tt><span class='object_link'><a href="" title="Elevage::Provisioner (class)">Provisioner</a></span></tt>) <strong>initialize</strong>(name, component, instance, environment, options)
351
+
352
+
353
+
354
+
355
+
356
+ </h3><div class="docstring">
357
+ <div class="discussion">
358
+
359
+ <p>Set us up to build the specified instance of component</p>
360
+
361
+
362
+ </div>
363
+ </div>
364
+ <div class="tags">
365
+
366
+
367
+ </div><table class="source_code">
368
+ <tr>
369
+ <td>
370
+ <pre class="lines">
371
+
372
+
373
+ 17
374
+ 18
375
+ 19
376
+ 20
377
+ 21
378
+ 22
379
+ 23
380
+ 24</pre>
381
+ </td>
382
+ <td>
383
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 17</span>
384
+
385
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='id identifier rubyid_instance'>instance</span><span class='comma'>,</span> <span class='id identifier rubyid_environment'>environment</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
386
+ <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
387
+ <span class='ivar'>@component</span> <span class='op'>=</span> <span class='id identifier rubyid_component'>component</span>
388
+ <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='id identifier rubyid_instance'>instance</span>
389
+ <span class='ivar'>@environment</span> <span class='op'>=</span> <span class='id identifier rubyid_environment'>environment</span>
390
+ <span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span>
391
+ <span class='ivar'>@vcenter</span> <span class='op'>=</span> <span class='ivar'>@environment</span><span class='period'>.</span><span class='id identifier rubyid_vcenter'>vcenter</span>
392
+ <span class='kw'>end</span></pre>
393
+ </td>
394
+ </tr>
395
+ </table>
396
+ </div>
397
+
398
+ </div>
399
+
400
+ <div id="instance_attr_details" class="attr_details">
401
+ <h2>Instance Attribute Details</h2>
402
+
403
+
404
+ <span id="component=-instance_method"></span>
405
+ <div class="method_details first">
406
+ <h3 class="signature first" id="component-instance_method">
407
+
408
+ - (<tt>Object</tt>) <strong>component</strong>
409
+
410
+
411
+
412
+
413
+
414
+ </h3><div class="docstring">
415
+ <div class="discussion">
416
+
417
+ <p>Returns the value of attribute component</p>
418
+
419
+
420
+ </div>
421
+ </div>
422
+ <div class="tags">
423
+
424
+
425
+ </div><table class="source_code">
426
+ <tr>
427
+ <td>
428
+ <pre class="lines">
429
+
430
+
431
+ 11
432
+ 12
433
+ 13</pre>
434
+ </td>
435
+ <td>
436
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 11</span>
437
+
438
+ <span class='kw'>def</span> <span class='id identifier rubyid_component'>component</span>
439
+ <span class='ivar'>@component</span>
440
+ <span class='kw'>end</span></pre>
441
+ </td>
442
+ </tr>
443
+ </table>
444
+ </div>
445
+
446
+
447
+ <span id="environment=-instance_method"></span>
448
+ <div class="method_details ">
449
+ <h3 class="signature " id="environment-instance_method">
450
+
451
+ - (<tt>Object</tt>) <strong>environment</strong>
452
+
453
+
454
+
455
+
456
+
457
+ </h3><div class="docstring">
458
+ <div class="discussion">
459
+
460
+ <p>Returns the value of attribute environment</p>
461
+
462
+
463
+ </div>
464
+ </div>
465
+ <div class="tags">
466
+
467
+
468
+ </div><table class="source_code">
469
+ <tr>
470
+ <td>
471
+ <pre class="lines">
472
+
473
+
474
+ 13
475
+ 14
476
+ 15</pre>
477
+ </td>
478
+ <td>
479
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 13</span>
480
+
481
+ <span class='kw'>def</span> <span class='id identifier rubyid_environment'>environment</span>
482
+ <span class='ivar'>@environment</span>
483
+ <span class='kw'>end</span></pre>
484
+ </td>
485
+ </tr>
486
+ </table>
487
+ </div>
488
+
489
+
490
+ <span id="instance=-instance_method"></span>
491
+ <div class="method_details ">
492
+ <h3 class="signature " id="instance-instance_method">
493
+
494
+ - (<tt>Object</tt>) <strong>instance</strong>
495
+
496
+
497
+
498
+
499
+
500
+ </h3><div class="docstring">
501
+ <div class="discussion">
502
+
503
+ <p>Returns the value of attribute instance</p>
504
+
505
+
506
+ </div>
507
+ </div>
508
+ <div class="tags">
509
+
510
+
511
+ </div><table class="source_code">
512
+ <tr>
513
+ <td>
514
+ <pre class="lines">
515
+
516
+
517
+ 12
518
+ 13
519
+ 14</pre>
520
+ </td>
521
+ <td>
522
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 12</span>
523
+
524
+ <span class='kw'>def</span> <span class='id identifier rubyid_instance'>instance</span>
525
+ <span class='ivar'>@instance</span>
526
+ <span class='kw'>end</span></pre>
527
+ </td>
528
+ </tr>
529
+ </table>
530
+ </div>
531
+
532
+
533
+ <span id="name=-instance_method"></span>
534
+ <div class="method_details ">
535
+ <h3 class="signature " id="name-instance_method">
536
+
537
+ - (<tt>Object</tt>) <strong>name</strong>
538
+
539
+
540
+
541
+
542
+
543
+ </h3><div class="docstring">
544
+ <div class="discussion">
545
+
546
+ <p>Returns the value of attribute name</p>
547
+
548
+
549
+ </div>
550
+ </div>
551
+ <div class="tags">
552
+
553
+
554
+ </div><table class="source_code">
555
+ <tr>
556
+ <td>
557
+ <pre class="lines">
558
+
559
+
560
+ 10
561
+ 11
562
+ 12</pre>
563
+ </td>
564
+ <td>
565
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 10</span>
566
+
567
+ <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
568
+ <span class='ivar'>@name</span>
569
+ <span class='kw'>end</span></pre>
570
+ </td>
571
+ </tr>
572
+ </table>
573
+ </div>
574
+
575
+
576
+ <span id="vcenter=-instance_method"></span>
577
+ <div class="method_details ">
578
+ <h3 class="signature " id="vcenter-instance_method">
579
+
580
+ - (<tt>Object</tt>) <strong>vcenter</strong>
581
+
582
+
583
+
584
+
585
+
586
+ </h3><div class="docstring">
587
+ <div class="discussion">
588
+
589
+ <p>Returns the value of attribute vcenter</p>
590
+
591
+
592
+ </div>
593
+ </div>
594
+ <div class="tags">
595
+
596
+
597
+ </div><table class="source_code">
598
+ <tr>
599
+ <td>
600
+ <pre class="lines">
601
+
602
+
603
+ 14
604
+ 15
605
+ 16</pre>
606
+ </td>
607
+ <td>
608
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 14</span>
609
+
610
+ <span class='kw'>def</span> <span class='id identifier rubyid_vcenter'>vcenter</span>
611
+ <span class='ivar'>@vcenter</span>
612
+ <span class='kw'>end</span></pre>
613
+ </td>
614
+ </tr>
615
+ </table>
616
+ </div>
617
+
618
+ </div>
619
+
620
+
621
+ <div id="instance_method_details" class="method_details_list">
622
+ <h2>Instance Method Details</h2>
623
+
624
+
625
+ <div class="method_details first">
626
+ <h3 class="signature first" id="build-instance_method">
627
+
628
+ - (<tt>Object</tt>) <strong>build</strong>
629
+
630
+
631
+
632
+
633
+
634
+ </h3><div class="docstring">
635
+ <div class="discussion">
636
+
637
+ <p>Public: Build the node rubocop:disable MethodLength, LineLength,
638
+ GlobalVars, CyclomaticComplexity</p>
639
+
640
+
641
+ </div>
642
+ </div>
643
+ <div class="tags">
644
+
645
+
646
+ </div><table class="source_code">
647
+ <tr>
648
+ <td>
649
+ <pre class="lines">
650
+
651
+
652
+ 37
653
+ 38
654
+ 39
655
+ 40
656
+ 41
657
+ 42
658
+ 43
659
+ 44
660
+ 45
661
+ 46
662
+ 47
663
+ 48
664
+ 49
665
+ 50
666
+ 51
667
+ 52
668
+ 53
669
+ 54
670
+ 55
671
+ 56
672
+ 57
673
+ 58
674
+ 59
675
+ 60
676
+ 61
677
+ 62
678
+ 63
679
+ 64
680
+ 65
681
+ 66
682
+ 67
683
+ 68
684
+ 69
685
+ 70
686
+ 71
687
+ 72
688
+ 73
689
+ 74
690
+ 75
691
+ 76
692
+ 77
693
+ 78
694
+ 79
695
+ 80
696
+ 81
697
+ 82</pre>
698
+ </td>
699
+ <td>
700
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 37</span>
701
+
702
+ <span class='kw'>def</span> <span class='id identifier rubyid_build'>build</span>
703
+ <span class='id identifier rubyid_knife_cmd'>knife_cmd</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_knife_cmd'>generate_knife_cmd</span>
704
+
705
+ <span class='comment'># Modify behavior for dry-run
706
+ </span> <span class='comment'># Echo command to stdout and logfile instead of executing command.
707
+ </span> <span class='kw'>if</span> <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>dry-run</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
708
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_knife_cmd'>knife_cmd</span>
709
+ <span class='id identifier rubyid_knife_cmd'>knife_cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>echo </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_knife_cmd'>knife_cmd</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
710
+ <span class='kw'>end</span>
711
+
712
+ <span class='comment'># Open the logfile for writing
713
+ </span> <span class='id identifier rubyid_logfile'>logfile</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:logfiles</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>.log</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>w</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
714
+
715
+ <span class='id identifier rubyid_stamp'>stamp</span> <span class='op'>=</span> <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>dry-run</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='embexpr_end'>}</span><span class='tstring_content'> [</span><span class='embexpr_beg'>#{</span><span class='gvar'>$$</span><span class='embexpr_end'>}</span><span class='tstring_content'>]: </span><span class='tstring_end'>&quot;</span></span>
716
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_stamp'>stamp</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: logging to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_logfile'>logfile</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
717
+ <span class='id identifier rubyid_logfile'>logfile</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_stamp'>stamp</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: Provisioning.</span><span class='tstring_end'>&quot;</span></span>
718
+
719
+ <span class='comment'># Execute the knife command, capturing stderr and stdout as they
720
+ </span> <span class='comment'># produce anything, and push it all into a Queue object, which we then
721
+ </span> <span class='comment'># write to the log file as things come available.
722
+ </span> <span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='const'>Open4</span><span class='period'>.</span><span class='id identifier rubyid_popen4'>popen4</span><span class='lparen'>(</span><span class='id identifier rubyid_knife_cmd'>knife_cmd</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__pid'>_pid</span><span class='comma'>,</span> <span class='id identifier rubyid__stdin'>_stdin</span><span class='comma'>,</span> <span class='id identifier rubyid_stdout'>stdout</span><span class='comma'>,</span> <span class='id identifier rubyid_stderr'>stderr</span><span class='op'>|</span>
723
+ <span class='id identifier rubyid_sem'>sem</span> <span class='op'>=</span> <span class='const'>Mutex</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
724
+ <span class='comment'># Set and forget the thread for stderr...
725
+ </span> <span class='comment'># err_thread = Thread.new do
726
+ </span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
727
+ <span class='kw'>while</span> <span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span> <span class='op'>=</span> <span class='id identifier rubyid_stderr'>stderr</span><span class='period'>.</span><span class='id identifier rubyid_gets'>gets</span><span class='rparen'>)</span>
728
+ <span class='id identifier rubyid_sem'>sem</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_logfile'>logfile</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_line'>line</span> <span class='rbrace'>}</span>
729
+ <span class='kw'>end</span>
730
+ <span class='kw'>end</span>
731
+ <span class='id identifier rubyid_out_thread'>out_thread</span> <span class='op'>=</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
732
+ <span class='kw'>while</span> <span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span> <span class='op'>=</span> <span class='id identifier rubyid_stdout'>stdout</span><span class='period'>.</span><span class='id identifier rubyid_gets'>gets</span><span class='rparen'>)</span>
733
+ <span class='id identifier rubyid_sem'>sem</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_logfile'>logfile</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_line'>line</span> <span class='rbrace'>}</span>
734
+ <span class='kw'>end</span>
735
+ <span class='kw'>end</span>
736
+ <span class='id identifier rubyid_out_thread'>out_thread</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
737
+ <span class='comment'># err_thread.exit
738
+ </span> <span class='kw'>end</span>
739
+
740
+ <span class='id identifier rubyid_stamp'>stamp</span> <span class='op'>=</span> <span class='ivar'>@options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>dry-run</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='embexpr_end'>}</span><span class='tstring_content'> [</span><span class='embexpr_beg'>#{</span><span class='gvar'>$$</span><span class='embexpr_end'>}</span><span class='tstring_content'>]: </span><span class='tstring_end'>&quot;</span></span>
741
+ <span class='id identifier rubyid_logfile'>logfile</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_stamp'>stamp</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: exit status: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
742
+ <span class='id identifier rubyid_logfile'>logfile</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
743
+
744
+ <span class='comment'># Inform our master whether we succeeded or failed. Any non-zero
745
+ </span> <span class='comment'># exit status is a failure, and the details will be in the logfile
746
+ </span> <span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
747
+ <span class='kw'>end</span></pre>
748
+ </td>
749
+ </tr>
750
+ </table>
751
+ </div>
752
+
753
+ <div class="method_details ">
754
+ <h3 class="signature " id="to_s-instance_method">
755
+
756
+ - (<tt>Object</tt>) <strong>to_s</strong>
757
+
758
+
759
+
760
+
761
+
762
+ </h3><table class="source_code">
763
+ <tr>
764
+ <td>
765
+ <pre class="lines">
766
+
767
+
768
+ 26
769
+ 27
770
+ 28
771
+ 29
772
+ 30
773
+ 31
774
+ 32
775
+ 33</pre>
776
+ </td>
777
+ <td>
778
+ <pre class="code"><span class="info file"># File 'lib/elevage/provisioner.rb', line 26</span>
779
+
780
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
781
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Name: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
782
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Instance: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@instance</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
783
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Component: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@component</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
784
+ <span class='id identifier rubyid_puts'>puts</span> <span class='ivar'>@component</span><span class='period'>.</span><span class='id identifier rubyid_to_yaml'>to_yaml</span>
785
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Environment:</span><span class='tstring_end'>&#39;</span></span>
786
+ <span class='id identifier rubyid_puts'>puts</span> <span class='ivar'>@environment</span><span class='period'>.</span><span class='id identifier rubyid_to_yaml'>to_yaml</span>
787
+ <span class='kw'>end</span></pre>
788
+ </td>
789
+ </tr>
790
+ </table>
791
+ </div>
792
+
793
+ </div>
794
+
795
+ </div>
796
+
797
+ <div id="footer">
798
+ Generated on Tue Nov 11 17:39:23 2014 by
799
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
800
+ 0.8.7.6 (ruby-2.1.2).
801
+ </div>
802
+
803
+ </body>
804
+ </html>