neptune 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,142 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: BadConfigurationException</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="./js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="./js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="./lib/custom_exceptions_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/custom_exceptions.rb">lib/custom_exceptions.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link">Exception</p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+
66
+ <!-- Method Quickref -->
67
+
68
+
69
+ <!-- Included Modules -->
70
+
71
+ </div>
72
+
73
+ <div id="project-metadata">
74
+
75
+
76
+
77
+ <div id="classindex-section" class="section project-section">
78
+ <h3 class="section-header">Class/Module Index
79
+ <span class="search-toggle"><img src="./images/find.png"
80
+ height="16" width="16" alt="[+]"
81
+ title="show/hide quicksearch" /></span></h3>
82
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
83
+ <fieldset>
84
+ <legend>Quicksearch</legend>
85
+ <input type="text" name="quicksearch" value=""
86
+ class="quicksearch-field" />
87
+ </fieldset>
88
+ </form>
89
+
90
+ <ul class="link-list">
91
+
92
+ <li><a href="./AppControllerClient.html">AppControllerClient</a></li>
93
+
94
+ <li><a href="./AppControllerException.html">AppControllerException</a></li>
95
+
96
+ <li><a href="./BabelHelper.html">BabelHelper</a></li>
97
+
98
+ <li><a href="./BadConfigurationException.html">BadConfigurationException</a></li>
99
+
100
+ <li><a href="./CommonFunctions.html">CommonFunctions</a></li>
101
+
102
+ <li><a href="./FileNotFoundException.html">FileNotFoundException</a></li>
103
+
104
+ <li><a href="./NeptuneHelper.html">NeptuneHelper</a></li>
105
+
106
+ <li><a href="./Object.html">Object</a></li>
107
+
108
+ </ul>
109
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
110
+ </div>
111
+
112
+
113
+ </div>
114
+ </div>
115
+
116
+ <div id="documentation">
117
+ <h1 class="class">BadConfigurationException</h1>
118
+
119
+ <div id="description">
120
+
121
+ </div>
122
+
123
+ <!-- Constants -->
124
+
125
+
126
+ <!-- Attributes -->
127
+
128
+
129
+ <!-- Methods -->
130
+
131
+
132
+ </div>
133
+
134
+ <div id="validator-badges">
135
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
136
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
137
+ Rdoc Generator</a> 2</small>.</p>
138
+ </div>
139
+
140
+ </body>
141
+ </html>
142
+
@@ -64,12 +64,16 @@
64
64
 
65
65
  <li><a href="#method-c-get_from_yaml">::get_from_yaml</a></li>
66
66
 
67
+ <li><a href="#method-c-get_random_alphanumeric">::get_random_alphanumeric</a></li>
68
+
67
69
  <li><a href="#method-c-get_secret_key">::get_secret_key</a></li>
68
70
 
69
71
  <li><a href="#method-c-scp_file">::scp_file</a></li>
70
72
 
71
73
  <li><a href="#method-c-scp_to_shadow">::scp_to_shadow</a></li>
72
74
 
75
+ <li><a href="#method-c-shell">::shell</a></li>
76
+
73
77
  </ul>
74
78
  </div>
75
79
 
@@ -99,9 +103,17 @@
99
103
 
100
104
  <li><a href="./AppControllerClient.html">AppControllerClient</a></li>
101
105
 
106
+ <li><a href="./AppControllerException.html">AppControllerException</a></li>
107
+
108
+ <li><a href="./BabelHelper.html">BabelHelper</a></li>
109
+
110
+ <li><a href="./BadConfigurationException.html">BadConfigurationException</a></li>
111
+
102
112
  <li><a href="./CommonFunctions.html">CommonFunctions</a></li>
103
113
 
104
- <li><a href="./Kernel.html">Kernel</a></li>
114
+ <li><a href="./FileNotFoundException.html">FileNotFoundException</a></li>
115
+
116
+ <li><a href="./NeptuneHelper.html">NeptuneHelper</a></li>
105
117
 
106
118
  <li><a href="./Object.html">Object</a></li>
107
119
 
@@ -144,7 +156,7 @@ over code and input files.</p>
144
156
 
145
157
  <div class="method-heading">
146
158
  <span class="method-name">get_from_yaml</span><span
147
- class="method-args">(keyname, tag, required=true, file=File, yaml=YAML)</span>
159
+ class="method-args">(keyname, tag, required=true)</span>
148
160
  <span class="method-click-advice">click to toggle source</span>
149
161
  </div>
150
162
 
@@ -163,17 +175,17 @@ instead.</p>
163
175
  <div class="method-source-code"
164
176
  id="get_from_yaml-source">
165
177
  <pre>
166
- <span class="ruby-comment"># File lib/common_functions.rb, line 91</span>
167
- def self.get_from_yaml(keyname, tag, required=true, file=<span class="ruby-constant">File</span>, yaml=<span class="ruby-constant">YAML</span>)
168
- location_file = file.expand_path(&quot;~/.appscale/locations-#{keyname}.yaml&quot;)
178
+ <span class="ruby-comment"># File lib/common_functions.rb, line 105</span>
179
+ def self.get_from_yaml(keyname, tag, required=true)
180
+ location_file = <span class="ruby-constant">File</span>.expand_path(&quot;~/.appscale/locations-#{keyname}.yaml&quot;)
169
181
 
170
- if !file.exists?(location_file)
171
- abort(<span class="ruby-string">&quot;An AppScale instance is not currently running with the provided&quot;</span> +
172
- &quot; keyname, \&quot;#{keyname}\&quot;.&quot;)
182
+ if !<span class="ruby-constant">File</span>.exists?(location_file)
183
+ raise <span class="ruby-constant">BadConfigurationException</span>.new(<span class="ruby-string">&quot;An AppScale instance is not &quot;</span> +
184
+ &quot;currently running with the provided keyname, \&quot;#{keyname}\&quot;.&quot;)
173
185
  end
174
186
 
175
187
  begin
176
- tree = yaml.load_file(location_file)
188
+ tree = <span class="ruby-constant">YAML</span>.load_file(location_file)
177
189
  rescue <span class="ruby-constant">ArgumentError</span>
178
190
  if required
179
191
  abort(<span class="ruby-string">&quot;The yaml file you provided was malformed. Please correct any&quot;</span> +
@@ -200,6 +212,49 @@ end</pre>
200
212
 
201
213
 
202
214
 
215
+ </div>
216
+
217
+
218
+ <div id="get_random_alphanumeric-method" class="method-detail ">
219
+ <a name="method-c-get_random_alphanumeric"></a>
220
+
221
+
222
+ <div class="method-heading">
223
+ <span class="method-name">get_random_alphanumeric</span><span
224
+ class="method-args">(length=10)</span>
225
+ <span class="method-click-advice">click to toggle source</span>
226
+ </div>
227
+
228
+
229
+ <div class="method-description">
230
+
231
+ <p>Returns a random string composed of alphanumeric characters, as long as the
232
+ user requests.</p>
233
+
234
+
235
+
236
+ <div class="method-source-code"
237
+ id="get_random_alphanumeric-source">
238
+ <pre>
239
+ <span class="ruby-comment"># File lib/common_functions.rb, line 29</span>
240
+ def self.get_random_alphanumeric(length=10)
241
+ random = <span class="ruby-string">&quot;&quot;</span>
242
+ possible = <span class="ruby-string">&quot;0123456789abcdefghijklmnopqrstuvxwyzABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;</span>
243
+ possibleLength = possible.length
244
+
245
+ length.times { |index|
246
+ random &lt;&lt; possible[rand(possibleLength)]
247
+ }
248
+
249
+ return random
250
+ end</pre>
251
+ </div>
252
+
253
+ </div>
254
+
255
+
256
+
257
+
203
258
  </div>
204
259
 
205
260
 
@@ -209,7 +264,7 @@ end</pre>
209
264
 
210
265
  <div class="method-heading">
211
266
  <span class="method-name">get_secret_key</span><span
212
- class="method-args">(keyname, required=true, file=File, yaml=YAML)</span>
267
+ class="method-args">(keyname, required=true)</span>
213
268
  <span class="method-click-advice">click to toggle source</span>
214
269
  </div>
215
270
 
@@ -226,9 +281,9 @@ function, as the secret is stored in a YAML file.</p>
226
281
  <div class="method-source-code"
227
282
  id="get_secret_key-source">
228
283
  <pre>
229
- <span class="ruby-comment"># File lib/common_functions.rb, line 124</span>
230
- def self.get_secret_key(keyname, required=true, file=<span class="ruby-constant">File</span>, yaml=<span class="ruby-constant">YAML</span>)
231
- return <span class="ruby-constant">CommonFunctions</span>.get_from_yaml(keyname, :secret, required, file, yaml)
284
+ <span class="ruby-comment"># File lib/common_functions.rb, line 138</span>
285
+ def self.get_secret_key(keyname, required=true)
286
+ return <span class="ruby-constant">CommonFunctions</span>.get_from_yaml(keyname, :secret, required)
232
287
  end</pre>
233
288
  </div>
234
289
 
@@ -246,7 +301,7 @@ end</pre>
246
301
 
247
302
  <div class="method-heading">
248
303
  <span class="method-name">scp_file</span><span
249
- class="method-args">(local_file_loc, remote_file_loc, target_ip, public_key_loc, is_dir=false, file=File, fileutils=FileUtils, kernel=Kernel)</span>
304
+ class="method-args">(local_file_loc, remote_file_loc, target_ip, public_key_loc, is_dir=false)</span>
250
305
  <span class="method-click-advice">click to toggle source</span>
251
306
  </div>
252
307
 
@@ -266,24 +321,24 @@ a directory, we append the -r flag to scp as well.</p>
266
321
  <div class="method-source-code"
267
322
  id="scp_file-source">
268
323
  <pre>
269
- <span class="ruby-comment"># File lib/common_functions.rb, line 49</span>
324
+ <span class="ruby-comment"># File lib/common_functions.rb, line 63</span>
270
325
  def self.scp_file(local_file_loc, remote_file_loc, target_ip, public_key_loc,
271
- is_dir=false, file=<span class="ruby-constant">File</span>, fileutils=<span class="ruby-constant">FileUtils</span>, kernel=<span class="ruby-constant">Kernel</span>)
326
+ is_dir=false)
272
327
  cmd = <span class="ruby-string">&quot;&quot;</span>
273
- local_file_loc = file.expand_path(local_file_loc)
328
+ local_file_loc = <span class="ruby-constant">File</span>.expand_path(local_file_loc)
274
329
 
275
330
  ssh_args = <span class="ruby-string">&quot;-o StrictHostkeyChecking=no 2&gt;&amp;1&quot;</span>
276
331
  ssh_args &lt;&lt; <span class="ruby-string">&quot; -r &quot;</span> if is_dir
277
332
 
278
- public_key_loc = file.expand_path(public_key_loc)
333
+ public_key_loc = <span class="ruby-constant">File</span>.expand_path(public_key_loc)
279
334
  cmd = &quot;scp -i #{public_key_loc} #{ssh_args} #{local_file_loc} root@#{target_ip}:#{remote_file_loc}&quot;
280
335
  cmd &lt;&lt; <span class="ruby-string">&quot;; echo $? &gt;&gt; ~/.appscale/retval&quot;</span>
281
336
 
282
- retval_loc = file.expand_path(<span class="ruby-string">&quot;~/.appscale/retval&quot;</span>)
283
- fileutils.rm_f(retval_loc)
337
+ retval_loc = <span class="ruby-constant">File</span>.expand_path(<span class="ruby-string">&quot;~/.appscale/retval&quot;</span>)
338
+ <span class="ruby-constant">FileUtils</span>.rm_f(retval_loc)
284
339
 
285
340
  begin
286
- <span class="ruby-constant">Timeout</span>::timeout(-1) { kernel.shell(&quot;#{cmd}&quot;) }
341
+ <span class="ruby-constant">Timeout</span>::timeout(-1) { <span class="ruby-constant">CommonFunctions</span>.shell(&quot;#{cmd}&quot;) }
287
342
  rescue <span class="ruby-constant">Timeout</span>::<span class="ruby-constant">Error</span>
288
343
  abort(<span class="ruby-string">&quot;Remotely copying over files failed. Is the destination machine&quot;</span> +
289
344
  <span class="ruby-string">&quot; on and reachable from this computer? We tried the following&quot;</span> +
@@ -291,11 +346,11 @@ def self.scp_file(local_file_loc, remote_file_loc, target_ip, public_key_loc,
291
346
  end
292
347
 
293
348
  loop {
294
- break if file.exists?(retval_loc)
349
+ break if <span class="ruby-constant">File</span>.exists?(retval_loc)
295
350
  sleep(5)
296
351
  }
297
352
 
298
- retval = (file.open(retval_loc) { |f| f.read }).chomp
353
+ retval = (<span class="ruby-constant">File</span>.open(retval_loc) { |f| f.read }).chomp
299
354
  if retval != <span class="ruby-string">&quot;0&quot;</span>
300
355
  abort(&quot;\n\n[#{cmd}] returned #{retval} instead of 0 as expected. Is &quot; +
301
356
  <span class="ruby-string">&quot;your environment set up properly?&quot;</span>)
@@ -318,7 +373,7 @@ end</pre>
318
373
 
319
374
  <div class="method-heading">
320
375
  <span class="method-name">scp_to_shadow</span><span
321
- class="method-args">(local_file_loc, remote_file_loc, keyname, is_dir=false, file=File, get_from_yaml=CommonFunctions.method(:get_from_yaml), scp_file=CommonFunctions.method(:scp_file))</span>
376
+ class="method-args">(local_file_loc, remote_file_loc, keyname, is_dir=false)</span>
322
377
  <span class="method-click-advice">click to toggle source</span>
323
378
  </div>
324
379
 
@@ -335,18 +390,51 @@ by the Neptune job given, but defaults to ”appscale” if not provided.</p>
335
390
  <div class="method-source-code"
336
391
  id="scp_to_shadow-source">
337
392
  <pre>
338
- <span class="ruby-comment"># File lib/common_functions.rb, line 30</span>
393
+ <span class="ruby-comment"># File lib/common_functions.rb, line 47</span>
339
394
  def self.scp_to_shadow(local_file_loc,
340
395
  remote_file_loc,
341
396
  keyname,
342
- is_dir=false,
343
- file=<span class="ruby-constant">File</span>,
344
- get_from_yaml=<span class="ruby-constant">CommonFunctions</span>.method(:get_from_yaml),
345
- scp_file=<span class="ruby-constant">CommonFunctions</span>.method(:scp_file))
346
-
347
- shadow_ip = get_from_yaml.call(keyname, :shadow, file)
348
- ssh_key = file.expand_path(&quot;~/.appscale/#{keyname}.key&quot;)
349
- scp_file.call(local_file_loc, remote_file_loc, shadow_ip, ssh_key, is_dir)
397
+ is_dir=false)
398
+
399
+ shadow_ip = <span class="ruby-constant">CommonFunctions</span>.get_from_yaml(keyname, :shadow)
400
+ ssh_key = <span class="ruby-constant">File</span>.expand_path(&quot;~/.appscale/#{keyname}.key&quot;)
401
+ <span class="ruby-constant">CommonFunctions</span>.scp_file(local_file_loc, remote_file_loc, shadow_ip, ssh_key, is_dir)
402
+ end</pre>
403
+ </div>
404
+
405
+ </div>
406
+
407
+
408
+
409
+
410
+ </div>
411
+
412
+
413
+ <div id="shell-method" class="method-detail ">
414
+ <a name="method-c-shell"></a>
415
+
416
+
417
+ <div class="method-heading">
418
+ <span class="method-name">shell</span><span
419
+ class="method-args">(cmd)</span>
420
+ <span class="method-click-advice">click to toggle source</span>
421
+ </div>
422
+
423
+
424
+ <div class="method-description">
425
+
426
+ <p>Executes a command and returns the result. Is needed to get around
427
+ Flexmock’s inability to mock out Kernel:` (the standard shell exec
428
+ method).</p>
429
+
430
+
431
+
432
+ <div class="method-source-code"
433
+ id="shell-source">
434
+ <pre>
435
+ <span class="ruby-comment"># File lib/common_functions.rb, line 23</span>
436
+ def self.shell(cmd)
437
+ return `#{cmd}`
350
438
  end</pre>
351
439
  </div>
352
440
 
@@ -0,0 +1,142 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: FileNotFoundException</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="./js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="./js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="./lib/custom_exceptions_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/custom_exceptions.rb">lib/custom_exceptions.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link">Exception</p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+
66
+ <!-- Method Quickref -->
67
+
68
+
69
+ <!-- Included Modules -->
70
+
71
+ </div>
72
+
73
+ <div id="project-metadata">
74
+
75
+
76
+
77
+ <div id="classindex-section" class="section project-section">
78
+ <h3 class="section-header">Class/Module Index
79
+ <span class="search-toggle"><img src="./images/find.png"
80
+ height="16" width="16" alt="[+]"
81
+ title="show/hide quicksearch" /></span></h3>
82
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
83
+ <fieldset>
84
+ <legend>Quicksearch</legend>
85
+ <input type="text" name="quicksearch" value=""
86
+ class="quicksearch-field" />
87
+ </fieldset>
88
+ </form>
89
+
90
+ <ul class="link-list">
91
+
92
+ <li><a href="./AppControllerClient.html">AppControllerClient</a></li>
93
+
94
+ <li><a href="./AppControllerException.html">AppControllerException</a></li>
95
+
96
+ <li><a href="./BabelHelper.html">BabelHelper</a></li>
97
+
98
+ <li><a href="./BadConfigurationException.html">BadConfigurationException</a></li>
99
+
100
+ <li><a href="./CommonFunctions.html">CommonFunctions</a></li>
101
+
102
+ <li><a href="./FileNotFoundException.html">FileNotFoundException</a></li>
103
+
104
+ <li><a href="./NeptuneHelper.html">NeptuneHelper</a></li>
105
+
106
+ <li><a href="./Object.html">Object</a></li>
107
+
108
+ </ul>
109
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
110
+ </div>
111
+
112
+
113
+ </div>
114
+ </div>
115
+
116
+ <div id="documentation">
117
+ <h1 class="class">FileNotFoundException</h1>
118
+
119
+ <div id="description">
120
+
121
+ </div>
122
+
123
+ <!-- Constants -->
124
+
125
+
126
+ <!-- Attributes -->
127
+
128
+
129
+ <!-- Methods -->
130
+
131
+
132
+ </div>
133
+
134
+ <div id="validator-badges">
135
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
136
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
137
+ Rdoc Generator</a> 2</small>.</p>
138
+ </div>
139
+
140
+ </body>
141
+ </html>
142
+