mu 5.7.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Mu_Gem.html +1591 -0
- data/bin/mu +11 -0
- data/lib/mu.rb +65 -0
- data/lib/mu/api/ddt.rb +233 -0
- data/lib/mu/api/homepage.rb +54 -0
- data/lib/mu/api/muapi.rb +231 -0
- data/lib/mu/api/netconfig.rb +233 -0
- data/lib/mu/api/scale.rb +199 -0
- data/lib/mu/api/system.rb +40 -0
- data/lib/mu/client.rb +31 -0
- data/lib/mu/command.rb +28 -0
- data/lib/mu/command/api.rb +95 -0
- data/lib/mu/command/cmd_appid.rb +486 -0
- data/lib/mu/command/cmd_cli.rb +151 -0
- data/lib/mu/command/cmd_ddt.rb +449 -0
- data/lib/mu/command/cmd_homepage.rb +146 -0
- data/lib/mu/command/cmd_muapi.rb +361 -0
- data/lib/mu/command/cmd_netconfig.rb +262 -0
- data/lib/mu/command/cmd_runscale.rb +533 -0
- data/lib/mu/command/cmd_runscenario.rb +258 -0
- data/lib/mu/command/cmd_runverify.rb +336 -0
- data/lib/mu/command/cmd_scale.rb +333 -0
- data/lib/mu/command/cmd_system.rb +127 -0
- data/lib/mu/command/curl.rb +246 -0
- data/lib/mu/command/help.rb +29 -0
- data/lib/mu/curl/error.rb +54 -0
- data/lib/mu/curl/verify.rb +137 -0
- data/lib/mu/helper.rb +55 -0
- data/lib/mu/http_helper.rb +232 -0
- data/rdoc/classes/Mu.html +305 -0
- data/rdoc/classes/Mu/Client.html +265 -0
- data/rdoc/classes/Mu/Command.html +208 -0
- data/rdoc/classes/Mu/Command/API.html +524 -0
- data/rdoc/classes/Mu/Command/Cmd_appid.html +934 -0
- data/rdoc/classes/Mu/Command/Cmd_cli.html +515 -0
- data/rdoc/classes/Mu/Command/Cmd_ddt.html +1169 -0
- data/rdoc/classes/Mu/Command/Cmd_homepage.html +489 -0
- data/rdoc/classes/Mu/Command/Cmd_muapi.html +968 -0
- data/rdoc/classes/Mu/Command/Cmd_netconfig.html +743 -0
- data/rdoc/classes/Mu/Command/Cmd_runscale.html +970 -0
- data/rdoc/classes/Mu/Command/Cmd_runscenario.html +530 -0
- data/rdoc/classes/Mu/Command/Cmd_runverify.html +621 -0
- data/rdoc/classes/Mu/Command/Cmd_scale.html +939 -0
- data/rdoc/classes/Mu/Command/Cmd_system.html +426 -0
- data/rdoc/classes/Mu/Command/Curl.html +524 -0
- data/rdoc/classes/Mu/Command/Help.html +166 -0
- data/rdoc/classes/Mu/Curl.html +116 -0
- data/rdoc/classes/Mu/Curl/Error.html +157 -0
- data/rdoc/classes/Mu/Curl/Error/Authorize.html +178 -0
- data/rdoc/classes/Mu/Curl/Error/Connect.html +149 -0
- data/rdoc/classes/Mu/Curl/Error/DNS.html +113 -0
- data/rdoc/classes/Mu/Curl/Error/Region.html +160 -0
- data/rdoc/classes/Mu/Curl/Error/Status.html +149 -0
- data/rdoc/classes/Mu/Curl/Error/Timeout.html +149 -0
- data/rdoc/classes/Mu/Curl/Verify.html +282 -0
- data/rdoc/classes/Mu/Curl/Verify/Request.html +227 -0
- data/rdoc/classes/Mu/Curl/Verify/Response.html +187 -0
- data/rdoc/classes/Mu/Curl/Verify/Result.html +188 -0
- data/rdoc/classes/Mu/Ddt.html +914 -0
- data/rdoc/classes/Mu/Helper.html +308 -0
- data/rdoc/classes/Mu/Homepage.html +377 -0
- data/rdoc/classes/Mu/HttpHelper.html +639 -0
- data/rdoc/classes/Mu/Muapi.html +816 -0
- data/rdoc/classes/Mu/Netconfig.html +781 -0
- data/rdoc/classes/Mu/Scale.html +832 -0
- data/rdoc/classes/Mu/System.html +281 -0
- data/rdoc/classes/Object.html +148 -0
- data/rdoc/classes/TCTestMu.html +1793 -0
- data/rdoc/classes/Test.html +107 -0
- data/rdoc/classes/Test/Unit.html +107 -0
- data/rdoc/classes/Test/Unit/TestCase.html +113 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/lib/mu/api/ddt_rb.html +101 -0
- data/rdoc/files/lib/mu/api/homepage_rb.html +101 -0
- data/rdoc/files/lib/mu/api/muapi_rb.html +101 -0
- data/rdoc/files/lib/mu/api/netconfig_rb.html +101 -0
- data/rdoc/files/lib/mu/api/scale_rb.html +101 -0
- data/rdoc/files/lib/mu/api/system_rb.html +101 -0
- data/rdoc/files/lib/mu/client_rb.html +101 -0
- data/rdoc/files/lib/mu/command/api_rb.html +101 -0
- data/rdoc/files/lib/mu/command/cmd_appid_rb.html +119 -0
- data/rdoc/files/lib/mu/command/cmd_cli_rb.html +108 -0
- data/rdoc/files/lib/mu/command/cmd_ddt_rb.html +117 -0
- data/rdoc/files/lib/mu/command/cmd_homepage_rb.html +115 -0
- data/rdoc/files/lib/mu/command/cmd_muapi_rb.html +116 -0
- data/rdoc/files/lib/mu/command/cmd_netconfig_rb.html +116 -0
- data/rdoc/files/lib/mu/command/cmd_runscale_rb.html +119 -0
- data/rdoc/files/lib/mu/command/cmd_runscenario_rb.html +115 -0
- data/rdoc/files/lib/mu/command/cmd_runverify_rb.html +117 -0
- data/rdoc/files/lib/mu/command/cmd_scale_rb.html +115 -0
- data/rdoc/files/lib/mu/command/cmd_system_rb.html +116 -0
- data/rdoc/files/lib/mu/command/curl_rb.html +101 -0
- data/rdoc/files/lib/mu/command/help_rb.html +101 -0
- data/rdoc/files/lib/mu/command_rb.html +107 -0
- data/rdoc/files/lib/mu/curl/error_rb.html +101 -0
- data/rdoc/files/lib/mu/curl/verify_rb.html +101 -0
- data/rdoc/files/lib/mu/helper_rb.html +101 -0
- data/rdoc/files/lib/mu/http_helper_rb.html +101 -0
- data/rdoc/files/lib/mu_rb.html +121 -0
- data/rdoc/files/test/helper_rb.html +112 -0
- data/rdoc/files/test/tc_test_mu_rb.html +111 -0
- data/rdoc/fr_class_index.html +68 -0
- data/rdoc/fr_file_index.html +55 -0
- data/rdoc/fr_method_index.html +374 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/test/data/app_id_stats.csv +1 -0
- data/test/data/data_cgi.msl +94 -0
- data/test/data/data_cgi.xml +322 -0
- data/test/data/default_test.csv +3 -0
- data/test/data/ftp_with_channel.xml +1643 -0
- data/test/data/irc.xml +3837 -0
- data/test/data/scale_configuration.json +25 -0
- data/test/data/test_data_cgi_error.xml +35 -0
- data/test/helper.rb +18 -0
- data/test/tc_test_mu.rb +716 -0
- metadata +322 -0
@@ -0,0 +1,530 @@
|
|
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: Mu::Command::Cmd_runscenario</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">Mu::Command::Cmd_runscenario</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mu/command/cmd_runscenario_rb.html">
|
59
|
+
lib/mu/command/cmd_runscenario.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Command
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000142">cmd_help</a>
|
90
|
+
<a href="#M000143">cmd_run</a>
|
91
|
+
<a href="#M000147">help</a>
|
92
|
+
<a href="#M000146">parse_cli</a>
|
93
|
+
<a href="#M000144">setup</a>
|
94
|
+
<a href="#M000145">teardown</a>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if includes -->
|
102
|
+
|
103
|
+
<div id="section">
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<div id="attribute-list">
|
110
|
+
<h3 class="section-bar">Attributes</h3>
|
111
|
+
|
112
|
+
<div class="name-list">
|
113
|
+
<table>
|
114
|
+
<tr class="top-aligned-row context-row">
|
115
|
+
<td class="context-item-name">ddt_api</td>
|
116
|
+
<td class="context-item-value"> [RW] </td>
|
117
|
+
<td class="context-item-desc"></td>
|
118
|
+
</tr>
|
119
|
+
<tr class="top-aligned-row context-row">
|
120
|
+
<td class="context-item-name">errors</td>
|
121
|
+
<td class="context-item-value"> [RW] </td>
|
122
|
+
<td class="context-item-desc"></td>
|
123
|
+
</tr>
|
124
|
+
<tr class="top-aligned-row context-row">
|
125
|
+
<td class="context-item-name">host</td>
|
126
|
+
<td class="context-item-value"> [RW] </td>
|
127
|
+
<td class="context-item-desc"></td>
|
128
|
+
</tr>
|
129
|
+
<tr class="top-aligned-row context-row">
|
130
|
+
<td class="context-item-name">password</td>
|
131
|
+
<td class="context-item-value"> [RW] </td>
|
132
|
+
<td class="context-item-desc"></td>
|
133
|
+
</tr>
|
134
|
+
<tr class="top-aligned-row context-row">
|
135
|
+
<td class="context-item-name">username</td>
|
136
|
+
<td class="context-item-value"> [RW] </td>
|
137
|
+
<td class="context-item-desc"></td>
|
138
|
+
</tr>
|
139
|
+
</table>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<!-- if method_list -->
|
146
|
+
<div id="methods">
|
147
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
148
|
+
|
149
|
+
<div id="method-M000142" class="method-detail">
|
150
|
+
<a name="M000142"></a>
|
151
|
+
|
152
|
+
<div class="method-heading">
|
153
|
+
<a href="#M000142" class="method-signature">
|
154
|
+
<span class="method-name">cmd_help</span><span class="method-args">(argv)</span>
|
155
|
+
</a>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div class="method-description">
|
159
|
+
<p>
|
160
|
+
displays command-line <a href="Cmd_runscenario.html#M000147">help</a>
|
161
|
+
</p>
|
162
|
+
<pre>
|
163
|
+
* argv = command-line arguments
|
164
|
+
</pre>
|
165
|
+
<p><a class="source-toggle" href="#"
|
166
|
+
onclick="toggleCode('M000142-source');return false;">[Source]</a></p>
|
167
|
+
<div class="method-source-code" id="M000142-source">
|
168
|
+
<pre>
|
169
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscenario.rb, line 11</span>
|
170
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_help</span> <span class="ruby-identifier">argv</span>
|
171
|
+
<span class="ruby-identifier">help</span>
|
172
|
+
<span class="ruby-keyword kw">end</span>
|
173
|
+
</pre>
|
174
|
+
</div>
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div id="method-M000143" class="method-detail">
|
179
|
+
<a name="M000143"></a>
|
180
|
+
|
181
|
+
<div class="method-heading">
|
182
|
+
<a href="#M000143" class="method-signature">
|
183
|
+
<span class="method-name">cmd_run</span><span class="method-args">(argv)</span>
|
184
|
+
</a>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div class="method-description">
|
188
|
+
<p>
|
189
|
+
verifies a <a href="../../Mu.html">Mu</a> Studio scenario
|
190
|
+
</p>
|
191
|
+
<pre>
|
192
|
+
* argv = command-line arguments, requires a scenario (-s) argument, which must be an xml scenario template to be loaded onto the Mu
|
193
|
+
</pre>
|
194
|
+
<p><a class="source-toggle" href="#"
|
195
|
+
onclick="toggleCode('M000143-source');return false;">[Source]</a></p>
|
196
|
+
<div class="method-source-code" id="M000143-source">
|
197
|
+
<pre>
|
198
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscenario.rb, line 17</span>
|
199
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_run</span> <span class="ruby-identifier">argv</span>
|
200
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
|
201
|
+
<span class="ruby-identifier">setup</span>
|
202
|
+
|
203
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'scenario'</span>]
|
204
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"scenario required"</span>
|
205
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
206
|
+
<span class="ruby-keyword kw">else</span>
|
207
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'scenario'</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-value str">".xml"</span>)
|
208
|
+
<span class="ruby-identifier">scenario</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'scenario'</span>]
|
209
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># TODO: eventually, msl files may be supported by this api</span>
|
210
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"only .xml files are currently supported"</span>
|
211
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
212
|
+
<span class="ruby-keyword kw">end</span>
|
213
|
+
<span class="ruby-keyword kw">end</span>
|
214
|
+
|
215
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'dir'</span>]
|
216
|
+
<span class="ruby-identifier">dir</span> = <span class="ruby-value str">"."</span>
|
217
|
+
<span class="ruby-keyword kw">else</span>
|
218
|
+
<span class="ruby-identifier">dir</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'dir'</span>]
|
219
|
+
<span class="ruby-keyword kw">end</span>
|
220
|
+
|
221
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scenario</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"/"</span>)
|
222
|
+
<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">scenario</span>
|
223
|
+
<span class="ruby-keyword kw">else</span>
|
224
|
+
<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">scenario</span>
|
225
|
+
<span class="ruby-keyword kw">end</span>
|
226
|
+
|
227
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'interfaces'</span>]
|
228
|
+
<span class="ruby-ivar">@interfaces</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
229
|
+
<span class="ruby-keyword kw">else</span>
|
230
|
+
<span class="ruby-ivar">@interfaces</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'interfaces'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>)
|
231
|
+
<span class="ruby-keyword kw">end</span>
|
232
|
+
|
233
|
+
<span class="ruby-ivar">@errors</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
234
|
+
<span class="ruby-identifier">hosts_array</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
235
|
+
<span class="ruby-identifier">roles_array</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
236
|
+
|
237
|
+
<span class="ruby-keyword kw">begin</span>
|
238
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"new session"</span>
|
239
|
+
<span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">new_session</span>
|
240
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">filename</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
241
|
+
<span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>)
|
242
|
+
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">f</span>)
|
243
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">post_xml</span>(<span class="ruby-value str">"templates/import"</span>, <span class="ruby-identifier">doc</span>)
|
244
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"response from post(#{filename}):\n#{response}"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
245
|
+
<span class="ruby-identifier">scenario_name</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//scenario"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">'name'</span>)
|
246
|
+
<span class="ruby-identifier">hosts</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host"</span>)
|
247
|
+
<span class="ruby-identifier">uuid</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//scenario"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">'uuid'</span>)
|
248
|
+
<span class="ruby-identifier">roles</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host/role"</span>)
|
249
|
+
<span class="ruby-identifier">ids</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host/id"</span>)
|
250
|
+
<span class="ruby-identifier">channels</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//steps/channel"</span>)
|
251
|
+
<span class="ruby-identifier">type</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host/type"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">text</span>
|
252
|
+
|
253
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@interfaces</span>.<span class="ruby-identifier">empty?</span>
|
254
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@interfaces</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">size</span>
|
255
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"Error. The number of hosts/interfaces specified on the command-line does not equal the number
|
256
|
+
of hosts in the template. #{@interfaces.size} != #{hosts.size}"</span>
|
257
|
+
<span class="ruby-keyword kw">return</span>
|
258
|
+
<span class="ruby-keyword kw">end</span>
|
259
|
+
<span class="ruby-keyword kw">end</span>
|
260
|
+
|
261
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">load_scenario</span>(<span class="ruby-identifier">uuid</span>)
|
262
|
+
|
263
|
+
<span class="ruby-identifier">roles</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>, <span class="ruby-identifier">i</span> <span class="ruby-operator">|</span>
|
264
|
+
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">text</span>
|
265
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@interfaces</span>.<span class="ruby-identifier">empty?</span>
|
266
|
+
<span class="ruby-keyword kw">begin</span>
|
267
|
+
<span class="ruby-identifier">host</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\(.*\)/</span>).<span class="ruby-identifier">to_s</span>
|
268
|
+
<span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">host</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">"."</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>].<span class="ruby-identifier">downcase</span>
|
269
|
+
<span class="ruby-identifier">hosts_array</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">host</span>
|
270
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
271
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">e</span>
|
272
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"expected to find host name embedded in role, e.g. 'client (A1.V4)'"</span>
|
273
|
+
<span class="ruby-keyword kw">end</span>
|
274
|
+
<span class="ruby-keyword kw">else</span>
|
275
|
+
<span class="ruby-identifier">hosts_array</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@interfaces</span>[<span class="ruby-identifier">i</span>]
|
276
|
+
<span class="ruby-keyword kw">end</span>
|
277
|
+
<span class="ruby-identifier">roles_array</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">content</span> <span class="ruby-comment cmt"># use the whole name for the role</span>
|
278
|
+
<span class="ruby-keyword kw">end</span>
|
279
|
+
|
280
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">set_hosts</span>(<span class="ruby-identifier">roles_array</span>, <span class="ruby-identifier">hosts_array</span>, <span class="ruby-identifier">type</span>)
|
281
|
+
|
282
|
+
<span class="ruby-comment cmt"># if there are channels in the scenario, bind them</span>
|
283
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
284
|
+
<span class="ruby-identifier">channel_roles</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
285
|
+
<span class="ruby-identifier">channel_names</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
286
|
+
<span class="ruby-identifier">arg_channels</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'channel'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>)
|
287
|
+
<span class="ruby-identifier">arg_channels</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">|</span>
|
288
|
+
<span class="ruby-identifier">channel_roles</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"channel"</span> <span class="ruby-comment cmt"># role is always "channel"</span>
|
289
|
+
<span class="ruby-identifier">channel_names</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">c</span>
|
290
|
+
<span class="ruby-keyword kw">end</span>
|
291
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">set_channels</span>(<span class="ruby-identifier">channel_roles</span>, <span class="ruby-identifier">channel_names</span>)
|
292
|
+
<span class="ruby-keyword kw">end</span>
|
293
|
+
|
294
|
+
<span class="ruby-comment cmt"># verify the scenario</span>
|
295
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">setup_test</span>
|
296
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">run</span>
|
297
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
|
298
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"==> #{scenario_name} run returned without status"</span>
|
299
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{scenario_name}: status = #{response}"</span>
|
300
|
+
<span class="ruby-keyword kw">else</span>
|
301
|
+
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">response</span>)
|
302
|
+
<span class="ruby-identifier">status</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//status"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">content</span>
|
303
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"==> #{scenario_name}: status = #{status}"</span>
|
304
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'failed'</span>
|
305
|
+
<span class="ruby-comment cmt"># on error, add to the errors array</span>
|
306
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{scenario_name}: status = #{status}"</span>
|
307
|
+
<span class="ruby-keyword kw">end</span>
|
308
|
+
<span class="ruby-keyword kw">end</span>
|
309
|
+
|
310
|
+
<span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">teardown_test</span>
|
311
|
+
<span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">close_session</span>
|
312
|
+
|
313
|
+
<span class="ruby-comment cmt"># clear the hosts and roles array for the next iteration</span>
|
314
|
+
<span class="ruby-identifier">roles_array</span>.<span class="ruby-identifier">clear</span>
|
315
|
+
<span class="ruby-identifier">hosts_array</span>.<span class="ruby-identifier">clear</span>
|
316
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># if !exclude_list.include? and hosts.length</span>
|
317
|
+
<span class="ruby-comment cmt"># if there were errors, print them out and fail the test</span>
|
318
|
+
<span class="ruby-identifier">estr</span> = <span class="ruby-value str">""</span>
|
319
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@errors</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
320
|
+
<span class="ruby-ivar">@errors</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
|
321
|
+
<span class="ruby-identifier">estr</span> = <span class="ruby-identifier">estr</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\n"</span>
|
322
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">estr</span>
|
323
|
+
<span class="ruby-keyword kw">end</span>
|
324
|
+
<span class="ruby-keyword kw">end</span>
|
325
|
+
<span class="ruby-keyword kw">ensure</span>
|
326
|
+
<span class="ruby-identifier">teardown</span>
|
327
|
+
<span class="ruby-keyword kw">end</span>
|
328
|
+
</pre>
|
329
|
+
</div>
|
330
|
+
</div>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
334
|
+
|
335
|
+
<div id="method-M000147" class="method-detail">
|
336
|
+
<a name="M000147"></a>
|
337
|
+
|
338
|
+
<div class="method-heading">
|
339
|
+
<a href="#M000147" class="method-signature">
|
340
|
+
<span class="method-name">help</span><span class="method-args">()</span>
|
341
|
+
</a>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
<div class="method-description">
|
345
|
+
<p><a class="source-toggle" href="#"
|
346
|
+
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
|
347
|
+
<div class="method-source-code" id="M000147-source">
|
348
|
+
<pre>
|
349
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscenario.rb, line 222</span>
|
350
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>
|
351
|
+
<span class="ruby-identifier">helps</span> = [
|
352
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-c'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--channel'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'channel name'</span> },
|
353
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-d'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--dir'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'directory containing the scenario file'</span> },
|
354
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-h'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--help'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'help on command line options'</span> },
|
355
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-i'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--interfaces'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'comma-separated list of interfaces/hosts, e.g. b1,dell-server'</span> },
|
356
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-m'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--mu_string'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'user, password, mu_ip in the form of admin:admin@10.9.8.7'</span> },
|
357
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-o'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--output'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'output logging to this file'</span> },
|
358
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-s'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--scenario'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'scenario file to run'</span> },
|
359
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-v'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--verbose'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'set Logger::DEBUG level'</span> }
|
360
|
+
]
|
361
|
+
|
362
|
+
<span class="ruby-identifier">cmds</span> = [
|
363
|
+
<span class="ruby-value str">"mu cmd_runscenario:help"</span>,
|
364
|
+
<span class="ruby-value str">"mu cmd_runscenario:run -s <scenario> -i <hosts>"</span>
|
365
|
+
]
|
366
|
+
|
367
|
+
<span class="ruby-identifier">max_long_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:long</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
|
368
|
+
<span class="ruby-identifier">max_value_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:value</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
|
369
|
+
<span class="ruby-identifier">puts</span>
|
370
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Usage: mu cmd_runscenario:<command> <options>"</span>
|
371
|
+
<span class="ruby-identifier">puts</span>
|
372
|
+
<span class="ruby-identifier">helps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
|
373
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"%-*s %*s %-*s %s"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">max_long_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:long</span>], <span class="ruby-value">2</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:short</span>], <span class="ruby-identifier">max_value_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:value</span>], <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:help</span>]]
|
374
|
+
<span class="ruby-keyword kw">end</span>
|
375
|
+
<span class="ruby-identifier">puts</span>
|
376
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Available Commands"</span>
|
377
|
+
<span class="ruby-identifier">puts</span>
|
378
|
+
<span class="ruby-identifier">cmds</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">|</span>
|
379
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">c</span>
|
380
|
+
<span class="ruby-keyword kw">end</span>
|
381
|
+
<span class="ruby-identifier">puts</span>
|
382
|
+
<span class="ruby-keyword kw">end</span>
|
383
|
+
</pre>
|
384
|
+
</div>
|
385
|
+
</div>
|
386
|
+
</div>
|
387
|
+
|
388
|
+
<div id="method-M000146" class="method-detail">
|
389
|
+
<a name="M000146"></a>
|
390
|
+
|
391
|
+
<div class="method-heading">
|
392
|
+
<a href="#M000146" class="method-signature">
|
393
|
+
<span class="method-name">parse_cli</span><span class="method-args">(argv)</span>
|
394
|
+
</a>
|
395
|
+
</div>
|
396
|
+
|
397
|
+
<div class="method-description">
|
398
|
+
<p><a class="source-toggle" href="#"
|
399
|
+
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
|
400
|
+
<div class="method-source-code" id="M000146-source">
|
401
|
+
<pre>
|
402
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscenario.rb, line 164</span>
|
403
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
|
404
|
+
<span class="ruby-identifier">hash</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
405
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">empty?</span>
|
406
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'-'</span>
|
407
|
+
|
408
|
+
<span class="ruby-identifier">k</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
|
409
|
+
|
410
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-c'</span>, <span class="ruby-value str">'--channel'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
411
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'channel'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
412
|
+
<span class="ruby-keyword kw">next</span>
|
413
|
+
<span class="ruby-keyword kw">end</span>
|
414
|
+
|
415
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-d'</span>, <span class="ruby-value str">'--dir'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
416
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'dir'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
417
|
+
<span class="ruby-keyword kw">next</span>
|
418
|
+
<span class="ruby-keyword kw">end</span>
|
419
|
+
|
420
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-h'</span>, <span class="ruby-value str">'--help'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
421
|
+
<span class="ruby-identifier">help</span>
|
422
|
+
<span class="ruby-identifier">exit</span>
|
423
|
+
<span class="ruby-keyword kw">end</span>
|
424
|
+
|
425
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-i'</span>, <span class="ruby-value str">'--interfaces'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
426
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'interfaces'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
427
|
+
<span class="ruby-keyword kw">next</span>
|
428
|
+
<span class="ruby-keyword kw">end</span>
|
429
|
+
|
430
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-m'</span>, <span class="ruby-value str">'--mu_string'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
431
|
+
<span class="ruby-identifier">mu_string</span> = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
432
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mu_string</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(.+?):(.+?)@(.*)/</span>
|
433
|
+
<span class="ruby-ivar">@@mu_admin_user</span> = <span class="ruby-identifier">$1</span>
|
434
|
+
<span class="ruby-ivar">@@mu_admin_pass</span> = <span class="ruby-identifier">$2</span>
|
435
|
+
<span class="ruby-ivar">@@mu_ip</span> = <span class="ruby-identifier">$3</span>
|
436
|
+
<span class="ruby-keyword kw">end</span>
|
437
|
+
<span class="ruby-keyword kw">next</span>
|
438
|
+
<span class="ruby-keyword kw">end</span>
|
439
|
+
|
440
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-o'</span>, <span class="ruby-value str">'--output'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
441
|
+
<span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>), <span class="ruby-value str">"w"</span>)
|
442
|
+
<span class="ruby-keyword kw">next</span>
|
443
|
+
<span class="ruby-keyword kw">end</span>
|
444
|
+
|
445
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-s'</span>, <span class="ruby-value str">'--scenario'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
446
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'scenario'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
447
|
+
<span class="ruby-keyword kw">next</span>
|
448
|
+
<span class="ruby-keyword kw">end</span>
|
449
|
+
|
450
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-v'</span>, <span class="ruby-value str">'--verbose'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
451
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
452
|
+
<span class="ruby-keyword kw">next</span>
|
453
|
+
<span class="ruby-keyword kw">end</span>
|
454
|
+
|
455
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Unknown option #{k}"</span>
|
456
|
+
<span class="ruby-keyword kw">end</span>
|
457
|
+
|
458
|
+
<span class="ruby-identifier">hash</span>
|
459
|
+
<span class="ruby-keyword kw">end</span>
|
460
|
+
</pre>
|
461
|
+
</div>
|
462
|
+
</div>
|
463
|
+
</div>
|
464
|
+
|
465
|
+
<div id="method-M000144" class="method-detail">
|
466
|
+
<a name="M000144"></a>
|
467
|
+
|
468
|
+
<div class="method-heading">
|
469
|
+
<a href="#M000144" class="method-signature">
|
470
|
+
<span class="method-name">setup</span><span class="method-args">()</span>
|
471
|
+
</a>
|
472
|
+
</div>
|
473
|
+
|
474
|
+
<div class="method-description">
|
475
|
+
<p><a class="source-toggle" href="#"
|
476
|
+
onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
|
477
|
+
<div class="method-source-code" id="M000144-source">
|
478
|
+
<pre>
|
479
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscenario.rb, line 149</span>
|
480
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
|
481
|
+
<span class="ruby-ivar">@host</span> = (<span class="ruby-ivar">@@mu_ip</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">"127.0.0.1"</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_ip</span>
|
482
|
+
<span class="ruby-ivar">@username</span> = (<span class="ruby-ivar">@@mu_admin_user</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">"admin"</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_user</span>
|
483
|
+
<span class="ruby-ivar">@password</span> = (<span class="ruby-ivar">@@mu_admin_pass</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">"admin"</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_pass</span>
|
484
|
+
<span class="ruby-ivar">@ddt_api</span> = <span class="ruby-constant">Ddt</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@username</span>, <span class="ruby-ivar">@password</span>)
|
485
|
+
<span class="ruby-ivar">@docroot</span> =<span class="ruby-value str">"/api/v3/"</span>
|
486
|
+
<span class="ruby-ivar">@http</span> = <span class="ruby-constant">HttpHelper</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@username</span>, <span class="ruby-ivar">@password</span>, <span class="ruby-ivar">@docroot</span>)
|
487
|
+
<span class="ruby-keyword kw">end</span>
|
488
|
+
</pre>
|
489
|
+
</div>
|
490
|
+
</div>
|
491
|
+
</div>
|
492
|
+
|
493
|
+
<div id="method-M000145" class="method-detail">
|
494
|
+
<a name="M000145"></a>
|
495
|
+
|
496
|
+
<div class="method-heading">
|
497
|
+
<a href="#M000145" class="method-signature">
|
498
|
+
<span class="method-name">teardown</span><span class="method-args">()</span>
|
499
|
+
</a>
|
500
|
+
</div>
|
501
|
+
|
502
|
+
<div class="method-description">
|
503
|
+
<p><a class="source-toggle" href="#"
|
504
|
+
onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
|
505
|
+
<div class="method-source-code" id="M000145-source">
|
506
|
+
<pre>
|
507
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscenario.rb, line 158</span>
|
508
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teardown</span>
|
509
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">nil?</span>
|
510
|
+
<span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">close_all_sessions</span>
|
511
|
+
<span class="ruby-keyword kw">end</span>
|
512
|
+
<span class="ruby-keyword kw">end</span>
|
513
|
+
</pre>
|
514
|
+
</div>
|
515
|
+
</div>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
|
519
|
+
</div>
|
520
|
+
|
521
|
+
|
522
|
+
</div>
|
523
|
+
|
524
|
+
|
525
|
+
<div id="validator-badges">
|
526
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
527
|
+
</div>
|
528
|
+
|
529
|
+
</body>
|
530
|
+
</html>
|