appscale-tools 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/LICENSE +37 -0
  2. data/README +17 -0
  3. data/bin/appscale-add-keypair +15 -0
  4. data/bin/appscale-describe-instances +16 -0
  5. data/bin/appscale-remove-app +13 -0
  6. data/bin/appscale-reset-pwd +13 -0
  7. data/bin/appscale-run-instances +15 -0
  8. data/bin/appscale-terminate-instances +14 -0
  9. data/bin/appscale-upload-app +13 -0
  10. data/doc/AdvancedNode.html +163 -0
  11. data/doc/AppControllerClient.html +831 -0
  12. data/doc/AppEngineConfigException.html +165 -0
  13. data/doc/AppScaleException.html +165 -0
  14. data/doc/AppScaleTools.html +768 -0
  15. data/doc/BadCommandLineArgException.html +166 -0
  16. data/doc/BadConfigurationException.html +166 -0
  17. data/doc/CommonFunctions.html +2559 -0
  18. data/doc/EncryptionHelper.html +332 -0
  19. data/doc/GodInterface.html +443 -0
  20. data/doc/InfrastructureException.html +166 -0
  21. data/doc/Node.html +470 -0
  22. data/doc/NodeLayout.html +1297 -0
  23. data/doc/Object.html +539 -0
  24. data/doc/ParseArgs.html +268 -0
  25. data/doc/RemoteLogging.html +268 -0
  26. data/doc/SimpleNode.html +163 -0
  27. data/doc/UsageText.html +1204 -0
  28. data/doc/UserAppClient.html +993 -0
  29. data/doc/VMTools.html +1365 -0
  30. data/doc/bin/appscale-add-keypair.html +56 -0
  31. data/doc/bin/appscale-describe-instances.html +56 -0
  32. data/doc/bin/appscale-remove-app.html +56 -0
  33. data/doc/bin/appscale-reset-pwd.html +56 -0
  34. data/doc/bin/appscale-run-instances.html +56 -0
  35. data/doc/bin/appscale-terminate-instances.html +56 -0
  36. data/doc/bin/appscale-upload-app.html +56 -0
  37. data/doc/created.rid +21 -0
  38. data/doc/images/add.png +0 -0
  39. data/doc/images/brick.png +0 -0
  40. data/doc/images/brick_link.png +0 -0
  41. data/doc/images/bug.png +0 -0
  42. data/doc/images/bullet_black.png +0 -0
  43. data/doc/images/bullet_toggle_minus.png +0 -0
  44. data/doc/images/bullet_toggle_plus.png +0 -0
  45. data/doc/images/date.png +0 -0
  46. data/doc/images/delete.png +0 -0
  47. data/doc/images/find.png +0 -0
  48. data/doc/images/loadingAnimation.gif +0 -0
  49. data/doc/images/macFFBgHack.png +0 -0
  50. data/doc/images/package.png +0 -0
  51. data/doc/images/page_green.png +0 -0
  52. data/doc/images/page_white_text.png +0 -0
  53. data/doc/images/page_white_width.png +0 -0
  54. data/doc/images/plugin.png +0 -0
  55. data/doc/images/ruby.png +0 -0
  56. data/doc/images/tag_blue.png +0 -0
  57. data/doc/images/tag_green.png +0 -0
  58. data/doc/images/transparent.png +0 -0
  59. data/doc/images/wrench.png +0 -0
  60. data/doc/images/wrench_orange.png +0 -0
  61. data/doc/images/zoom.png +0 -0
  62. data/doc/index.html +116 -0
  63. data/doc/js/darkfish.js +153 -0
  64. data/doc/js/jquery.js +18 -0
  65. data/doc/js/navigation.js +142 -0
  66. data/doc/js/quicksearch.js +114 -0
  67. data/doc/js/search.js +94 -0
  68. data/doc/js/search_index.js +1 -0
  69. data/doc/js/searcher.js +228 -0
  70. data/doc/js/thickbox-compressed.js +10 -0
  71. data/doc/lib/app_controller_client_rb.html +60 -0
  72. data/doc/lib/appscale_tools_rb.html +88 -0
  73. data/doc/lib/common_functions_rb.html +78 -0
  74. data/doc/lib/custom_exceptions_rb.html +54 -0
  75. data/doc/lib/encryption_helper_rb.html +60 -0
  76. data/doc/lib/godinterface_rb.html +52 -0
  77. data/doc/lib/node_layout_rb.html +55 -0
  78. data/doc/lib/parse_args_rb.html +58 -0
  79. data/doc/lib/remote_log_rb.html +58 -0
  80. data/doc/lib/sshcopyid.html +174 -0
  81. data/doc/lib/usage_text_rb.html +58 -0
  82. data/doc/lib/user_app_client_rb.html +62 -0
  83. data/doc/lib/vm_tools_rb.html +62 -0
  84. data/doc/table_of_contents.html +496 -0
  85. data/lib/app_controller_client.rb +181 -0
  86. data/lib/appscale_tools.rb +403 -0
  87. data/lib/common_functions.rb +1467 -0
  88. data/lib/custom_exceptions.rb +25 -0
  89. data/lib/encryption_helper.rb +86 -0
  90. data/lib/godinterface.rb +152 -0
  91. data/lib/node_layout.rb +665 -0
  92. data/lib/parse_args.rb +415 -0
  93. data/lib/remote_log.rb +46 -0
  94. data/lib/sshcopyid +65 -0
  95. data/lib/usage_text.rb +144 -0
  96. data/lib/user_app_client.rb +245 -0
  97. data/lib/vm_tools.rb +549 -0
  98. data/test/tc_app_controller_client.rb +10 -0
  99. data/test/tc_appscale_add_keypair.rb +44 -0
  100. data/test/tc_appscale_describe_instances.rb +69 -0
  101. data/test/tc_appscale_remove_app.rb +128 -0
  102. data/test/tc_appscale_reset_pwd.rb +156 -0
  103. data/test/tc_appscale_run_instances.rb +48 -0
  104. data/test/tc_appscale_terminate_instances.rb +104 -0
  105. data/test/tc_appscale_upload_app.rb +166 -0
  106. data/test/tc_common_functions.rb +56 -0
  107. data/test/tc_encryption_helper.rb +10 -0
  108. data/test/tc_god_interface.rb +10 -0
  109. data/test/tc_node_layout.rb +93 -0
  110. data/test/tc_parse_args.rb +160 -0
  111. data/test/tc_user_app_client.rb +10 -0
  112. data/test/tc_vm_tools.rb +10 -0
  113. data/test/ts_all.rb +20 -0
  114. metadata +211 -0
@@ -0,0 +1,332 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module EncryptionHelper - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/encryption_helper.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+
60
+
61
+ <!-- Method Quickref -->
62
+ <nav id="method-list-section" class="section">
63
+ <h3 class="section-header">Methods</h3>
64
+
65
+ <ul class="link-list">
66
+
67
+ <li><a href="#method-c-generate_pem_files">::generate_pem_files</a>
68
+
69
+ <li><a href="#method-c-generate_secret_key">::generate_secret_key</a>
70
+
71
+ <li><a href="#method-c-generate_ssh_key">::generate_ssh_key</a>
72
+
73
+ </ul>
74
+ </nav>
75
+
76
+ </div>
77
+
78
+ <div id="project-metadata">
79
+ <nav id="fileindex-section" class="section project-section">
80
+ <h3 class="section-header">Pages</h3>
81
+
82
+ <ul>
83
+
84
+ <li class="file"><a href="./lib/sshcopyid.html">sshcopyid</a>
85
+
86
+ </ul>
87
+ </nav>
88
+
89
+ <nav id="classindex-section" class="section project-section">
90
+ <h3 class="section-header">Class and Module Index</h3>
91
+
92
+ <ul class="link-list">
93
+
94
+ <li><a href="./AdvancedNode.html">AdvancedNode</a>
95
+
96
+ <li><a href="./AppControllerClient.html">AppControllerClient</a>
97
+
98
+ <li><a href="./AppEngineConfigException.html">AppEngineConfigException</a>
99
+
100
+ <li><a href="./AppScaleException.html">AppScaleException</a>
101
+
102
+ <li><a href="./AppScaleTools.html">AppScaleTools</a>
103
+
104
+ <li><a href="./BadCommandLineArgException.html">BadCommandLineArgException</a>
105
+
106
+ <li><a href="./BadConfigurationException.html">BadConfigurationException</a>
107
+
108
+ <li><a href="./CommonFunctions.html">CommonFunctions</a>
109
+
110
+ <li><a href="./EncryptionHelper.html">EncryptionHelper</a>
111
+
112
+ <li><a href="./GodInterface.html">GodInterface</a>
113
+
114
+ <li><a href="./InfrastructureException.html">InfrastructureException</a>
115
+
116
+ <li><a href="./Node.html">Node</a>
117
+
118
+ <li><a href="./NodeLayout.html">NodeLayout</a>
119
+
120
+ <li><a href="./Object.html">Object</a>
121
+
122
+ <li><a href="./ParseArgs.html">ParseArgs</a>
123
+
124
+ <li><a href="./RemoteLogging.html">RemoteLogging</a>
125
+
126
+ <li><a href="./SimpleNode.html">SimpleNode</a>
127
+
128
+ <li><a href="./UsageText.html">UsageText</a>
129
+
130
+ <li><a href="./UserAppClient.html">UserAppClient</a>
131
+
132
+ <li><a href="./VMTools.html">VMTools</a>
133
+
134
+ </ul>
135
+ </nav>
136
+
137
+ </div>
138
+ </nav>
139
+
140
+ <div id="documentation">
141
+ <h1 class="module">module EncryptionHelper</h1>
142
+
143
+ <div id="description" class="description">
144
+
145
+ </div><!-- description -->
146
+
147
+
148
+
149
+
150
+ <section id="5Buntitled-5D" class="documentation-section">
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+ <!-- Methods -->
160
+
161
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
162
+ <h3 class="section-header">Public Class Methods</h3>
163
+
164
+
165
+ <div id="method-c-generate_pem_files" class="method-detail ">
166
+
167
+ <div class="method-heading">
168
+ <span class="method-name">generate_pem_files</span><span
169
+ class="method-args">(keyname)</span>
170
+ <span class="method-click-advice">click to toggle source</span>
171
+ </div>
172
+
173
+
174
+ <div class="method-description">
175
+
176
+
177
+
178
+
179
+
180
+ <div class="method-source-code" id="generate_pem_files-source">
181
+ <pre><span class="ruby-comment"># File lib/encryption_helper.rb, line 65</span>
182
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">generate_pem_files</span>(<span class="ruby-identifier">keyname</span>)
183
+ <span class="ruby-identifier">key_loc</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.appscale/#{keyname}-key.pem&quot;</span>)
184
+ <span class="ruby-identifier">cert_loc</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.appscale/#{keyname}-cert.pem&quot;</span>)
185
+
186
+ <span class="ruby-identifier">key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-value">2048</span>)
187
+ <span class="ruby-identifier">pub</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">public_key</span>
188
+ <span class="ruby-identifier">ca</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">X509</span><span class="ruby-operator">::</span><span class="ruby-constant">Name</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;/C=US/ST=Foo/L=Bar/O=AppScale/OU=User/CN=appscale.cs.ucsb.edu/emailAddress=test@test.com&quot;</span>)
189
+ <span class="ruby-identifier">cert</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">X509</span><span class="ruby-operator">::</span><span class="ruby-constant">Certificate</span>.<span class="ruby-identifier">new</span>
190
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">version</span> = <span class="ruby-value">2</span>
191
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">serial</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
192
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">subject</span> = <span class="ruby-identifier">ca</span>
193
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">issuer</span> = <span class="ruby-identifier">ca</span>
194
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">public_key</span> = <span class="ruby-identifier">pub</span>
195
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">not_before</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
196
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">not_after</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">+</span> <span class="ruby-value">3600</span>
197
+ <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">sign</span>(<span class="ruby-identifier">key</span>, <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">new</span>)
198
+
199
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">key_loc</span>, <span class="ruby-string">&quot;w&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_pem</span> }
200
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">cert_loc</span>, <span class="ruby-string">&quot;w&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">cert</span>.<span class="ruby-identifier">to_pem</span> }
201
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">key_loc</span>, <span class="ruby-identifier">cert_loc</span>
202
+ <span class="ruby-keyword">end</span></pre>
203
+ </div><!-- generate_pem_files-source -->
204
+
205
+ </div>
206
+
207
+
208
+
209
+
210
+ </div><!-- generate_pem_files-method -->
211
+
212
+
213
+ <div id="method-c-generate_secret_key" class="method-detail ">
214
+
215
+ <div class="method-heading">
216
+ <span class="method-name">generate_secret_key</span><span
217
+ class="method-args">(keyname="appscale")</span>
218
+ <span class="method-click-advice">click to toggle source</span>
219
+ </div>
220
+
221
+
222
+ <div class="method-description">
223
+
224
+
225
+
226
+
227
+
228
+ <div class="method-source-code" id="generate_secret_key-source">
229
+ <pre><span class="ruby-comment"># File lib/encryption_helper.rb, line 10</span>
230
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">generate_secret_key</span>(<span class="ruby-identifier">keyname</span>=<span class="ruby-string">&quot;appscale&quot;</span>)
231
+ <span class="ruby-identifier">path</span>=<span class="ruby-node">&quot;~/.appscale/#{keyname}.secret&quot;</span>
232
+ <span class="ruby-identifier">secret_key</span> = <span class="ruby-string">&quot;&quot;</span>
233
+ <span class="ruby-identifier">possible</span> = <span class="ruby-string">&quot;0123456789abcdefghijklmnopqrstuvxwyzABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;</span>
234
+ <span class="ruby-identifier">possibleLength</span> = <span class="ruby-identifier">possible</span>.<span class="ruby-identifier">length</span>
235
+
236
+ <span class="ruby-value">32</span>.<span class="ruby-identifier">times</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
237
+ <span class="ruby-identifier">secret_key</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">possible</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">possibleLength</span>)]
238
+ }
239
+
240
+ <span class="ruby-identifier">full_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
241
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">full_path</span>, <span class="ruby-string">&quot;w&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
242
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">secret_key</span>)
243
+ }
244
+
245
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">secret_key</span>, <span class="ruby-identifier">path</span>
246
+ <span class="ruby-keyword">end</span></pre>
247
+ </div><!-- generate_secret_key-source -->
248
+
249
+ </div>
250
+
251
+
252
+
253
+
254
+ </div><!-- generate_secret_key-method -->
255
+
256
+
257
+ <div id="method-c-generate_ssh_key" class="method-detail ">
258
+
259
+ <div class="method-heading">
260
+ <span class="method-name">generate_ssh_key</span><span
261
+ class="method-args">(verbose, outputLocation, name, infrastructure, force)</span>
262
+ <span class="method-click-advice">click to toggle source</span>
263
+ </div>
264
+
265
+
266
+ <div class="method-description">
267
+
268
+
269
+
270
+
271
+
272
+ <div class="method-source-code" id="generate_ssh_key-source">
273
+ <pre><span class="ruby-comment"># File lib/encryption_helper.rb, line 28</span>
274
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">generate_ssh_key</span>(<span class="ruby-identifier">verbose</span>, <span class="ruby-identifier">outputLocation</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">infrastructure</span>, <span class="ruby-identifier">force</span>)
275
+ <span class="ruby-identifier">ec2_output</span> = <span class="ruby-string">&quot;&quot;</span>
276
+ <span class="ruby-identifier">loop</span> {
277
+ <span class="ruby-identifier">sleep</span>(<span class="ruby-value">10</span>) <span class="ruby-comment"># to avoid euca replay error message</span>
278
+ <span class="ruby-identifier">ec2_output</span> = <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">shell</span>(<span class="ruby-node">&quot;#{infrastructure}-add-keypair #{name} 2&gt;&amp;1&quot;</span>)
279
+ <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ec2_output</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;BEGIN RSA PRIVATE KEY&quot;</span>)
280
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">force</span>
281
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Trying again. Saw this from #{infrastructure}-add-keypair: #{ec2_output}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">verbose</span>
282
+ <span class="ruby-identifier">sleep</span>(<span class="ruby-value">10</span>)
283
+ <span class="ruby-identifier">delete_output</span> = <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">shell</span>(<span class="ruby-node">&quot;#{infrastructure}-delete-keypair #{name} 2&gt;&amp;1&quot;</span>)
284
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Saw this from #{infrastructure}-delete-keypair: #{delete_output}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">verbose</span>
285
+ <span class="ruby-keyword">else</span>
286
+ <span class="ruby-identifier">abort</span>(<span class="ruby-node">&quot;The keyname you chose is already in the system. Please either run this tool again with the --force flag or run the following:\n#{infrastructure}-delete-keypair #{name}&quot;</span>)
287
+ <span class="ruby-keyword">end</span>
288
+ }
289
+
290
+ <span class="ruby-comment"># output is the ssh private key prepended with info we don't need</span>
291
+ <span class="ruby-comment"># delimited by the first \n, so rip it off first to get just the key</span>
292
+
293
+ <span class="ruby-comment">#first_newline = ec2_output.index(&quot;\n&quot;)</span>
294
+ <span class="ruby-comment">#ssh_private_key = ec2_output[first_newline+1, ec2_output.length-1]</span>
295
+
296
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">outputLocation</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
297
+ <span class="ruby-identifier">outputLocation</span> = [<span class="ruby-identifier">outputLocation</span>]
298
+ <span class="ruby-keyword">end</span>
299
+
300
+ <span class="ruby-identifier">outputLocation</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
301
+ <span class="ruby-identifier">fullPath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
302
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">fullPath</span>, <span class="ruby-string">&quot;w&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
303
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">ec2_output</span>)
304
+ }
305
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">chmod</span>(<span class="ruby-value">0600</span>, <span class="ruby-identifier">fullPath</span>) <span class="ruby-comment"># else ssh won't use the key</span>
306
+ }
307
+
308
+ <span class="ruby-keyword">return</span>
309
+ <span class="ruby-keyword">end</span></pre>
310
+ </div><!-- generate_ssh_key-source -->
311
+
312
+ </div>
313
+
314
+
315
+
316
+
317
+ </div><!-- generate_ssh_key-method -->
318
+
319
+
320
+ </section><!-- public-class-method-details -->
321
+
322
+ </section><!-- 5Buntitled-5D -->
323
+
324
+ </div><!-- documentation -->
325
+
326
+
327
+ <footer id="validator-badges">
328
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
329
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
330
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
331
+ </footer>
332
+
@@ -0,0 +1,443 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module GodInterface - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/godinterface.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+
60
+
61
+ <!-- Method Quickref -->
62
+ <nav id="method-list-section" class="section">
63
+ <h3 class="section-header">Methods</h3>
64
+
65
+ <ul class="link-list">
66
+
67
+ <li><a href="#method-c-remove">::remove</a>
68
+
69
+ <li><a href="#method-c-shutdown">::shutdown</a>
70
+
71
+ <li><a href="#method-c-start">::start</a>
72
+
73
+ <li><a href="#method-c-start_god">::start_god</a>
74
+
75
+ <li><a href="#method-c-stop">::stop</a>
76
+
77
+ </ul>
78
+ </nav>
79
+
80
+ </div>
81
+
82
+ <div id="project-metadata">
83
+ <nav id="fileindex-section" class="section project-section">
84
+ <h3 class="section-header">Pages</h3>
85
+
86
+ <ul>
87
+
88
+ <li class="file"><a href="./lib/sshcopyid.html">sshcopyid</a>
89
+
90
+ </ul>
91
+ </nav>
92
+
93
+ <nav id="classindex-section" class="section project-section">
94
+ <h3 class="section-header">Class and Module Index</h3>
95
+
96
+ <ul class="link-list">
97
+
98
+ <li><a href="./AdvancedNode.html">AdvancedNode</a>
99
+
100
+ <li><a href="./AppControllerClient.html">AppControllerClient</a>
101
+
102
+ <li><a href="./AppEngineConfigException.html">AppEngineConfigException</a>
103
+
104
+ <li><a href="./AppScaleException.html">AppScaleException</a>
105
+
106
+ <li><a href="./AppScaleTools.html">AppScaleTools</a>
107
+
108
+ <li><a href="./BadCommandLineArgException.html">BadCommandLineArgException</a>
109
+
110
+ <li><a href="./BadConfigurationException.html">BadConfigurationException</a>
111
+
112
+ <li><a href="./CommonFunctions.html">CommonFunctions</a>
113
+
114
+ <li><a href="./EncryptionHelper.html">EncryptionHelper</a>
115
+
116
+ <li><a href="./GodInterface.html">GodInterface</a>
117
+
118
+ <li><a href="./InfrastructureException.html">InfrastructureException</a>
119
+
120
+ <li><a href="./Node.html">Node</a>
121
+
122
+ <li><a href="./NodeLayout.html">NodeLayout</a>
123
+
124
+ <li><a href="./Object.html">Object</a>
125
+
126
+ <li><a href="./ParseArgs.html">ParseArgs</a>
127
+
128
+ <li><a href="./RemoteLogging.html">RemoteLogging</a>
129
+
130
+ <li><a href="./SimpleNode.html">SimpleNode</a>
131
+
132
+ <li><a href="./UsageText.html">UsageText</a>
133
+
134
+ <li><a href="./UserAppClient.html">UserAppClient</a>
135
+
136
+ <li><a href="./VMTools.html">VMTools</a>
137
+
138
+ </ul>
139
+ </nav>
140
+
141
+ </div>
142
+ </nav>
143
+
144
+ <div id="documentation">
145
+ <h1 class="module">module GodInterface</h1>
146
+
147
+ <div id="description" class="description">
148
+
149
+ </div><!-- description -->
150
+
151
+
152
+
153
+
154
+ <section id="5Buntitled-5D" class="documentation-section">
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+ <!-- Methods -->
164
+
165
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
166
+ <h3 class="section-header">Public Class Methods</h3>
167
+
168
+
169
+ <div id="method-c-remove" class="method-detail ">
170
+
171
+ <div class="method-heading">
172
+ <span class="method-name">remove</span><span
173
+ class="method-args">(watch, remote_ip=nil, remote_key=nil)</span>
174
+ <span class="method-click-advice">click to toggle source</span>
175
+ </div>
176
+
177
+
178
+ <div class="method-description">
179
+
180
+
181
+
182
+
183
+
184
+ <div class="method-source-code" id="remove-source">
185
+ <pre><span class="ruby-comment"># File lib/godinterface.rb, line 129</span>
186
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">remove</span>(<span class="ruby-identifier">watch</span>, <span class="ruby-identifier">remote_ip</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">remote_key</span>=<span class="ruby-keyword">nil</span>)
187
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_god_command</span>(<span class="ruby-node">&quot;god remove #{watch}&quot;</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
188
+ <span class="ruby-keyword">end</span></pre>
189
+ </div><!-- remove-source -->
190
+
191
+ </div>
192
+
193
+
194
+
195
+
196
+ </div><!-- remove-method -->
197
+
198
+
199
+ <div id="method-c-shutdown" class="method-detail ">
200
+
201
+ <div class="method-heading">
202
+ <span class="method-name">shutdown</span><span
203
+ class="method-args">(remote_ip=nil, remote_key=nil)</span>
204
+ <span class="method-click-advice">click to toggle source</span>
205
+ </div>
206
+
207
+
208
+ <div class="method-description">
209
+
210
+
211
+
212
+
213
+
214
+ <div class="method-source-code" id="shutdown-source">
215
+ <pre><span class="ruby-comment"># File lib/godinterface.rb, line 133</span>
216
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">shutdown</span>(<span class="ruby-identifier">remote_ip</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">remote_key</span>=<span class="ruby-keyword">nil</span>)
217
+ <span class="ruby-node">%w{ uaserver pbserver memcached blobstore monitr loadbalancer }</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">service</span><span class="ruby-operator">|</span>
218
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_god_command</span>(<span class="ruby-node">&quot;god stop #{service}&quot;</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
219
+ }
220
+
221
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_god_command</span>(<span class="ruby-string">&quot;god terminate&quot;</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
222
+ <span class="ruby-keyword">end</span></pre>
223
+ </div><!-- shutdown-source -->
224
+
225
+ </div>
226
+
227
+
228
+
229
+
230
+ </div><!-- shutdown-method -->
231
+
232
+
233
+ <div id="method-c-start" class="method-detail ">
234
+
235
+ <div class="method-heading">
236
+ <span class="method-name">start</span><span
237
+ class="method-args">(watch, start_cmd, stop_cmd, ports, env_vars=nil, remote_ip=nil, remote_key=nil)</span>
238
+ <span class="method-click-advice">click to toggle source</span>
239
+ </div>
240
+
241
+
242
+ <div class="method-description">
243
+
244
+
245
+
246
+
247
+
248
+ <div class="method-source-code" id="start-source">
249
+ <pre><span class="ruby-comment"># File lib/godinterface.rb, line 9</span>
250
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">watch</span>, <span class="ruby-identifier">start_cmd</span>, <span class="ruby-identifier">stop_cmd</span>, <span class="ruby-identifier">ports</span>, <span class="ruby-identifier">env_vars</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">remote_ip</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">remote_key</span>=<span class="ruby-keyword">nil</span>)
251
+
252
+ <span class="ruby-identifier">ports</span> = [<span class="ruby-identifier">ports</span>] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ports</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
253
+
254
+ <span class="ruby-identifier">prologue</span> = <span class="ruby-string">&quot; WATCH = &quot;#{watch}&quot;
255
+ START_CMD = &quot;#{start_cmd}&quot;
256
+ STOP_CMD = &quot;#{stop_cmd}&quot;
257
+ PORTS = [#{ports.join(', ')}]
258
+
259
+ &quot;</span>
260
+
261
+ <span class="ruby-identifier">body</span> = <span class="ruby-string">&quot; PORTS.each do |port|
262
+ God.watch do |w|
263
+ w.name = &quot;appscale-#{WATCH}-#{port}&quot;
264
+ w.group = WATCH
265
+ w.interval = 30.seconds # default
266
+ w.start = START_CMD
267
+ w.stop = STOP_CMD
268
+ w.start_grace = 20.seconds
269
+ w.restart_grace = 20.seconds
270
+ w.log = &quot;/var/log/appscale/#{WATCH}-#{port}.log&quot;
271
+ w.pid_file = &quot;/var/appscale/#{WATCH}-#{port}.pid&quot;
272
+
273
+ w.behavior(:clean_pid_file)
274
+
275
+ w.start_if do |start|
276
+ start.condition(:process_running) do |c|
277
+ c.running = false
278
+ end
279
+ end
280
+
281
+ w.restart_if do |restart|
282
+ restart.condition(:memory_usage) do |c|
283
+ c.above = 150.megabytes
284
+ c.times = [3, 5] # 3 out of 5 intervals
285
+ end
286
+
287
+ restart.condition(:cpu_usage) do |c|
288
+ c.above = 50.percent
289
+ c.times = 5
290
+ end
291
+ end
292
+
293
+ # lifecycle
294
+ w.lifecycle do |on|
295
+ on.condition(:flapping) do |c|
296
+ c.to_state = [:start, :restart]
297
+ c.times = 5
298
+ c.within = 5.minute
299
+ c.transition = :unmonitored
300
+ c.retry_in = 10.minutes
301
+ c.retry_times = 5
302
+ c.retry_within = 2.hours
303
+ end
304
+ end
305
+ &quot;</span>
306
+
307
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">env_vars</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">and</span> <span class="ruby-operator">!</span><span class="ruby-identifier">env_vars</span>.<span class="ruby-identifier">empty?</span>
308
+ <span class="ruby-identifier">env_vars_str</span> = <span class="ruby-string">&quot;&quot;</span>
309
+
310
+ <span class="ruby-identifier">env_vars</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
311
+ <span class="ruby-identifier">env_vars_str</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot; \&quot;&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\&quot; =&gt; \&quot;&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\&quot;,\n&quot;</span>
312
+ }
313
+
314
+ <span class="ruby-identifier">body</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;
315
+ w.env = {
316
+ #{env_vars_str}
317
+ }
318
+ &quot;</span>
319
+ <span class="ruby-keyword">end</span>
320
+
321
+ <span class="ruby-identifier">epilogue</span> = <span class="ruby-string">&quot; end
322
+ end
323
+ &quot;</span>
324
+
325
+ <span class="ruby-identifier">config_file</span> = <span class="ruby-identifier">prologue</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">body</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">epilogue</span>
326
+ <span class="ruby-identifier">tempfile</span> = <span class="ruby-node">&quot;/tmp/god-#{rand(10000)}.god&quot;</span>
327
+
328
+ <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">write_file</span>(<span class="ruby-identifier">tempfile</span>, <span class="ruby-identifier">config_file</span>)
329
+
330
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">remote_ip</span>
331
+ <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">scp_file</span>(<span class="ruby-identifier">tempfile</span>, <span class="ruby-identifier">tempfile</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
332
+ <span class="ruby-keyword">end</span>
333
+
334
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">remote_ip</span>
335
+ <span class="ruby-identifier">ip</span> = <span class="ruby-identifier">remote_ip</span>
336
+ <span class="ruby-keyword">else</span>
337
+ <span class="ruby-identifier">ip</span> = <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">local_ip</span>
338
+ <span class="ruby-keyword">end</span>
339
+
340
+ <span class="ruby-comment">#unless CommonFunctions.is_port_open?(ip, GOD_PORT, use_ssl=false)</span>
341
+ <span class="ruby-comment"># self.run_god_command(&quot;god&quot;, remote_ip, remote_key)</span>
342
+ <span class="ruby-comment"># sleep(5)</span>
343
+ <span class="ruby-comment">#end</span>
344
+
345
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_god_command</span>(<span class="ruby-node">&quot;god load #{tempfile}&quot;</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
346
+
347
+ <span class="ruby-identifier">sleep</span>(<span class="ruby-value">5</span>)
348
+
349
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_f</span>(<span class="ruby-identifier">tempfile</span>)
350
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">remote_ip</span>
351
+ <span class="ruby-identifier">remove</span> = <span class="ruby-node">&quot;rm -rf #{tempfile}&quot;</span>
352
+ <span class="ruby-constant">CommonFunctions</span>.<span class="ruby-identifier">run_remote_command</span>(<span class="ruby-identifier">ip</span>, <span class="ruby-identifier">remove</span>, <span class="ruby-identifier">remote_key</span>, <span class="ruby-keyword">false</span>)
353
+ <span class="ruby-keyword">end</span>
354
+
355
+ <span class="ruby-comment">#god_info = &quot;Starting #{watch} on ip #{ip}, port #{ports.join(', ')}&quot; +</span>
356
+ <span class="ruby-comment"># &quot; with start command [#{start_cmd}] and stop command [#{stop_cmd}]&quot;</span>
357
+ <span class="ruby-comment">#puts god_info</span>
358
+
359
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_god_command</span>(<span class="ruby-node">&quot;god start #{watch}&quot;</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
360
+ <span class="ruby-keyword">end</span></pre>
361
+ </div><!-- start-source -->
362
+
363
+ </div>
364
+
365
+
366
+
367
+
368
+ </div><!-- start-method -->
369
+
370
+
371
+ <div id="method-c-start_god" class="method-detail ">
372
+
373
+ <div class="method-heading">
374
+ <span class="method-name">start_god</span><span
375
+ class="method-args">(remote_ip, remote_key)</span>
376
+ <span class="method-click-advice">click to toggle source</span>
377
+ </div>
378
+
379
+
380
+ <div class="method-description">
381
+
382
+
383
+
384
+
385
+
386
+ <div class="method-source-code" id="start_god-source">
387
+ <pre><span class="ruby-comment"># File lib/godinterface.rb, line 5</span>
388
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">start_god</span>(<span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
389
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_god_command</span>(<span class="ruby-string">&quot;god &amp;&quot;</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
390
+ <span class="ruby-keyword">end</span></pre>
391
+ </div><!-- start_god-source -->
392
+
393
+ </div>
394
+
395
+
396
+
397
+
398
+ </div><!-- start_god-method -->
399
+
400
+
401
+ <div id="method-c-stop" class="method-detail ">
402
+
403
+ <div class="method-heading">
404
+ <span class="method-name">stop</span><span
405
+ class="method-args">(watch, remote_ip=nil, remote_key=nil)</span>
406
+ <span class="method-click-advice">click to toggle source</span>
407
+ </div>
408
+
409
+
410
+ <div class="method-description">
411
+
412
+
413
+
414
+
415
+
416
+ <div class="method-source-code" id="stop-source">
417
+ <pre><span class="ruby-comment"># File lib/godinterface.rb, line 125</span>
418
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">stop</span>(<span class="ruby-identifier">watch</span>, <span class="ruby-identifier">remote_ip</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">remote_key</span>=<span class="ruby-keyword">nil</span>)
419
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_god_command</span>(<span class="ruby-node">&quot;god stop #{watch}&quot;</span>, <span class="ruby-identifier">remote_ip</span>, <span class="ruby-identifier">remote_key</span>)
420
+ <span class="ruby-keyword">end</span></pre>
421
+ </div><!-- stop-source -->
422
+
423
+ </div>
424
+
425
+
426
+
427
+
428
+ </div><!-- stop-method -->
429
+
430
+
431
+ </section><!-- public-class-method-details -->
432
+
433
+ </section><!-- 5Buntitled-5D -->
434
+
435
+ </div><!-- documentation -->
436
+
437
+
438
+ <footer id="validator-badges">
439
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
440
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
441
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
442
+ </footer>
443
+