svengali 0.2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README +0 -0
- data/README.rdoc +17 -0
- data/Rakefile +47 -0
- data/VERSION +1 -0
- data/api_document020_en.pdf +0 -0
- data/api_document020_ja.pdf +0 -0
- data/api_document_en.pptx +0 -0
- data/api_document_ja.pptx +0 -0
- data/lib/svengali.rb +2 -0
- data/lib/svengali/config.rb +78 -0
- data/lib/svengali/ext_string.rb +55 -0
- data/lib/svengali/ext_string/command.yml +6 -0
- data/lib/svengali/ext_string/path.yml +6 -0
- data/lib/svengali/file_io.rb +106 -0
- data/lib/svengali/machine.rb +123 -0
- data/lib/svengali/platforms/debian.rb +5 -0
- data/lib/svengali/platforms/default.rb +4 -0
- data/lib/svengali/plugins/eucalyptus.rb +339 -0
- data/lib/svengali/plugins/machine_config.rb +126 -0
- data/lib/svengali/plugins/package.rb +7 -0
- data/lib/svengali/ssh.rb +106 -0
- data/lib/svengali/svengali.rb +19 -0
- data/lib/svengali/util.rb +117 -0
- data/rdoc/classes/CLibIPAddr.html +230 -0
- data/rdoc/classes/Cloud.html +506 -0
- data/rdoc/classes/Config.html +151 -0
- data/rdoc/classes/Config/ConfigFile.html +319 -0
- data/rdoc/classes/ExtStr.html +209 -0
- data/rdoc/classes/ExtStrAccessor.html +183 -0
- data/rdoc/classes/FileIO.html +415 -0
- data/rdoc/classes/Machine.html +771 -0
- data/rdoc/classes/MachineMaster.html +117 -0
- data/rdoc/classes/Platform.html +121 -0
- data/rdoc/classes/SSH.html +315 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README.html +101 -0
- data/rdoc/files/README_rdoc.html +133 -0
- data/rdoc/files/lib/svengali/config_rb.html +114 -0
- data/rdoc/files/lib/svengali/ext_string_rb.html +108 -0
- data/rdoc/files/lib/svengali/file_io_rb.html +115 -0
- data/rdoc/files/lib/svengali/machine_rb.html +108 -0
- data/rdoc/files/lib/svengali/platforms/debian_rb.html +107 -0
- data/rdoc/files/lib/svengali/platforms/default_rb.html +107 -0
- data/rdoc/files/lib/svengali/plugins/eucalyptus_rb.html +389 -0
- data/rdoc/files/lib/svengali/plugins/machine_config_rb.html +101 -0
- data/rdoc/files/lib/svengali/plugins/package_rb.html +101 -0
- data/rdoc/files/lib/svengali/ssh_rb.html +110 -0
- data/rdoc/files/lib/svengali/svengali_rb.html +125 -0
- data/rdoc/files/lib/svengali/util_rb.html +439 -0
- data/rdoc/files/lib/svengali_rb.html +108 -0
- data/rdoc/fr_class_index.html +37 -0
- data/rdoc/fr_file_index.html +41 -0
- data/rdoc/fr_method_index.html +100 -0
- data/rdoc/index.html +26 -0
- data/rdoc/rdoc-style.css +208 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/svengali_spec.rb +7 -0
- data/svengali.gemspec +113 -0
- data/svengali_sample.rb +43 -0
- data/test/scenario.sh +3 -0
- metadata +179 -0
@@ -0,0 +1,771 @@
|
|
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>Class: Machine</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="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Machine</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/svengali/machine_rb.html">
|
59
|
+
lib/svengali/machine.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../files/lib/svengali/plugins/eucalyptus_rb.html">
|
63
|
+
lib/svengali/plugins/eucalyptus.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../files/lib/svengali/plugins/machine_config_rb.html">
|
67
|
+
lib/svengali/plugins/machine_config.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../files/lib/svengali/plugins/package_rb.html">
|
71
|
+
lib/svengali/plugins/package.rb
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
</td>
|
75
|
+
</tr>
|
76
|
+
|
77
|
+
<tr class="top-aligned-row">
|
78
|
+
<td><strong>Parent:</strong></td>
|
79
|
+
<td>
|
80
|
+
<a href="MachineMaster.html">
|
81
|
+
MachineMaster
|
82
|
+
</a>
|
83
|
+
</td>
|
84
|
+
</tr>
|
85
|
+
</table>
|
86
|
+
</div>
|
87
|
+
<!-- banner header -->
|
88
|
+
|
89
|
+
<div id="bodyContent">
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<div id="contextContent">
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div id="method-list">
|
100
|
+
<h3 class="section-bar">Methods</h3>
|
101
|
+
|
102
|
+
<div class="name-list">
|
103
|
+
<a href="#M000034">cleanup</a>
|
104
|
+
<a href="#M000047">config_nw_interface</a>
|
105
|
+
<a href="#M000045">destroy_instance</a>
|
106
|
+
<a href="#M000037">establish_session</a>
|
107
|
+
<a href="#M000038">exec</a>
|
108
|
+
<a href="#M000039">exec!</a>
|
109
|
+
<a href="#M000040">exec_on!</a>
|
110
|
+
<a href="#M000041">exec_script_on</a>
|
111
|
+
<a href="#M000044">get_instance_info</a>
|
112
|
+
<a href="#M000049">install_package</a>
|
113
|
+
<a href="#M000033">new</a>
|
114
|
+
<a href="#M000035">set_auth_info</a>
|
115
|
+
<a href="#M000036">set_auth_info_pki</a>
|
116
|
+
<a href="#M000043">set_instance_info</a>
|
117
|
+
<a href="#M000048">set_resolver</a>
|
118
|
+
<a href="#M000046">set_whether_do_cache</a>
|
119
|
+
<a href="#M000042">sftp</a>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
<!-- if includes -->
|
127
|
+
<div id="includes">
|
128
|
+
<h3 class="section-bar">Included Modules</h3>
|
129
|
+
|
130
|
+
<div id="includes-list">
|
131
|
+
<span class="include-name"><a href="Config.html">Config</a></span>
|
132
|
+
<span class="include-name"><a href="FileIO.html">FileIO</a></span>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<div id="section">
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<div id="attribute-list">
|
143
|
+
<h3 class="section-bar">Attributes</h3>
|
144
|
+
|
145
|
+
<div class="name-list">
|
146
|
+
<table>
|
147
|
+
<tr class="top-aligned-row context-row">
|
148
|
+
<td class="context-item-name">ssh</td>
|
149
|
+
<td class="context-item-value"> [R] </td>
|
150
|
+
<td class="context-item-desc"></td>
|
151
|
+
</tr>
|
152
|
+
</table>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<!-- if method_list -->
|
159
|
+
<div id="methods">
|
160
|
+
<h3 class="section-bar">Public Class methods</h3>
|
161
|
+
|
162
|
+
<div id="method-M000033" class="method-detail">
|
163
|
+
<a name="M000033"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="#M000033" class="method-signature">
|
167
|
+
<span class="method-name">new</span><span class="method-args">(host=nil)</span>
|
168
|
+
</a>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
<p><a class="source-toggle" href="#"
|
173
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
174
|
+
<div class="method-source-code" id="M000033-source">
|
175
|
+
<pre>
|
176
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 27</span>
|
177
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>=<span class="ruby-keyword kw">nil</span>)
|
178
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt">#substitute of constructor which has no argument</span>
|
179
|
+
<span class="ruby-keyword kw">else</span>
|
180
|
+
<span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">to_s</span>()
|
181
|
+
<span class="ruby-identifier">initialize</span>()
|
182
|
+
<span class="ruby-keyword kw">end</span>
|
183
|
+
<span class="ruby-keyword kw">end</span>
|
184
|
+
</pre>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
190
|
+
|
191
|
+
<div id="method-M000034" class="method-detail">
|
192
|
+
<a name="M000034"></a>
|
193
|
+
|
194
|
+
<div class="method-heading">
|
195
|
+
<a href="#M000034" class="method-signature">
|
196
|
+
<span class="method-name">cleanup</span><span class="method-args">()</span>
|
197
|
+
</a>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
<div class="method-description">
|
201
|
+
<p><a class="source-toggle" href="#"
|
202
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
203
|
+
<div class="method-source-code" id="M000034-source">
|
204
|
+
<pre>
|
205
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 35</span>
|
206
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
|
207
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-value str">"start cleanup instance for "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@host</span>
|
208
|
+
<span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">close_channel</span>()
|
209
|
+
<span class="ruby-ivar">@ssh</span>.<span class="ruby-identifier">close</span>()
|
210
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-value str">"finished cleanup instance for "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@host</span>
|
211
|
+
<span class="ruby-comment cmt"># @@group.list.each {|th| th.join }</span>
|
212
|
+
<span class="ruby-keyword kw">end</span>
|
213
|
+
</pre>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="method-M000047" class="method-detail">
|
219
|
+
<a name="M000047"></a>
|
220
|
+
|
221
|
+
<div class="method-heading">
|
222
|
+
<a href="#M000047" class="method-signature">
|
223
|
+
<span class="method-name">config_nw_interface</span><span class="method-args">(params_hash)</span>
|
224
|
+
</a>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div class="method-description">
|
228
|
+
<p>
|
229
|
+
:ipaddr -> <a href="CLibIPAddr.html">CLibIPAddr</a> : IP address which
|
230
|
+
assigned to interface :interface -> string : interface name :netmask
|
231
|
+
-> string : netmask :gateway -> <a
|
232
|
+
href="CLibIPAddr.html">CLibIPAddr</a> : IP address of gateway :onboot ->
|
233
|
+
string : yes or no (you can omit) :hwaddr -> string : MAC address (you
|
234
|
+
can omit)
|
235
|
+
</p>
|
236
|
+
<p><a class="source-toggle" href="#"
|
237
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
238
|
+
<div class="method-source-code" id="M000047-source">
|
239
|
+
<pre>
|
240
|
+
<span class="ruby-comment cmt"># File lib/svengali/plugins/machine_config.rb, line 9</span>
|
241
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">config_nw_interface</span>(<span class="ruby-identifier">params_hash</span>)
|
242
|
+
<span class="ruby-identifier">config_file</span> = <span class="ruby-keyword kw">nil</span>
|
243
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">interface_name_str</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:interface</span>]
|
244
|
+
<span class="ruby-comment cmt">#open or create target file</span>
|
245
|
+
<span class="ruby-identifier">target_path</span> = <span class="ruby-constant">ExtStr</span>.<span class="ruby-identifier">path</span>[<span class="ruby-value str">"network_configs"</span>]<span class="ruby-operator">+</span><span class="ruby-value str">"ifcfg-"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">interface_name_str</span>
|
246
|
+
<span class="ruby-identifier">config_file</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_config_file</span>(<span class="ruby-identifier">target_path</span>)
|
247
|
+
<span class="ruby-keyword kw">else</span>
|
248
|
+
<span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">"please specify a value of :interface!"</span>)
|
249
|
+
<span class="ruby-keyword kw">end</span>
|
250
|
+
|
251
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">netmask</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:netmask</span>]
|
252
|
+
<span class="ruby-identifier">netmask_str</span> = <span class="ruby-identifier">netmask</span>.<span class="ruby-identifier">to_s</span>()
|
253
|
+
<span class="ruby-comment cmt"># remove_col_by_regexp should be used under normal condition</span>
|
254
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"NETMASK"</span>)
|
255
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"NETMASK="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">netmask_str</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>)
|
256
|
+
<span class="ruby-keyword kw">else</span>
|
257
|
+
<span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">"please specify a value of :netmask!"</span>)
|
258
|
+
<span class="ruby-keyword kw">end</span>
|
259
|
+
|
260
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ipaddr</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>]
|
261
|
+
<span class="ruby-identifier">ipaddr_str</span> = <span class="ruby-identifier">ipaddr</span>.<span class="ruby-identifier">to_s</span>()
|
262
|
+
<span class="ruby-comment cmt"># remove_col_by_regexp should be used under normal condition</span>
|
263
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"IPADDR"</span>)
|
264
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"IPADDR="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ipaddr_str</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>)
|
265
|
+
<span class="ruby-keyword kw">else</span>
|
266
|
+
<span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">"please specify a value of :ipaddr!"</span>)
|
267
|
+
<span class="ruby-keyword kw">end</span>
|
268
|
+
|
269
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">gateway</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:gateway</span>]
|
270
|
+
<span class="ruby-identifier">gateway_str</span> = <span class="ruby-identifier">gateway</span>.<span class="ruby-identifier">to_s</span>()
|
271
|
+
<span class="ruby-comment cmt"># remove_col_by_regexp should be used under normal condition</span>
|
272
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"GATEWAY"</span>)
|
273
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"GATEWAY="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">gateway_str</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>)
|
274
|
+
<span class="ruby-keyword kw">else</span>
|
275
|
+
<span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">"please specify a value of :gateway!"</span>)
|
276
|
+
<span class="ruby-keyword kw">end</span>
|
277
|
+
|
278
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hwaddr</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:hwaddr</span>]
|
279
|
+
<span class="ruby-comment cmt"># remove_col_by_regexp should be used under normal condition</span>
|
280
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"HWADDR"</span>)
|
281
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"HWADDR="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hwaddr</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>)
|
282
|
+
<span class="ruby-keyword kw">end</span>
|
283
|
+
|
284
|
+
<span class="ruby-identifier">onboot</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:onboot</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">"yes"</span> <span class="ruby-comment cmt"># default is "yes"</span>
|
285
|
+
<span class="ruby-comment cmt"># remove_col_by_regexp should be used under normal condition</span>
|
286
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"ONBOOT"</span>)
|
287
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"ONBOOT="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">onboot</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>)
|
288
|
+
|
289
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"BOOTPROTO"</span>)
|
290
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"BOOTRPROTO=static\n"</span>)
|
291
|
+
|
292
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">save</span>()
|
293
|
+
<span class="ruby-identifier">lazy_inp</span>()
|
294
|
+
<span class="ruby-keyword kw">end</span>
|
295
|
+
</pre>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div id="method-M000045" class="method-detail">
|
301
|
+
<a name="M000045"></a>
|
302
|
+
|
303
|
+
<div class="method-heading">
|
304
|
+
<a href="#M000045" class="method-signature">
|
305
|
+
<span class="method-name">destroy_instance</span><span class="method-args">()</span>
|
306
|
+
</a>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div class="method-description">
|
310
|
+
<p><a class="source-toggle" href="#"
|
311
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
312
|
+
<div class="method-source-code" id="M000045-source">
|
313
|
+
<pre>
|
314
|
+
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 141</span>
|
315
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy_instance</span>()
|
316
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@instance_id_str</span>
|
317
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"set_cloud_info() should be called appropriately before destroying instance"</span>
|
318
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"exit destroy_instance() without terminating"</span>
|
319
|
+
<span class="ruby-keyword kw">return</span>
|
320
|
+
<span class="ruby-keyword kw">end</span>
|
321
|
+
|
322
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@do_cache</span>
|
323
|
+
<span class="ruby-identifier">terminate_instance</span>(<span class="ruby-ivar">@instance_id_str</span>)
|
324
|
+
<span class="ruby-keyword kw">end</span>
|
325
|
+
|
326
|
+
<span class="ruby-keyword kw">end</span>
|
327
|
+
</pre>
|
328
|
+
</div>
|
329
|
+
</div>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div id="method-M000037" class="method-detail">
|
333
|
+
<a name="M000037"></a>
|
334
|
+
|
335
|
+
<div class="method-heading">
|
336
|
+
<a href="#M000037" class="method-signature">
|
337
|
+
<span class="method-name">establish_session</span><span class="method-args">()</span>
|
338
|
+
</a>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="method-description">
|
342
|
+
<p><a class="source-toggle" href="#"
|
343
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
344
|
+
<div class="method-source-code" id="M000037-source">
|
345
|
+
<pre>
|
346
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 58</span>
|
347
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">establish_session</span>()
|
348
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-value str">"start establish_session to "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@host</span>
|
349
|
+
<span class="ruby-comment cmt"># Spawn worker threads</span>
|
350
|
+
|
351
|
+
<span class="ruby-identifier">th</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
352
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-node">"Initialization of Machine ##{@host} is started."</span>
|
353
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@private_key_path</span>
|
354
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@user_name</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@passphrase</span>
|
355
|
+
<span class="ruby-ivar">@ssh</span> = <span class="ruby-constant">SSH</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>,<span class="ruby-ivar">@user_name</span>,<span class="ruby-ivar">@passphrase</span>)
|
356
|
+
<span class="ruby-keyword kw">else</span>
|
357
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-value str">"please set user name and password when you want to use public key authentication"</span>
|
358
|
+
<span class="ruby-identifier">exit</span>()
|
359
|
+
<span class="ruby-keyword kw">end</span>
|
360
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@user_name</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@password</span>
|
361
|
+
<span class="ruby-ivar">@ssh</span> = <span class="ruby-constant">SSH</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>,<span class="ruby-ivar">@user_name</span>,<span class="ruby-ivar">@password</span>)
|
362
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@user_name</span>
|
363
|
+
<span class="ruby-ivar">@ssh</span> = <span class="ruby-constant">SSH</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@userneme</span>)
|
364
|
+
<span class="ruby-keyword kw">else</span>
|
365
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-value str">"please set user name at leaset"</span>
|
366
|
+
<span class="ruby-identifier">exit</span>()
|
367
|
+
<span class="ruby-keyword kw">end</span>
|
368
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-node">"Initialization of Machine ##{@host} is finished."</span>
|
369
|
+
|
370
|
+
<span class="ruby-ivar">@sftp_session</span> = <span class="ruby-ivar">@ssh</span>.<span class="ruby-identifier">sftp_session</span>
|
371
|
+
<span class="ruby-ivar">@@group</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">th</span>)
|
372
|
+
<span class="ruby-keyword kw">end</span>
|
373
|
+
|
374
|
+
<span class="ruby-comment cmt">#wait until finishing initialize of @ssh object</span>
|
375
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@ssh</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
376
|
+
<span class="ruby-identifier">sleep</span>(<span class="ruby-value">1</span>)
|
377
|
+
<span class="ruby-keyword kw">end</span>
|
378
|
+
|
379
|
+
<span class="ruby-identifier">debug_p</span> <span class="ruby-value str">"finished establish_session to "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@host</span>
|
380
|
+
<span class="ruby-keyword kw">end</span>
|
381
|
+
</pre>
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div id="method-M000038" class="method-detail">
|
387
|
+
<a name="M000038"></a>
|
388
|
+
|
389
|
+
<div class="method-heading">
|
390
|
+
<a href="#M000038" class="method-signature">
|
391
|
+
<span class="method-name">exec</span><span class="method-args">(command_str)</span>
|
392
|
+
</a>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
<div class="method-description">
|
396
|
+
<p><a class="source-toggle" href="#"
|
397
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
398
|
+
<div class="method-source-code" id="M000038-source">
|
399
|
+
<pre>
|
400
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 93</span>
|
401
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exec</span>(<span class="ruby-identifier">command_str</span>)
|
402
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@ssh</span>.<span class="ruby-identifier">exec</span>(<span class="ruby-identifier">command_str</span>)
|
403
|
+
<span class="ruby-keyword kw">end</span>
|
404
|
+
</pre>
|
405
|
+
</div>
|
406
|
+
</div>
|
407
|
+
</div>
|
408
|
+
|
409
|
+
<div id="method-M000039" class="method-detail">
|
410
|
+
<a name="M000039"></a>
|
411
|
+
|
412
|
+
<div class="method-heading">
|
413
|
+
<a href="#M000039" class="method-signature">
|
414
|
+
<span class="method-name">exec!</span><span class="method-args">(command_str,timeout = nil)</span>
|
415
|
+
</a>
|
416
|
+
</div>
|
417
|
+
|
418
|
+
<div class="method-description">
|
419
|
+
<p><a class="source-toggle" href="#"
|
420
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
421
|
+
<div class="method-source-code" id="M000039-source">
|
422
|
+
<pre>
|
423
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 97</span>
|
424
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exec!</span>(<span class="ruby-identifier">command_str</span>,<span class="ruby-identifier">timeout</span> = <span class="ruby-keyword kw">nil</span>)
|
425
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@ssh</span>.<span class="ruby-identifier">exec!</span>(<span class="ruby-identifier">command_str</span>,<span class="ruby-identifier">timeout</span>)
|
426
|
+
<span class="ruby-keyword kw">end</span>
|
427
|
+
</pre>
|
428
|
+
</div>
|
429
|
+
</div>
|
430
|
+
</div>
|
431
|
+
|
432
|
+
<div id="method-M000040" class="method-detail">
|
433
|
+
<a name="M000040"></a>
|
434
|
+
|
435
|
+
<div class="method-heading">
|
436
|
+
<a href="#M000040" class="method-signature">
|
437
|
+
<span class="method-name">exec_on!</span><span class="method-args">(command_str,current_path_str)</span>
|
438
|
+
</a>
|
439
|
+
</div>
|
440
|
+
|
441
|
+
<div class="method-description">
|
442
|
+
<p>
|
443
|
+
call <a href="Machine.html#M000039">exec!</a>( command ) on specified path
|
444
|
+
TODO: change function name to <a href="Machine.html#M000040">exec_on!</a>
|
445
|
+
</p>
|
446
|
+
<p><a class="source-toggle" href="#"
|
447
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
448
|
+
<div class="method-source-code" id="M000040-source">
|
449
|
+
<pre>
|
450
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 103</span>
|
451
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exec_on!</span>(<span class="ruby-identifier">command_str</span>,<span class="ruby-identifier">current_path_str</span>)
|
452
|
+
<span class="ruby-identifier">exec!</span>(<span class="ruby-node">"cd #{current_path_str};"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">command_str</span>)
|
453
|
+
<span class="ruby-keyword kw">end</span>
|
454
|
+
</pre>
|
455
|
+
</div>
|
456
|
+
</div>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
<div id="method-M000041" class="method-detail">
|
460
|
+
<a name="M000041"></a>
|
461
|
+
|
462
|
+
<div class="method-heading">
|
463
|
+
<a href="#M000041" class="method-signature">
|
464
|
+
<span class="method-name">exec_script_on</span><span class="method-args">(script_path_str,arguments_str,current_path_str)</span>
|
465
|
+
</a>
|
466
|
+
</div>
|
467
|
+
|
468
|
+
<div class="method-description">
|
469
|
+
<p>
|
470
|
+
execute local script on remote current_path_str -> string: if change of
|
471
|
+
directory is not needed, please pass "." use remote /tmp
|
472
|
+
directory to store script file TODO: change function name to
|
473
|
+
exec_script_on!
|
474
|
+
</p>
|
475
|
+
<p><a class="source-toggle" href="#"
|
476
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
477
|
+
<div class="method-source-code" id="M000041-source">
|
478
|
+
<pre>
|
479
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 111</span>
|
480
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exec_script_on</span>(<span class="ruby-identifier">script_path_str</span>,<span class="ruby-identifier">arguments_str</span>,<span class="ruby-identifier">current_path_str</span>)
|
481
|
+
<span class="ruby-identifier">fname_str</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">script_path_str</span>)
|
482
|
+
<span class="ruby-identifier">rempte_path_str</span> = <span class="ruby-value str">"/tmp/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">fname_str</span>
|
483
|
+
<span class="ruby-identifier">push_a_file</span>(<span class="ruby-identifier">script_path_str</span>,<span class="ruby-identifier">rempte_path_str</span>)
|
484
|
+
<span class="ruby-identifier">exec_on!</span>(<span class="ruby-node">"sh #{rempte_path_str} "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arguments_str</span>,<span class="ruby-identifier">current_path_str</span>)
|
485
|
+
<span class="ruby-keyword kw">end</span>
|
486
|
+
</pre>
|
487
|
+
</div>
|
488
|
+
</div>
|
489
|
+
</div>
|
490
|
+
|
491
|
+
<div id="method-M000044" class="method-detail">
|
492
|
+
<a name="M000044"></a>
|
493
|
+
|
494
|
+
<div class="method-heading">
|
495
|
+
<a href="#M000044" class="method-signature">
|
496
|
+
<span class="method-name">get_instance_info</span><span class="method-args">()</span>
|
497
|
+
</a>
|
498
|
+
</div>
|
499
|
+
|
500
|
+
<div class="method-description">
|
501
|
+
<p>
|
502
|
+
return -> string: ID of vm instance
|
503
|
+
</p>
|
504
|
+
<p><a class="source-toggle" href="#"
|
505
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
506
|
+
<div class="method-source-code" id="M000044-source">
|
507
|
+
<pre>
|
508
|
+
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 137</span>
|
509
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_instance_info</span>()
|
510
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@instance_id_str</span>
|
511
|
+
<span class="ruby-keyword kw">end</span>
|
512
|
+
</pre>
|
513
|
+
</div>
|
514
|
+
</div>
|
515
|
+
</div>
|
516
|
+
|
517
|
+
<div id="method-M000049" class="method-detail">
|
518
|
+
<a name="M000049"></a>
|
519
|
+
|
520
|
+
<div class="method-heading">
|
521
|
+
<a href="#M000049" class="method-signature">
|
522
|
+
<span class="method-name">install_package</span><span class="method-args">(package_name_str)</span>
|
523
|
+
</a>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
<div class="method-description">
|
527
|
+
<p><a class="source-toggle" href="#"
|
528
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
529
|
+
<div class="method-source-code" id="M000049-source">
|
530
|
+
<pre>
|
531
|
+
<span class="ruby-comment cmt"># File lib/svengali/plugins/package.rb, line 3</span>
|
532
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">install_package</span>(<span class="ruby-identifier">package_name_str</span>)
|
533
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@ssh</span>.<span class="ruby-identifier">exec!</span>(<span class="ruby-constant">ExtStr</span>.<span class="ruby-identifier">cmd</span>[<span class="ruby-value str">"package_install"</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">package_name_str</span>)
|
534
|
+
<span class="ruby-keyword kw">end</span>
|
535
|
+
</pre>
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
</div>
|
539
|
+
|
540
|
+
<div id="method-M000035" class="method-detail">
|
541
|
+
<a name="M000035"></a>
|
542
|
+
|
543
|
+
<div class="method-heading">
|
544
|
+
<a href="#M000035" class="method-signature">
|
545
|
+
<span class="method-name">set_auth_info</span><span class="method-args">(user_name,password = nil)</span>
|
546
|
+
</a>
|
547
|
+
</div>
|
548
|
+
|
549
|
+
<div class="method-description">
|
550
|
+
<p>
|
551
|
+
def <a href="Machine.html#M000035">set_auth_info</a>(user_name)
|
552
|
+
</p>
|
553
|
+
<pre>
|
554
|
+
@user_name = user_name
|
555
|
+
</pre>
|
556
|
+
<p>
|
557
|
+
end
|
558
|
+
</p>
|
559
|
+
<p><a class="source-toggle" href="#"
|
560
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
561
|
+
<div class="method-source-code" id="M000035-source">
|
562
|
+
<pre>
|
563
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 47</span>
|
564
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_auth_info</span>(<span class="ruby-identifier">user_name</span>,<span class="ruby-identifier">password</span> = <span class="ruby-keyword kw">nil</span>)
|
565
|
+
<span class="ruby-ivar">@user_name</span> = <span class="ruby-identifier">user_name</span>
|
566
|
+
<span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
|
567
|
+
<span class="ruby-keyword kw">end</span>
|
568
|
+
</pre>
|
569
|
+
</div>
|
570
|
+
</div>
|
571
|
+
</div>
|
572
|
+
|
573
|
+
<div id="method-M000036" class="method-detail">
|
574
|
+
<a name="M000036"></a>
|
575
|
+
|
576
|
+
<div class="method-heading">
|
577
|
+
<a href="#M000036" class="method-signature">
|
578
|
+
<span class="method-name">set_auth_info_pki</span><span class="method-args">(user_name,passphrase,private_key_path)</span>
|
579
|
+
</a>
|
580
|
+
</div>
|
581
|
+
|
582
|
+
<div class="method-description">
|
583
|
+
<p><a class="source-toggle" href="#"
|
584
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
585
|
+
<div class="method-source-code" id="M000036-source">
|
586
|
+
<pre>
|
587
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 52</span>
|
588
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_auth_info_pki</span>(<span class="ruby-identifier">user_name</span>,<span class="ruby-identifier">passphrase</span>,<span class="ruby-identifier">private_key_path</span>)
|
589
|
+
<span class="ruby-ivar">@user_name</span> = <span class="ruby-identifier">user_name</span>
|
590
|
+
<span class="ruby-ivar">@passphrase</span> = <span class="ruby-identifier">passphrase</span>
|
591
|
+
<span class="ruby-ivar">@private_key_path</span> = <span class="ruby-identifier">private_key_path</span>
|
592
|
+
<span class="ruby-keyword kw">end</span>
|
593
|
+
</pre>
|
594
|
+
</div>
|
595
|
+
</div>
|
596
|
+
</div>
|
597
|
+
|
598
|
+
<div id="method-M000043" class="method-detail">
|
599
|
+
<a name="M000043"></a>
|
600
|
+
|
601
|
+
<div class="method-heading">
|
602
|
+
<a href="#M000043" class="method-signature">
|
603
|
+
<span class="method-name">set_instance_info</span><span class="method-args">(instance_id_str)</span>
|
604
|
+
</a>
|
605
|
+
</div>
|
606
|
+
|
607
|
+
<div class="method-description">
|
608
|
+
<p><a class="source-toggle" href="#"
|
609
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
610
|
+
<div class="method-source-code" id="M000043-source">
|
611
|
+
<pre>
|
612
|
+
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 132</span>
|
613
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_instance_info</span>(<span class="ruby-identifier">instance_id_str</span>)
|
614
|
+
<span class="ruby-ivar">@instance_id_str</span> = <span class="ruby-identifier">instance_id_str</span>
|
615
|
+
<span class="ruby-keyword kw">end</span>
|
616
|
+
</pre>
|
617
|
+
</div>
|
618
|
+
</div>
|
619
|
+
</div>
|
620
|
+
|
621
|
+
<div id="method-M000048" class="method-detail">
|
622
|
+
<a name="M000048"></a>
|
623
|
+
|
624
|
+
<div class="method-heading">
|
625
|
+
<a href="#M000048" class="method-signature">
|
626
|
+
<span class="method-name">set_resolver</span><span class="method-args">(params_hash)</span>
|
627
|
+
</a>
|
628
|
+
</div>
|
629
|
+
|
630
|
+
<div class="method-description">
|
631
|
+
<p>
|
632
|
+
!!!! Now, this method write resolver information !!!! !!!! to
|
633
|
+
/etc/sysconfig/network-scripts/ifcfg-ethX !!!! !!!! due to baffling
|
634
|
+
behavior of CentOS !!!!
|
635
|
+
</p>
|
636
|
+
<p>
|
637
|
+
:primary_ip -> <a href="CLibIPAddr.html">CLibIPAddr</a> : IP address of
|
638
|
+
primary DNS :secondry_ip -> <a href="CLibIPAddr.html">CLibIPAddr</a> :
|
639
|
+
IP address of secondly DNS :search_domain -> string : domain of search
|
640
|
+
directive
|
641
|
+
</p>
|
642
|
+
<p>
|
643
|
+
:interface -> string : interface name (for CentOS)
|
644
|
+
</p>
|
645
|
+
<p><a class="source-toggle" href="#"
|
646
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
647
|
+
<div class="method-source-code" id="M000048-source">
|
648
|
+
<pre>
|
649
|
+
<span class="ruby-comment cmt"># File lib/svengali/plugins/machine_config.rb, line 73</span>
|
650
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_resolver</span>(<span class="ruby-identifier">params_hash</span>)
|
651
|
+
<span class="ruby-comment cmt">#open or create target file</span>
|
652
|
+
<span class="ruby-identifier">config_file</span> = <span class="ruby-keyword kw">nil</span>
|
653
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">interface_name_str</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:interface</span>]
|
654
|
+
<span class="ruby-identifier">target_path</span> = <span class="ruby-constant">ExtStr</span>.<span class="ruby-identifier">path</span>[<span class="ruby-value str">"network_configs"</span>]<span class="ruby-operator">+</span><span class="ruby-value str">"ifcfg-"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">interface_name_str</span>
|
655
|
+
<span class="ruby-identifier">config_file</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_config_file</span>(<span class="ruby-identifier">target_path</span>)
|
656
|
+
<span class="ruby-keyword kw">else</span>
|
657
|
+
<span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">"please specify a value of :interface!"</span>)
|
658
|
+
<span class="ruby-keyword kw">end</span>
|
659
|
+
|
660
|
+
|
661
|
+
<span class="ruby-comment cmt"># target_path = ExtStr.path["resolver_config"]</span>
|
662
|
+
<span class="ruby-comment cmt"># config_file = self.get_config_file(target_path)</span>
|
663
|
+
<span class="ruby-comment cmt">#</span>
|
664
|
+
<span class="ruby-comment cmt"># if search_domain = params_hash[:search_domain]</span>
|
665
|
+
<span class="ruby-comment cmt"># # remove_col_by_regexp should be used under normal condition</span>
|
666
|
+
<span class="ruby-comment cmt"># config_file.append_str("search " + search_domain + "\n")</span>
|
667
|
+
<span class="ruby-comment cmt"># end</span>
|
668
|
+
<span class="ruby-comment cmt">#</span>
|
669
|
+
<span class="ruby-comment cmt"># if primary_ip = params_hash[:primary_ip]</span>
|
670
|
+
<span class="ruby-comment cmt"># primary_ip_str = primary_ip.to_s()</span>
|
671
|
+
<span class="ruby-comment cmt"># # remove_col_by_regexp should be used under normal condition</span>
|
672
|
+
<span class="ruby-comment cmt"># config_file.remove_col_by_str("nameserver")</span>
|
673
|
+
<span class="ruby-comment cmt"># config_file.append_str("nameserver " + primary_ip_str + "\n")</span>
|
674
|
+
<span class="ruby-comment cmt"># else</span>
|
675
|
+
<span class="ruby-comment cmt"># err_message_and_exit("please specify a value of :primary_ip!")</span>
|
676
|
+
<span class="ruby-comment cmt"># end</span>
|
677
|
+
<span class="ruby-comment cmt">#</span>
|
678
|
+
<span class="ruby-comment cmt"># if secondly_ip = params_hash[:secondly_ip]</span>
|
679
|
+
<span class="ruby-comment cmt"># secondly_ip_str = secondly_ip.to_s()</span>
|
680
|
+
<span class="ruby-comment cmt"># # remove_col_by_regexp should be used under normal condition</span>
|
681
|
+
<span class="ruby-comment cmt"># config_file.append_str("nameserver " + secondly_ip_str + "\n")</span>
|
682
|
+
<span class="ruby-comment cmt"># end</span>
|
683
|
+
|
684
|
+
|
685
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">primary_ip</span> = <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:primary_ip</span>]
|
686
|
+
<span class="ruby-identifier">primary_ip_str</span> = <span class="ruby-identifier">primary_ip</span>.<span class="ruby-identifier">to_s</span>()
|
687
|
+
<span class="ruby-comment cmt"># remove_col_by_regexp should be used under normal condition</span>
|
688
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"PEERDNS"</span>)
|
689
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"PEERDNS=yes\n"</span>)
|
690
|
+
|
691
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-value str">"DNS1"</span>)
|
692
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">append_str</span>(<span class="ruby-value str">"DNS1="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">primary_ip_str</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>)
|
693
|
+
<span class="ruby-keyword kw">else</span>
|
694
|
+
<span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">"please specify a value of :primary_ip!"</span>)
|
695
|
+
<span class="ruby-keyword kw">end</span>
|
696
|
+
|
697
|
+
<span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">save</span>()
|
698
|
+
|
699
|
+
<span class="ruby-identifier">lazy_inp</span>()
|
700
|
+
<span class="ruby-keyword kw">end</span>
|
701
|
+
</pre>
|
702
|
+
</div>
|
703
|
+
</div>
|
704
|
+
</div>
|
705
|
+
|
706
|
+
<div id="method-M000046" class="method-detail">
|
707
|
+
<a name="M000046"></a>
|
708
|
+
|
709
|
+
<div class="method-heading">
|
710
|
+
<a href="#M000046" class="method-signature">
|
711
|
+
<span class="method-name">set_whether_do_cache</span><span class="method-args">(true_or_false)</span>
|
712
|
+
</a>
|
713
|
+
</div>
|
714
|
+
|
715
|
+
<div class="method-description">
|
716
|
+
<p>
|
717
|
+
set whether cache and reuse guest instance on Eucalyptus if true value is
|
718
|
+
set
|
719
|
+
</p>
|
720
|
+
<pre>
|
721
|
+
- destroy_instance(...) doesn't terminate instance
|
722
|
+
</pre>
|
723
|
+
<p><a class="source-toggle" href="#"
|
724
|
+
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
725
|
+
<div class="method-source-code" id="M000046-source">
|
726
|
+
<pre>
|
727
|
+
<span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 157</span>
|
728
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_whether_do_cache</span>(<span class="ruby-identifier">true_or_false</span>)
|
729
|
+
<span class="ruby-ivar">@@do_cache</span> = <span class="ruby-identifier">true_or_false</span>
|
730
|
+
<span class="ruby-keyword kw">end</span>
|
731
|
+
</pre>
|
732
|
+
</div>
|
733
|
+
</div>
|
734
|
+
</div>
|
735
|
+
|
736
|
+
<div id="method-M000042" class="method-detail">
|
737
|
+
<a name="M000042"></a>
|
738
|
+
|
739
|
+
<div class="method-heading">
|
740
|
+
<a href="#M000042" class="method-signature">
|
741
|
+
<span class="method-name">sftp</span><span class="method-args">()</span>
|
742
|
+
</a>
|
743
|
+
</div>
|
744
|
+
|
745
|
+
<div class="method-description">
|
746
|
+
<p><a class="source-toggle" href="#"
|
747
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
748
|
+
<div class="method-source-code" id="M000042-source">
|
749
|
+
<pre>
|
750
|
+
<span class="ruby-comment cmt"># File lib/svengali/machine.rb, line 118</span>
|
751
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sftp</span>()
|
752
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@ssh</span>.<span class="ruby-identifier">sftp_session</span>
|
753
|
+
<span class="ruby-keyword kw">end</span>
|
754
|
+
</pre>
|
755
|
+
</div>
|
756
|
+
</div>
|
757
|
+
</div>
|
758
|
+
|
759
|
+
|
760
|
+
</div>
|
761
|
+
|
762
|
+
|
763
|
+
</div>
|
764
|
+
|
765
|
+
|
766
|
+
<div id="validator-badges">
|
767
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
768
|
+
</div>
|
769
|
+
|
770
|
+
</body>
|
771
|
+
</html>
|