nitos_testbed_rc 1.0.0.pre.12 → 1.0.0.pre.13
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/omf6 +11 -4
- data/etc/omf_script_conf.yaml +1 -1
- data/lib/nitos_testbed_rc/frisbee.rb +1 -2
- data/lib/nitos_testbed_rc/imagezip_client.rb +79 -36
- data/lib/version.rb +1 -1
- metadata +2 -2
data/bin/omf6
CHANGED
@@ -102,7 +102,11 @@ def create_frisbee(comm, fcontroller, node, port, options, progress_bar)
|
|
102
102
|
overall = @load_complete.values.inject(:+)
|
103
103
|
progress_bar.count = ( overall / @nodes_up_pxe.length)
|
104
104
|
progress_bar.write
|
105
|
-
|
105
|
+
if client_msg.read_property("msg")
|
106
|
+
msg = client_msg.read_property("msg").split("\n")
|
107
|
+
else
|
108
|
+
puts "ERROR: Frisbee client exit with no msg."
|
109
|
+
end
|
106
110
|
@load_end_msg += "#{client_msg.read_property("node")}: #{"#{msg[0]} #{msg[1][14..29]}"}\n"
|
107
111
|
comm.subscribe('cm_factory') do |controller|
|
108
112
|
controller.on_message do |cm_msg|
|
@@ -416,8 +420,12 @@ def create_imagezip_client(comm, fcontroller, node, port, options)
|
|
416
420
|
elsif client_msg.read_property("event") == "EXIT"
|
417
421
|
stop_saving()
|
418
422
|
puts "INFO:"
|
419
|
-
client_msg.read_property("msg")
|
420
|
-
|
423
|
+
if client_msg.read_property("msg")
|
424
|
+
client_msg.read_property("msg").split("\n").each do |line|
|
425
|
+
puts "INFO: #{line}"
|
426
|
+
end
|
427
|
+
else
|
428
|
+
puts "ERROR: Imagezip stopped with no msg."
|
421
429
|
end
|
422
430
|
puts "INFO: Image was saved in '#{@frisbee[:imageDir]}/#{@image}'"
|
423
431
|
puts "INFO:"
|
@@ -506,7 +514,6 @@ def save(comm, options)
|
|
506
514
|
start_saving()
|
507
515
|
puts "INFO: Starting Imagezip Server on port '#{port}'"
|
508
516
|
create_imagezip_server(comm, fcontroller, port, options)
|
509
|
-
sleep 1
|
510
517
|
puts "INFO: Starting Imagezip Client on node '#{options[:node]}'"
|
511
518
|
create_imagezip_client(comm, fcontroller, options[:node], port, options)
|
512
519
|
print "INFO: Saving Image for node '#{options[:node]}'..."
|
data/etc/omf_script_conf.yaml
CHANGED
@@ -58,8 +58,7 @@ module OmfRc::ResourceProxy::Frisbee #frisbee client
|
|
58
58
|
client.property.app_id = client.hrn.nil? ? client.uid : client.hrn
|
59
59
|
|
60
60
|
command = "#{client.property.binary_path} -i #{client.property.multicast_interface} -m #{client.property.multicast_address} -p #{client.property.port} #{client.property.hardrive}"
|
61
|
-
|
62
|
-
|
61
|
+
|
63
62
|
output = ''
|
64
63
|
host = Net::Telnet.new("Host" => client.property.multicast_interface.to_s, "Timeout" => 200, "Prompt" => /[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/)
|
65
64
|
host.cmd(command.to_s) do |c|
|
@@ -3,6 +3,9 @@
|
|
3
3
|
#used in save command
|
4
4
|
|
5
5
|
#$domain = @config[:domain][:ip]
|
6
|
+
require 'net/telnet'
|
7
|
+
require 'socket'
|
8
|
+
require 'timeout'
|
6
9
|
|
7
10
|
module OmfRc::ResourceProxy::ImagezipClient #Imagezip client
|
8
11
|
include OmfRc::ResourceProxyDSL
|
@@ -29,6 +32,7 @@ module OmfRc::ResourceProxy::ImagezipClient #Imagezip client
|
|
29
32
|
hook :after_initial_configured do |client|
|
30
33
|
Thread.new do
|
31
34
|
debug "Received message '#{client.opts.inspect}'"
|
35
|
+
sleep 1
|
32
36
|
if error_msg = client.opts.error_msg
|
33
37
|
res.inform(:error,{
|
34
38
|
event_type: "AUTH",
|
@@ -38,58 +42,97 @@ module OmfRc::ResourceProxy::ImagezipClient #Imagezip client
|
|
38
42
|
}, :ALL)
|
39
43
|
next
|
40
44
|
end
|
41
|
-
# if client.opts.ignore_msg
|
42
|
-
# #just ignore this message, another resource controller should take care of this message
|
43
|
-
# next
|
44
|
-
# end
|
45
|
-
|
46
|
-
# nod = {}
|
47
|
-
# nod[:node_name] = client.opts.node.name
|
48
|
-
# client.opts.node.interfaces.each do |i|
|
49
|
-
# if i[:role] == "control"
|
50
|
-
# nod[:node_ip] = i[:ip][:address]
|
51
|
-
# nod[:node_mac] = i[:mac]
|
52
|
-
# elsif i[:role] == "cm_network"
|
53
|
-
# nod[:node_cm_ip] = i[:ip][:address]
|
54
|
-
# end
|
55
|
-
# end
|
56
|
-
# nod[:node_cm_ip] = client.opts.node.cmc.ip.address
|
57
45
|
|
58
46
|
nod = client.opts.node
|
47
|
+
client.property.multicast_interface = nod[:node_ip]
|
59
48
|
client.property.app_id = client.hrn.nil? ? client.uid : client.hrn
|
60
49
|
|
61
|
-
command = "#{client.property.binary_path} -o -z1
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
debug "Telnet successfull"
|
67
|
-
debug "Executing command #{command.to_s}"
|
50
|
+
command = "#{client.property.binary_path} -o -z1 #{client.property.hardrive} - | #{@fconf[:imagezipClientNC]} -q 0 #{client.property.ip} #{client.property.port}"
|
51
|
+
debug "Executing command #{command} - host #{client.property.multicast_interface.to_s}"
|
52
|
+
host = Net::Telnet.new("Host" => client.property.multicast_interface.to_s, "Timeout" => false, "Telnetmode" => true)
|
53
|
+
|
54
|
+
output = ''
|
68
55
|
host.cmd(command.to_s) do |c|
|
69
56
|
print "#{c}"
|
70
|
-
# if c.to_s != "\n" && c[0,5] != "\n/usr" && c.to_s != "." && c.to_s != ".." && c.to_s != "..."
|
71
|
-
# puts '---------(' + c.to_s + ')-----------'
|
72
57
|
if c.include? 'compressed'
|
73
|
-
|
74
|
-
# client.inform(:status, {
|
75
|
-
# status_type: 'IMAGEZIP',
|
76
|
-
# event: "STDOUT",
|
77
|
-
# app: client.property.app_id,
|
78
|
-
# node: client.property.node_topic,
|
79
|
-
# msg: "#{c.to_s}"
|
80
|
-
# }, :ALL)
|
58
|
+
output = c
|
81
59
|
end
|
82
60
|
end
|
83
|
-
debug "imagezip client finished"
|
84
61
|
|
85
62
|
client.inform(:status, {
|
86
|
-
status_type: '
|
63
|
+
status_type: 'FRISBEE',
|
87
64
|
event: "EXIT",
|
88
65
|
app: client.property.app_id,
|
89
66
|
node: client.property.node_topic,
|
90
|
-
msg:
|
67
|
+
msg: output
|
91
68
|
}, :ALL)
|
92
69
|
host.close
|
93
70
|
end
|
71
|
+
|
72
|
+
# Thread.new do
|
73
|
+
# debug "Received message '#{client.opts.inspect}'"
|
74
|
+
# sleep 2
|
75
|
+
# if error_msg = client.opts.error_msg
|
76
|
+
# res.inform(:error,{
|
77
|
+
# event_type: "AUTH",
|
78
|
+
# exit_code: "-1",
|
79
|
+
# node_name: client.property.node_topic,
|
80
|
+
# msg: error_msg
|
81
|
+
# }, :ALL)
|
82
|
+
# next
|
83
|
+
# end
|
84
|
+
# # if client.opts.ignore_msg
|
85
|
+
# # #just ignore this message, another resource controller should take care of this message
|
86
|
+
# # next
|
87
|
+
# # end
|
88
|
+
|
89
|
+
# # nod = {}
|
90
|
+
# # nod[:node_name] = client.opts.node.name
|
91
|
+
# # client.opts.node.interfaces.each do |i|
|
92
|
+
# # if i[:role] == "control"
|
93
|
+
# # nod[:node_ip] = i[:ip][:address]
|
94
|
+
# # nod[:node_mac] = i[:mac]
|
95
|
+
# # elsif i[:role] == "cm_network"
|
96
|
+
# # nod[:node_cm_ip] = i[:ip][:address]
|
97
|
+
# # end
|
98
|
+
# # end
|
99
|
+
# # nod[:node_cm_ip] = client.opts.node.cmc.ip.address
|
100
|
+
|
101
|
+
# nod = client.opts.node
|
102
|
+
# client.property.app_id = client.hrn.nil? ? client.uid : client.hrn
|
103
|
+
|
104
|
+
# command = "#{client.property.binary_path} -o -z1 -d -d #{client.property.hardrive} - | #{@fconf[:imagezipClientNC]} -q 0 #{client.property.ip} #{client.property.port}"
|
105
|
+
# # nod = {node_name: "node1", node_ip: "10.0.0.1", node_mac: "00-03-1d-0d-4b-96", node_cm_ip: "10.0.0.101"}
|
106
|
+
# summary = ''
|
107
|
+
# debug "Telnet on: '#{nod[:node_ip]}'"
|
108
|
+
# host = Net::Telnet.new("Host" => nod[:node_ip], "Timeout" => 200, "Prompt" => /[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/)#, "Prompt" => /[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/)
|
109
|
+
# debug "Telnet successfull"
|
110
|
+
# debug "Executing command #{command.to_s}"
|
111
|
+
# host.cmd(command.to_s) do |c|
|
112
|
+
# print "#{c}"
|
113
|
+
# # if c.to_s != "\n" && c[0,5] != "\n/usr" && c.to_s != "." && c.to_s != ".." && c.to_s != "..."
|
114
|
+
# # puts '---------(' + c.to_s + ')-----------'
|
115
|
+
# if c.include? 'compressed'
|
116
|
+
# summary = c
|
117
|
+
# # client.inform(:status, {
|
118
|
+
# # status_type: 'IMAGEZIP',
|
119
|
+
# # event: "STDOUT",
|
120
|
+
# # app: client.property.app_id,
|
121
|
+
# # node: client.property.node_topic,
|
122
|
+
# # msg: "#{c.to_s}"
|
123
|
+
# # }, :ALL)
|
124
|
+
# end
|
125
|
+
# end
|
126
|
+
# debug "imagezip client finished"
|
127
|
+
|
128
|
+
# client.inform(:status, {
|
129
|
+
# status_type: 'IMAGEZIP',
|
130
|
+
# event: "EXIT",
|
131
|
+
# app: client.property.app_id,
|
132
|
+
# node: client.property.node_topic,
|
133
|
+
# msg: summary
|
134
|
+
# }, :ALL)
|
135
|
+
# host.close
|
136
|
+
# end
|
94
137
|
end
|
95
138
|
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.13
|
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-12-
|
12
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omf_common
|