nitos_testbed_rc 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,9 +29,10 @@ module OmfRc::ResourceProxy::Frisbee #frisbee client
29
29
 
30
30
  hook :after_initial_configured do |client|
31
31
  Thread.new do
32
+ sleep 1
32
33
  debug "Received message '#{client.opts.inspect}'"
33
34
  if error_msg = client.opts.error_msg
34
- res.inform(:error,{
35
+ client.inform(:error,{
35
36
  event_type: "AUTH",
36
37
  exit_code: "-1",
37
38
  node_name: client.property.node_topic,
@@ -61,31 +62,36 @@ module OmfRc::ResourceProxy::Frisbee #frisbee client
61
62
  debug "Executing command #{command} on host #{client.property.multicast_interface.to_s}"
62
63
 
63
64
  output = ''
65
+ retry_flag = 0
64
66
  host = Net::Telnet.new("Host" => client.property.multicast_interface.to_s, "Timeout" => 200, "Prompt" => /[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/)
65
- host.cmd(command.to_s) do |c|
66
- if c[0,8] == "Progress"
67
- c = c.split[1]
68
- client.inform(:status, {
69
- status_type: 'FRISBEE',
70
- event: "STDOUT",
71
- app: client.property.app_id,
72
- node: client.property.node_topic,
73
- msg: "#{c.to_s}"
74
- }, :ALL)
75
- elsif c[0,5] == "Wrote"
76
- c = c.split("\n")
77
- output = "#{c.first}\n#{c.last}"
78
- elsif c[0,6] == "\nWrote"
79
- c = c.split("\n")
80
- output = "#{c[1]}\n#{c.last}"
81
- elsif c.strip == "Short write!"
82
- res.inform(:error,{
83
- event_type: "ERROR",
84
- exit_code: "-1",
85
- node_name: client.property.node_topic,
86
- msg: "Load ended with 'Short write' error msg!"
87
- }, :ALL)
67
+ while retry_flag < 2
68
+ host.cmd(command.to_s) do |c|
69
+ if c[0,8] == "Progress"
70
+ c = c.split[1]
71
+ client.inform(:status, {
72
+ status_type: 'FRISBEE',
73
+ event: "STDOUT",
74
+ app: client.property.app_id,
75
+ node: client.property.node_topic,
76
+ msg: "#{c.to_s}"
77
+ }, :ALL)
78
+ elsif c[0,5] == "Wrote"
79
+ c = c.split("\n")
80
+ output = "#{c.first}\n#{c.last}"
81
+ elsif c[0,6] == "\nWrote"
82
+ c = c.split("\n")
83
+ output = "#{c[1]}\n#{c.last}"
84
+ elsif c.strip == "Short write!"
85
+ client.inform(:error,{
86
+ event_type: "ERROR",
87
+ exit_code: "-1",
88
+ node_name: client.property.node_topic,
89
+ msg: "Load ended with 'Short write' error msg!"
90
+ }, :ALL)
91
+ end
88
92
  end
93
+ break if output != ''
94
+ retry_flag += 1
89
95
  end
90
96
 
91
97
  client.inform(:status, {
@@ -97,5 +103,64 @@ module OmfRc::ResourceProxy::Frisbee #frisbee client
97
103
  }, :ALL)
98
104
  host.close
99
105
  end
106
+ # client.execute_frisbee
107
+ end
108
+
109
+ work('execute_frisbee') do |client|
110
+ debug "Received message '#{client.opts.inspect}'"
111
+ sleep 1
112
+ if error_msg = client.opts.error_msg
113
+ client.inform(:error,{
114
+ event_type: "AUTH",
115
+ exit_code: "-1",
116
+ node_name: client.property.node_topic,
117
+ msg: error_msg
118
+ }, :ALL)
119
+ next
120
+ end
121
+
122
+ nod = client.opts.node
123
+ client.property.multicast_interface = nod[:node_ip]
124
+ client.property.app_id = client.hrn.nil? ? client.uid : client.hrn
125
+
126
+ command = "#{client.property.binary_path} -i #{client.property.multicast_interface} -m #{client.property.multicast_address} -p #{client.property.port} #{client.property.hardrive}"
127
+ debug "Executing command #{command} on host #{client.property.multicast_interface.to_s}"
128
+
129
+ output = ''
130
+ host = Net::Telnet.new("Host" => client.property.multicast_interface.to_s, "Timeout" => 200, "Prompt" => /[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/)
131
+ host.cmd(command.to_s) do |c|
132
+ if c[0,8] == "Progress"
133
+ c = c.split[1]
134
+ client.inform(:status, {
135
+ status_type: 'FRISBEE',
136
+ event: "STDOUT",
137
+ app: client.property.app_id,
138
+ node: client.property.node_topic,
139
+ msg: "#{c.to_s}"
140
+ }, :ALL)
141
+ elsif c[0,5] == "Wrote"
142
+ c = c.split("\n")
143
+ output = "#{c.first}\n#{c.last}"
144
+ elsif c[0,6] == "\nWrote"
145
+ c = c.split("\n")
146
+ output = "#{c[1]}\n#{c.last}"
147
+ elsif c.strip == "Short write!"
148
+ client.inform(:error,{
149
+ event_type: "ERROR",
150
+ exit_code: "-1",
151
+ node_name: client.property.node_topic,
152
+ msg: "Load ended with 'Short write' error msg!"
153
+ }, :ALL)
154
+ end
155
+ end
156
+
157
+ client.inform(:status, {
158
+ status_type: 'FRISBEE',
159
+ event: "EXIT",
160
+ app: client.property.app_id,
161
+ node: client.property.node_topic,
162
+ msg: output
163
+ }, :ALL)
164
+ host.close
100
165
  end
101
166
  end
@@ -60,7 +60,7 @@ module OmfRc::ResourceProxy::Frisbeed
60
60
 
61
61
  hook :before_release do |server|
62
62
  begin
63
- @app.signal(signal = 'KILL')
63
+ @app.signal(signal = 'KILL') unless @app.nil?
64
64
  rescue Exception => e
65
65
  raise e unless e.message == "No such process"
66
66
  ensure
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module NITOS
2
2
  module TestbedRc
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nitos_testbed_rc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - NITOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omf_common
@@ -112,6 +112,7 @@ files:
112
112
  - init/ntrc_user.conf
113
113
  - init/run_ntrc.sh
114
114
  - lib/nitos_testbed_rc.rb
115
+ - lib/nitos_testbed_rc/cm.rb
115
116
  - lib/nitos_testbed_rc/cm_factory.rb
116
117
  - lib/nitos_testbed_rc/frisbee.rb
117
118
  - lib/nitos_testbed_rc/frisbee_factory.rb