svengali 0.2.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/LICENSE +20 -0
  2. data/README +0 -0
  3. data/README.rdoc +17 -0
  4. data/Rakefile +47 -0
  5. data/VERSION +1 -0
  6. data/api_document020_en.pdf +0 -0
  7. data/api_document020_ja.pdf +0 -0
  8. data/api_document_en.pptx +0 -0
  9. data/api_document_ja.pptx +0 -0
  10. data/lib/svengali.rb +2 -0
  11. data/lib/svengali/config.rb +78 -0
  12. data/lib/svengali/ext_string.rb +55 -0
  13. data/lib/svengali/ext_string/command.yml +6 -0
  14. data/lib/svengali/ext_string/path.yml +6 -0
  15. data/lib/svengali/file_io.rb +106 -0
  16. data/lib/svengali/machine.rb +123 -0
  17. data/lib/svengali/platforms/debian.rb +5 -0
  18. data/lib/svengali/platforms/default.rb +4 -0
  19. data/lib/svengali/plugins/eucalyptus.rb +339 -0
  20. data/lib/svengali/plugins/machine_config.rb +126 -0
  21. data/lib/svengali/plugins/package.rb +7 -0
  22. data/lib/svengali/ssh.rb +106 -0
  23. data/lib/svengali/svengali.rb +19 -0
  24. data/lib/svengali/util.rb +117 -0
  25. data/rdoc/classes/CLibIPAddr.html +230 -0
  26. data/rdoc/classes/Cloud.html +506 -0
  27. data/rdoc/classes/Config.html +151 -0
  28. data/rdoc/classes/Config/ConfigFile.html +319 -0
  29. data/rdoc/classes/ExtStr.html +209 -0
  30. data/rdoc/classes/ExtStrAccessor.html +183 -0
  31. data/rdoc/classes/FileIO.html +415 -0
  32. data/rdoc/classes/Machine.html +771 -0
  33. data/rdoc/classes/MachineMaster.html +117 -0
  34. data/rdoc/classes/Platform.html +121 -0
  35. data/rdoc/classes/SSH.html +315 -0
  36. data/rdoc/created.rid +1 -0
  37. data/rdoc/files/README.html +101 -0
  38. data/rdoc/files/README_rdoc.html +133 -0
  39. data/rdoc/files/lib/svengali/config_rb.html +114 -0
  40. data/rdoc/files/lib/svengali/ext_string_rb.html +108 -0
  41. data/rdoc/files/lib/svengali/file_io_rb.html +115 -0
  42. data/rdoc/files/lib/svengali/machine_rb.html +108 -0
  43. data/rdoc/files/lib/svengali/platforms/debian_rb.html +107 -0
  44. data/rdoc/files/lib/svengali/platforms/default_rb.html +107 -0
  45. data/rdoc/files/lib/svengali/plugins/eucalyptus_rb.html +389 -0
  46. data/rdoc/files/lib/svengali/plugins/machine_config_rb.html +101 -0
  47. data/rdoc/files/lib/svengali/plugins/package_rb.html +101 -0
  48. data/rdoc/files/lib/svengali/ssh_rb.html +110 -0
  49. data/rdoc/files/lib/svengali/svengali_rb.html +125 -0
  50. data/rdoc/files/lib/svengali/util_rb.html +439 -0
  51. data/rdoc/files/lib/svengali_rb.html +108 -0
  52. data/rdoc/fr_class_index.html +37 -0
  53. data/rdoc/fr_file_index.html +41 -0
  54. data/rdoc/fr_method_index.html +100 -0
  55. data/rdoc/index.html +26 -0
  56. data/rdoc/rdoc-style.css +208 -0
  57. data/spec/spec.opts +1 -0
  58. data/spec/spec_helper.rb +9 -0
  59. data/spec/svengali_spec.rb +7 -0
  60. data/svengali.gemspec +113 -0
  61. data/svengali_sample.rb +43 -0
  62. data/test/scenario.sh +3 -0
  63. metadata +179 -0
@@ -0,0 +1,115 @@
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>File: file_io.rb</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="fileHeader">
50
+ <h1>file_io.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/svengali/file_io.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Jun 12 15:28:10 +0900 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ in this file methods for file trasfer is defined
74
+ </p>
75
+
76
+ </div>
77
+
78
+ <div id="requires-list">
79
+ <h3 class="section-bar">Required files</h3>
80
+
81
+ <div class="name-list">
82
+ rubygems&nbsp;&nbsp;
83
+ net/sftp&nbsp;&nbsp;
84
+ </div>
85
+ </div>
86
+
87
+ </div>
88
+
89
+
90
+ </div>
91
+
92
+
93
+ <!-- if includes -->
94
+
95
+ <div id="section">
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <!-- if method_list -->
105
+
106
+
107
+ </div>
108
+
109
+
110
+ <div id="validator-badges">
111
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
112
+ </div>
113
+
114
+ </body>
115
+ </html>
@@ -0,0 +1,108 @@
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>File: machine.rb</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="fileHeader">
50
+ <h1>machine.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/svengali/machine.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Sep 06 21:52:28 +0900 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ thread&nbsp;&nbsp;
77
+ </div>
78
+ </div>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+
86
+ <!-- if includes -->
87
+
88
+ <div id="section">
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <!-- if method_list -->
98
+
99
+
100
+ </div>
101
+
102
+
103
+ <div id="validator-badges">
104
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
105
+ </div>
106
+
107
+ </body>
108
+ </html>
@@ -0,0 +1,107 @@
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>File: debian.rb</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="fileHeader">
50
+ <h1>debian.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/svengali/platforms/debian.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Jun 12 15:28:10 +0900 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ Debian
74
+ </p>
75
+
76
+ </div>
77
+
78
+
79
+ </div>
80
+
81
+
82
+ </div>
83
+
84
+
85
+ <!-- if includes -->
86
+
87
+ <div id="section">
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <!-- if method_list -->
97
+
98
+
99
+ </div>
100
+
101
+
102
+ <div id="validator-badges">
103
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
104
+ </div>
105
+
106
+ </body>
107
+ </html>
@@ -0,0 +1,107 @@
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>File: default.rb</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="fileHeader">
50
+ <h1>default.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/svengali/platforms/default.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Jun 12 15:28:10 +0900 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ defualt platform: CentOS
74
+ </p>
75
+
76
+ </div>
77
+
78
+
79
+ </div>
80
+
81
+
82
+ </div>
83
+
84
+
85
+ <!-- if includes -->
86
+
87
+ <div id="section">
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <!-- if method_list -->
97
+
98
+
99
+ </div>
100
+
101
+
102
+ <div id="validator-badges">
103
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
104
+ </div>
105
+
106
+ </body>
107
+ </html>
@@ -0,0 +1,389 @@
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>File: eucalyptus.rb</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="fileHeader">
50
+ <h1>eucalyptus.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/svengali/plugins/eucalyptus.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Jun 12 15:55:44 +0900 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ timeout&nbsp;&nbsp;
77
+ yaml&nbsp;&nbsp;
78
+ </div>
79
+ </div>
80
+
81
+ </div>
82
+
83
+ <div id="method-list">
84
+ <h3 class="section-bar">Methods</h3>
85
+
86
+ <div class="name-list">
87
+ <a href="#M000018">delete_image</a>&nbsp;&nbsp;
88
+ <a href="#M000016">get_all_instance_id</a>&nbsp;&nbsp;
89
+ <a href="#M000012">get_instance_state</a>&nbsp;&nbsp;
90
+ <a href="#M000013">run_image</a>&nbsp;&nbsp;
91
+ <a href="#M000014">terminate_instance</a>&nbsp;&nbsp;
92
+ <a href="#M000015">terminate_instance_all</a>&nbsp;&nbsp;
93
+ <a href="#M000017">upload_and_register_image</a>&nbsp;&nbsp;
94
+ </div>
95
+ </div>
96
+
97
+ </div>
98
+
99
+
100
+ <!-- if includes -->
101
+
102
+ <div id="section">
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <!-- if method_list -->
112
+ <div id="methods">
113
+ <h3 class="section-bar">Public Instance methods</h3>
114
+
115
+ <div id="method-M000018" class="method-detail">
116
+ <a name="M000018"></a>
117
+
118
+ <div class="method-heading">
119
+ <a href="#M000018" class="method-signature">
120
+ <span class="method-name">delete_image</span><span class="method-args">(image_id_str)</span>
121
+ </a>
122
+ </div>
123
+
124
+ <div class="method-description">
125
+ <p>
126
+ deregister specified image and delete images on server
127
+ </p>
128
+ <p><a class="source-toggle" href="#"
129
+ onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
130
+ <div class="method-source-code" id="M000018-source">
131
+ <pre>
132
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 106</span>
133
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_image</span>(<span class="ruby-identifier">image_id_str</span>)
134
+ <span class="ruby-node">`euca-deregister #{image_id_str}`</span>
135
+ <span class="ruby-identifier">bucket_and_image</span> = <span class="ruby-identifier">get_bucket_and_image_name_by_id</span>(<span class="ruby-identifier">image_id_str</span>)
136
+
137
+ <span class="ruby-node">`euca-delete-bundle -b #{bucket_and_image[:bucket]} -p #{bucket_and_image[:image]} --clear`</span>
138
+
139
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;deregisterd and deleted #{image_id_str}&quot;</span>
140
+ <span class="ruby-keyword kw">end</span>
141
+ </pre>
142
+ </div>
143
+ </div>
144
+ </div>
145
+
146
+ <div id="method-M000016" class="method-detail">
147
+ <a name="M000016"></a>
148
+
149
+ <div class="method-heading">
150
+ <a href="#M000016" class="method-signature">
151
+ <span class="method-name">get_all_instance_id</span><span class="method-args">()</span>
152
+ </a>
153
+ </div>
154
+
155
+ <div class="method-description">
156
+ <p>
157
+ return -&gt; array : like this
158
+ </p>
159
+ <pre>
160
+ [&quot;i-xxxx&quot;,&quot;i-xxxx&quot;,&quot;i-xxxx&quot;,...]
161
+ </pre>
162
+ <p><a class="source-toggle" href="#"
163
+ onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
164
+ <div class="method-source-code" id="M000016-source">
165
+ <pre>
166
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 66</span>
167
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_all_instance_id</span>()
168
+ <span class="ruby-identifier">ret_arr</span> = <span class="ruby-value">`euca-describe-instances`</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\s+(i-\w+)\s+/</span>)
169
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-identifier">ret_arr</span>.<span class="ruby-identifier">inspect</span>()
170
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret_arr</span>
171
+ <span class="ruby-keyword kw">end</span>
172
+ </pre>
173
+ </div>
174
+ </div>
175
+ </div>
176
+
177
+ <div id="method-M000012" class="method-detail">
178
+ <a name="M000012"></a>
179
+
180
+ <div class="method-heading">
181
+ <a href="#M000012" class="method-signature">
182
+ <span class="method-name">get_instance_state</span><span class="method-args">(instance_id_str)</span>
183
+ </a>
184
+ </div>
185
+
186
+ <div class="method-description">
187
+ <p>
188
+ return -&gt; symbol : one of values below
189
+ </p>
190
+ <pre>
191
+ :running, :pending, :shutdown, :terminated
192
+ </pre>
193
+ <p><a class="source-toggle" href="#"
194
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
195
+ <div class="method-source-code" id="M000012-source">
196
+ <pre>
197
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 6</span>
198
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_instance_state</span>(<span class="ruby-identifier">instance_id_str</span>)
199
+ <span class="ruby-identifier">exec_result</span> = <span class="ruby-value str">&quot;&quot;</span>
200
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">exec_result</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
201
+ <span class="ruby-identifier">exec_result</span> = <span class="ruby-node">`euca-describe-instances #{instance_id_str}`</span>
202
+ <span class="ruby-keyword kw">end</span>
203
+
204
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exec_result</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;pending&quot;</span>)
205
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:pending</span>
206
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">exec_result</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;running&quot;</span>)
207
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:running</span>
208
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">exec_result</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;shutting-down&quot;</span>)
209
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:shutdown</span>
210
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">exec_result</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;terminated&quot;</span>)
211
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:terminated</span>
212
+ <span class="ruby-keyword kw">end</span>
213
+ <span class="ruby-keyword kw">end</span>
214
+ </pre>
215
+ </div>
216
+ </div>
217
+ </div>
218
+
219
+ <div id="method-M000013" class="method-detail">
220
+ <a name="M000013"></a>
221
+
222
+ <div class="method-heading">
223
+ <a href="#M000013" class="method-signature">
224
+ <span class="method-name">run_image</span><span class="method-args">(image_id_str)</span>
225
+ </a>
226
+ </div>
227
+
228
+ <div class="method-description">
229
+ <p>
230
+ return -&gt; string: id of running instance this function..
231
+ </p>
232
+ <pre>
233
+ blocks until kicked image starts running
234
+ uses c1.medium machine spec
235
+ </pre>
236
+ <p><a class="source-toggle" href="#"
237
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
238
+ <div class="method-source-code" id="M000013-source">
239
+ <pre>
240
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 27</span>
241
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_image</span>(<span class="ruby-identifier">image_id_str</span>)
242
+ <span class="ruby-keyword kw">begin</span>
243
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;trying kick instance from image #{image_id_str}&quot;</span>
244
+ <span class="ruby-identifier">instance_id</span> = <span class="ruby-node">`euca-run-instances #{image_id_str} -t c1.medium`</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\s+(i-\w+)\s+/</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
245
+ <span class="ruby-keyword kw">rescue</span>
246
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;retry!&quot;</span>
247
+ <span class="ruby-keyword kw">retry</span>
248
+ <span class="ruby-keyword kw">end</span>
249
+
250
+ <span class="ruby-comment cmt"># waits until instance finishes booting</span>
251
+ <span class="ruby-keyword kw">while</span>(<span class="ruby-identifier">get_instance_state</span>(<span class="ruby-identifier">instance_id</span>) <span class="ruby-operator">!=</span> <span class="ruby-identifier">:running</span>)
252
+ <span class="ruby-keyword kw">end</span>
253
+
254
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;instance( #{instance_id} ) has been running successfully.&quot;</span>
255
+
256
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_id</span>
257
+ <span class="ruby-keyword kw">end</span>
258
+ </pre>
259
+ </div>
260
+ </div>
261
+ </div>
262
+
263
+ <div id="method-M000014" class="method-detail">
264
+ <a name="M000014"></a>
265
+
266
+ <div class="method-heading">
267
+ <a href="#M000014" class="method-signature">
268
+ <span class="method-name">terminate_instance</span><span class="method-args">(instance_id_str)</span>
269
+ </a>
270
+ </div>
271
+
272
+ <div class="method-description">
273
+ <p>
274
+ this method blocks until the instance finishs terminating
275
+ </p>
276
+ <p><a class="source-toggle" href="#"
277
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
278
+ <div class="method-source-code" id="M000014-source">
279
+ <pre>
280
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 46</span>
281
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">terminate_instance</span>(<span class="ruby-identifier">instance_id_str</span>)
282
+ <span class="ruby-node">`euca-terminate-instances #{instance_id_str}`</span>
283
+
284
+ <span class="ruby-keyword kw">while</span>(<span class="ruby-identifier">get_instance_state</span>(<span class="ruby-identifier">instance_id_str</span>) <span class="ruby-operator">!=</span> <span class="ruby-identifier">:terminated</span>)
285
+ <span class="ruby-keyword kw">end</span>
286
+
287
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;instance( #{instance_id_str} ) has been terminated successfully.&quot;</span>
288
+ <span class="ruby-keyword kw">end</span>
289
+ </pre>
290
+ </div>
291
+ </div>
292
+ </div>
293
+
294
+ <div id="method-M000015" class="method-detail">
295
+ <a name="M000015"></a>
296
+
297
+ <div class="method-heading">
298
+ <a href="#M000015" class="method-signature">
299
+ <span class="method-name">terminate_instance_all</span><span class="method-args">()</span>
300
+ </a>
301
+ </div>
302
+
303
+ <div class="method-description">
304
+ <p>
305
+ this method blocks until the instance finishs terminating
306
+ </p>
307
+ <p><a class="source-toggle" href="#"
308
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
309
+ <div class="method-source-code" id="M000015-source">
310
+ <pre>
311
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 56</span>
312
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">terminate_instance_all</span>()
313
+ <span class="ruby-identifier">instance_id_arr</span> = <span class="ruby-identifier">get_all_instance_id</span>()
314
+
315
+ <span class="ruby-identifier">instance_id_arr</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">instance_id</span><span class="ruby-operator">|</span>
316
+ <span class="ruby-identifier">terminate_instance</span>(<span class="ruby-identifier">instance_id</span>)
317
+ }
318
+ <span class="ruby-keyword kw">end</span>
319
+ </pre>
320
+ </div>
321
+ </div>
322
+ </div>
323
+
324
+ <div id="method-M000017" class="method-detail">
325
+ <a name="M000017"></a>
326
+
327
+ <div class="method-heading">
328
+ <a href="#M000017" class="method-signature">
329
+ <span class="method-name">upload_and_register_image</span><span class="method-args">(image_path_str,timeout_sec = nil)</span>
330
+ </a>
331
+ </div>
332
+
333
+ <div class="method-description">
334
+ <p>
335
+ return -&gt; string: image id when timeout, returns nil
336
+ </p>
337
+ <p><a class="source-toggle" href="#"
338
+ onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
339
+ <div class="method-source-code" id="M000017-source">
340
+ <pre>
341
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 74</span>
342
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upload_and_register_image</span>(<span class="ruby-identifier">image_path_str</span>,<span class="ruby-identifier">timeout_sec</span> = <span class="ruby-keyword kw">nil</span>)
343
+ <span class="ruby-node">`euca-bundle-image -i #{image_path_str}`</span>
344
+ <span class="ruby-identifier">dir_name</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">image_path_str</span>)
345
+ <span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">dir_name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;.&quot;</span>)
346
+ <span class="ruby-identifier">bucket_and_image_name</span> = <span class="ruby-identifier">image_path_str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;./&quot;</span>,<span class="ruby-value str">&quot;&quot;</span>)
347
+ <span class="ruby-keyword kw">else</span>
348
+ <span class="ruby-identifier">bucket_and_image_name</span> = <span class="ruby-identifier">image_path_str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">dir_name</span>,<span class="ruby-value str">&quot;&quot;</span>)
349
+ <span class="ruby-keyword kw">end</span>
350
+
351
+ <span class="ruby-keyword kw">begin</span>
352
+ <span class="ruby-identifier">timeout</span>(<span class="ruby-identifier">timeout_sec</span>) <span class="ruby-keyword kw">do</span>
353
+ <span class="ruby-node">`euca-upload-bundle -b #{bucket_and_image_name} -m /tmp/#{bucket_and_image_name}.manifest.xml`</span>
354
+ <span class="ruby-keyword kw">end</span>
355
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">TimeoutError</span>
356
+ <span class="ruby-value str">&quot;Too long time elapsed to upload image file. It is highly possible that uploading is missed&quot;</span>
357
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
358
+ <span class="ruby-keyword kw">end</span>
359
+
360
+ <span class="ruby-keyword kw">begin</span>
361
+ <span class="ruby-identifier">image_id</span> = <span class="ruby-node">`euca-register #{bucket_and_image_name}/#{bucket_and_image_name}.manifest.xml`</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/IMAGE\s+(emi\-\w+)\s*/</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
362
+ <span class="ruby-keyword kw">rescue</span>
363
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;retry!&quot;</span>
364
+ <span class="ruby-keyword kw">retry</span>
365
+ <span class="ruby-keyword kw">end</span>
366
+
367
+ <span class="ruby-node">`rm -f /tmp/#{bucket_and_image_name}*`</span>
368
+
369
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;uploaded and registerd #{image_path_str}&quot;</span>
370
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">image_id</span>
371
+ <span class="ruby-keyword kw">end</span>
372
+ </pre>
373
+ </div>
374
+ </div>
375
+ </div>
376
+
377
+
378
+ </div>
379
+
380
+
381
+ </div>
382
+
383
+
384
+ <div id="validator-badges">
385
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
386
+ </div>
387
+
388
+ </body>
389
+ </html>