nitos_testbed_rc 1.0.0.pre.13 → 1.0.0.pre.14

Sign up to get free protection for your applications and to get access to all the features.
data/bin/omf6 CHANGED
@@ -67,6 +67,8 @@ def create_frisbeed(comm, fcontroller, port, options)
67
67
  puts "INFO: #{m.read_content("msg")}"
68
68
  elsif m.read_content("event") == "EXIT"
69
69
  puts "INFO: #{m.read_content("msg")}"
70
+ elsif m.read_content("event") == "ERROR"
71
+ puts "ERROR: #{m.read_content("msg")}"
70
72
  end
71
73
  end
72
74
  end
@@ -104,10 +106,10 @@ def create_frisbee(comm, fcontroller, node, port, options, progress_bar)
104
106
  progress_bar.write
105
107
  if client_msg.read_property("msg")
106
108
  msg = client_msg.read_property("msg").split("\n")
109
+ @load_end_msg += "#{client_msg.read_property("node")}: #{"#{msg[0]} #{msg[1][14..29]}"}\n"
107
110
  else
108
- puts "ERROR: Frisbee client exit with no msg."
111
+ puts "ERROR: Frisbee client stopped unexpectedly with no error message."
109
112
  end
110
- @load_end_msg += "#{client_msg.read_property("node")}: #{"#{msg[0]} #{msg[1][14..29]}"}\n"
111
113
  comm.subscribe('cm_factory') do |controller|
112
114
  controller.on_message do |cm_msg|
113
115
  if cm_msg.operation == :inform
@@ -799,7 +801,7 @@ def shut_down(comm)
799
801
  comm.disconnect
800
802
  end
801
803
 
802
- OmfCommon.init(@config[:operationMode], {communication: { url: "xmpp://#{@xmpp[:script_user]}:#{@xmpp[:password]}@#{@xmpp[:server]}", auth: {}}, logging: {}}) do
804
+ OmfCommon.init(@config[:operationMode], {communication: { url: "xmpp://#{@xmpp[:script_user]}:#{@xmpp[:password]}@#{@xmpp[:server]}", auth: {}}, logging: nil }) do
803
805
  OmfCommon.comm.on_connected do |comm|
804
806
  OmfCommon::Auth::CertificateStore.instance.register_default_certs(trusted_roots)
805
807
  entity.resource_id = OmfCommon.comm.local_topic.address
@@ -29,7 +29,7 @@
29
29
  :defaultImage: baseline.ndz
30
30
 
31
31
  # max bandwidth for frisbee server
32
- :bandwidth: 50000000
32
+ :bandwidth: 170000000
33
33
 
34
34
  # Multicast address to use for servicing images
35
35
  #mcAddress: 224.0.0.2
@@ -44,7 +44,7 @@
44
44
  :frisbeedBin: /usr/sbin/frisbeed
45
45
  :frisbeeBin: /usr/sbin/frisbee
46
46
  :imagezipClientBin: /usr/bin/imagezip
47
- :imagezipClientNC: /bin/nc
47
+ :imagezipClientNC: /bin/nc -q 0
48
48
  :imagezipServerBin: /bin/nc
49
49
 
50
50
  # Local interface to bind to for frisbee traffic
@@ -58,6 +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
+ debug "Executing command #{command} on host #{client.property.multicast_interface.to_s}"
61
62
 
62
63
  output = ''
63
64
  host = Net::Telnet.new("Host" => client.property.multicast_interface.to_s, "Timeout" => 200, "Prompt" => /[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/)
@@ -77,6 +78,13 @@ module OmfRc::ResourceProxy::Frisbee #frisbee client
77
78
  elsif c[0,6] == "\nWrote"
78
79
  c = c.split("\n")
79
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)
80
88
  end
81
89
  end
82
90
 
@@ -41,7 +41,11 @@ module OmfRc::ResourceProxy::Frisbeed
41
41
  server.property.image = server.property.image.start_with?('/') ? server.property.image : @fconf[:imageDir] + '/' + server.property.image
42
42
  unless File.file?(server.property.image)
43
43
  debug "File '#{server.property.image}' does not exist."
44
- raise "FILE NOT FOUND."
44
+ res.inform(:error, {
45
+ event_type: 'ERROR',
46
+ exit_code: -1,
47
+ msg: "File '#{server.property.image}' does not exist."
48
+ }, :ALL)
45
49
  end
46
50
  debug "Frisbee server is loading image: #{server.property.image}"
47
51
 
@@ -47,8 +47,8 @@ module OmfRc::ResourceProxy::ImagezipClient #Imagezip client
47
47
  client.property.multicast_interface = nod[:node_ip]
48
48
  client.property.app_id = client.hrn.nil? ? client.uid : client.hrn
49
49
 
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}"
50
+ command = "#{client.property.binary_path} -o -z1 #{client.property.hardrive} - | #{@fconf[:imagezipClientNC]} #{client.property.ip} #{client.property.port}"
51
+ debug "Executing command #{command} on host #{client.property.multicast_interface.to_s}"
52
52
  host = Net::Telnet.new("Host" => client.property.multicast_interface.to_s, "Timeout" => false, "Telnetmode" => true)
53
53
 
54
54
  output = ''
@@ -30,11 +30,22 @@ module OmfRc::ResourceProxy::User
30
30
  FileUtils.mkdir_p(path)
31
31
  end
32
32
 
33
- conf_file = File.read('/etc/nitos_testbed_rc/omf_script_conf.yaml')
34
- conf_file.sub!(' script_user', " #{res.property.username}")
35
- conf_file.sub!(' testserver', " #{res.topics.first.address.split('@').last}")
33
+ # conf_file = File.read('/etc/nitos_testbed_rc/omf_script_conf.yaml')
34
+ # conf_file.sub!(' script_user', " #{res.property.username}")
35
+ # conf_file.sub!(' testserver', " #{res.topics.first.address.split('@').last}")
36
+
37
+ # File.write("#{path}/omf_script_conf.yaml", conf_file)
38
+ require 'yaml'
39
+ opts = begin
40
+ YAML.load(File.open("/etc/nitos_testbed_rc/omf_script_conf.yaml"))
41
+ rescue ArgumentError => e
42
+ debug "Could not parse YAML: #{e.message}"
43
+ end
44
+
45
+ opts[:xmpp][:script_user] = res.property.username
46
+ opts[:xmpp][:server] = res.topics.first.address.split('@').last
36
47
 
37
- File.write("#{path}/omf_script_conf.yaml", conf_file)
48
+ File.open("#{path}/omf_script_conf.yaml", "w") {|f| f.write(opts.to_yaml) }
38
49
 
39
50
  cmd = "chown -R #{res.property.username}:#{res.property.username} /home/#{res.property.username}"
40
51
  system(cmd)
@@ -42,7 +53,7 @@ module OmfRc::ResourceProxy::User
42
53
 
43
54
  configure :auth_keys do |res, value|
44
55
  path = "/home/#{res.property.username}/.ssh"
45
- unless File.directory?(path)#create the directory if it doesn't exist (it will never exist)
56
+ unless File.directory?(path)#create the directory if it doesn't exist
46
57
  FileUtils.mkdir_p(path)
47
58
  end
48
59
  File.open("#{path}/authorized_keys", 'w') do |file|
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module NITOS
2
2
  module TestbedRc
3
- VERSION = "1.0.0.pre.13"
3
+ VERSION = "1.0.0.pre.14"
4
4
  end
5
5
  end
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.13
4
+ version: 1.0.0.pre.14
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-15 00:00:00.000000000 Z
12
+ date: 2015-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omf_common