nitos_testbed_rc 1.0.0.pre.9 → 1.0.0.pre.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/lib/nitos_testbed_rc/cm_factory.rb +48 -19
- data/lib/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -74,7 +74,7 @@ Important!!! If you already have a user_cert.pem certificate in folder /root/.om
|
|
74
74
|
Configuration files
|
75
75
|
-------------------
|
76
76
|
|
77
|
-
Change configuration file '/etc/
|
77
|
+
Change configuration file '/etc/nitos_testbed_rc/user_proxy_conf.yaml', which is related to user_proxy of NTRC. For example:
|
78
78
|
|
79
79
|
#xmpp details
|
80
80
|
:xmpp:
|
@@ -89,7 +89,7 @@ Change configuration file '/etc/nitos_testbed/user_proxy_conf.yaml', which is re
|
|
89
89
|
#operation mode for OmfCommon.init (development, production, etc)
|
90
90
|
:operationMode: development
|
91
91
|
|
92
|
-
Change configuration file '/etc/
|
92
|
+
Change configuration file '/etc/nitos_testbed_rc/cm_proxy_conf.yaml', which is related to cm_proxy of NTRC. For example:
|
93
93
|
|
94
94
|
#details to be used for the connection to the xmpp server
|
95
95
|
:xmpp:
|
@@ -109,7 +109,7 @@ Change configuration file '/etc/nitos_testbed/cm_proxy_conf.yaml', which is rela
|
|
109
109
|
#testbed xmpp topic
|
110
110
|
:testbedTopic: am_controller
|
111
111
|
|
112
|
-
Change configuration file '/etc/
|
112
|
+
Change configuration file '/etc/nitos_testbed_rc/frisbee_proxy_conf.yaml', which is related to frisbee_proxy of NTRC. For example:
|
113
113
|
|
114
114
|
#xmpp details
|
115
115
|
:xmpp:
|
@@ -57,7 +57,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
57
57
|
work("status") do |res, node|
|
58
58
|
debug "Status url: http://#{node[:node_cm_ip].to_s}/state"
|
59
59
|
begin
|
60
|
-
|
60
|
+
resp = open("http://#{node[:node_cm_ip].to_s}/state")
|
61
61
|
rescue
|
62
62
|
res.inform(:error, {
|
63
63
|
event_type: "HTTP",
|
@@ -67,9 +67,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
67
67
|
}, :ALL)
|
68
68
|
next
|
69
69
|
end
|
70
|
-
|
71
|
-
ans = doc.xpath("//Response//line//value").text
|
72
|
-
ans.strip!
|
70
|
+
ans = res.parse_responce(resp, "//Response//line//value")
|
73
71
|
|
74
72
|
res.inform(:status, {
|
75
73
|
current: "#{ans}",
|
@@ -86,7 +84,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
86
84
|
end
|
87
85
|
debug "Start_node url: http://#{node[:node_cm_ip].to_s}/on"
|
88
86
|
begin
|
89
|
-
|
87
|
+
resp = open("http://#{node[:node_cm_ip].to_s}/on")
|
90
88
|
rescue
|
91
89
|
res.inform(:error, {
|
92
90
|
event_type: "HTTP",
|
@@ -97,8 +95,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
97
95
|
next
|
98
96
|
end
|
99
97
|
|
100
|
-
ans =
|
101
|
-
ans.strip!
|
98
|
+
ans = res.parse_responce(resp, "//Response")
|
102
99
|
|
103
100
|
if ans == 'ok'
|
104
101
|
res.inform(:status, {
|
@@ -154,10 +151,20 @@ module OmfRc::ResourceProxy::CMFactory
|
|
154
151
|
begin
|
155
152
|
debug "ssh failed, using CM card instead."
|
156
153
|
debug "Stop_node url: http://#{node[:node_cm_ip].to_s}/off"
|
157
|
-
doc = Nokogiri::XML(open("http://#{node[:node_cm_ip].to_s}/off"))
|
158
154
|
|
159
|
-
|
160
|
-
|
155
|
+
begin
|
156
|
+
resp = open("http://#{node[:node_cm_ip].to_s}/off")
|
157
|
+
rescue
|
158
|
+
res.inform(:error, {
|
159
|
+
event_type: "HTTP",
|
160
|
+
exit_code: "-1",
|
161
|
+
node_name: "#{node[:node_name].to_s}",
|
162
|
+
msg: "#{node[:name]} failed to reach cm, ip: #{node[:node_cm_ip].to_s}."
|
163
|
+
}, :ALL)
|
164
|
+
next
|
165
|
+
end
|
166
|
+
|
167
|
+
ans = res.parse_responce(resp, "//Response")
|
161
168
|
|
162
169
|
if ans == 'ok'
|
163
170
|
res.inform(:status, {
|
@@ -223,8 +230,20 @@ module OmfRc::ResourceProxy::CMFactory
|
|
223
230
|
begin
|
224
231
|
debug "ssh failed, using CM card instead."
|
225
232
|
debug "Reset_node url: http://#{node[:node_cm_ip].to_s}/reset"
|
226
|
-
|
227
|
-
|
233
|
+
begin
|
234
|
+
resp = open("http://#{node[:node_cm_ip].to_s}/reset")
|
235
|
+
rescue
|
236
|
+
res.inform(:error, {
|
237
|
+
event_type: "HTTP",
|
238
|
+
exit_code: "-1",
|
239
|
+
node_name: "#{node[:node_name].to_s}",
|
240
|
+
msg: "#{node[:name]} failed to reach cm, ip: #{node[:node_cm_ip].to_s}."
|
241
|
+
}, :ALL)
|
242
|
+
next
|
243
|
+
end
|
244
|
+
|
245
|
+
ans = res.parse_responce(resp, "//Response")
|
246
|
+
if ans == 'ok'
|
228
247
|
res.inform(:status, {
|
229
248
|
node_name: "#{node[:node_name].to_s}",
|
230
249
|
current: :resetted,
|
@@ -271,7 +290,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
271
290
|
end
|
272
291
|
debug "Start_node_pxe RESET: http://#{node[:node_cm_ip].to_s}/reset"
|
273
292
|
begin
|
274
|
-
|
293
|
+
open("http://#{node[:node_cm_ip].to_s}/reset")
|
275
294
|
rescue
|
276
295
|
res.inform(:error, {
|
277
296
|
event_type: "HTTP",
|
@@ -288,7 +307,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
288
307
|
end
|
289
308
|
debug "Start_node_pxe ON: http://#{node[:node_cm_ip].to_s}/on"
|
290
309
|
begin
|
291
|
-
|
310
|
+
open("http://#{node[:node_cm_ip].to_s}/on")
|
292
311
|
rescue
|
293
312
|
res.inform(:error, {
|
294
313
|
event_type: "HTTP",
|
@@ -301,7 +320,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
301
320
|
elsif resp == :started_on_pxe
|
302
321
|
debug "Start_node_pxe STARTED: http://#{node[:node_cm_ip].to_s}/reset"
|
303
322
|
begin
|
304
|
-
|
323
|
+
open("http://#{node[:node_cm_ip].to_s}/reset")
|
305
324
|
rescue
|
306
325
|
res.inform(:error, {
|
307
326
|
event_type: "HTTP",
|
@@ -344,7 +363,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
344
363
|
if action == "reset"
|
345
364
|
debug "Start_node_pxe_off RESET: http://#{node[:node_cm_ip].to_s}/reset"
|
346
365
|
begin
|
347
|
-
|
366
|
+
open("http://#{node[:node_cm_ip].to_s}/reset")
|
348
367
|
rescue
|
349
368
|
res.inform(:error, {
|
350
369
|
event_type: "HTTP",
|
@@ -373,7 +392,7 @@ module OmfRc::ResourceProxy::CMFactory
|
|
373
392
|
elsif action == "shutdown"
|
374
393
|
debug "Start_node_pxe_off SHUTDOWN: http://#{node[:node_cm_ip].to_s}/off"
|
375
394
|
begin
|
376
|
-
|
395
|
+
open("http://#{node[:node_cm_ip].to_s}/off")
|
377
396
|
rescue
|
378
397
|
res.inform(:error, {
|
379
398
|
event_type: "HTTP",
|
@@ -447,8 +466,8 @@ module OmfRc::ResourceProxy::CMFactory
|
|
447
466
|
#this is used by other methods in this scope
|
448
467
|
work("get_status") do |res, node|
|
449
468
|
debug "http://#{node[:node_cm_ip].to_s}/state"
|
450
|
-
|
451
|
-
resp =
|
469
|
+
resp = open("http://#{node[:node_cm_ip].to_s}/state")
|
470
|
+
resp = res.parse_responce(resp, "//Response//line//value")
|
452
471
|
debug "state response: #{resp}"
|
453
472
|
|
454
473
|
if resp == 'on'
|
@@ -462,4 +481,14 @@ module OmfRc::ResourceProxy::CMFactory
|
|
462
481
|
:off
|
463
482
|
end
|
464
483
|
end
|
484
|
+
|
485
|
+
work("parse_responce") do |res, input, path|
|
486
|
+
input = input.string if input.kind_of? StringIO
|
487
|
+
if input[0] == "<"
|
488
|
+
output = Nokogiri::XML(input).xpath(path).text.strip
|
489
|
+
else
|
490
|
+
output = input.strip
|
491
|
+
end
|
492
|
+
output
|
493
|
+
end
|
465
494
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitos_testbed_rc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.10
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omf_common
|