omf_ec 6.0.0 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/omf_ec CHANGED
@@ -106,7 +106,7 @@ command :load do |c|
106
106
  c.flag [:outprefix]
107
107
 
108
108
  c.action do |global_options, options, args|
109
- @cmd = "omf-5.4 load -t #{options[:t]} -i #{options[:i]} "
109
+ @cmd = "USER=#{ENV['USER']} omf-5.4 load -t #{options[:t]} -i #{options[:i]} "
110
110
  @cmd += "-o #{options[:o]} --outpath #{options[:outpath]} "
111
111
  @cmd += "-r #{options[:r]} " if options[:r]
112
112
  @cmd += "--outprefix #{options[:outprefix]} " if options[:outprefix]
@@ -130,7 +130,7 @@ command :save do |c|
130
130
  c.flag [:r, :resize]
131
131
 
132
132
  c.action do |global_options, options, args|
133
- @cmd = "omf-5.4 save "
133
+ @cmd = "USER=#{ENV['USER']} omf-5.4 save "
134
134
  @cmd += "-n #{options[:n]} " if options[:n]
135
135
  @cmd += "-r #{options[:r]} " if options[:r]
136
136
  load_exp(@testbed_exp_path, global_options, options)
@@ -1,47 +1,43 @@
1
- comm = OmfCommon.comm
1
+ def create_app(testbed)
2
+ testbed.create(:application) do |reply|
3
+ if reply.success?
4
+ app = reply.resource
2
5
 
3
- testbed_topic = comm.get_topic('testbed')
6
+ app.on_subscribed do
7
+ app.request([:platform])
4
8
 
5
- msgs = {
6
- create: comm.create_message([type: 'application']),
7
- req_platform: comm.request_message([:platform]),
8
- conf_path: comm.configure_message([binary_path: @cmd]),
9
- run_application: comm.configure_message([state: :running])
10
- }
9
+ after(1) { app.configure(binary_path: @cmd) }
10
+ after(2) { app.configure(state: :running) }
11
11
 
12
- msgs[:create].on_inform_creation_ok do |message|
13
- app_topic = comm.get_topic(message.res_id)
14
- app_topic.subscribe do
15
- msgs[:req_platform].publish app_topic.id
16
- sleep 1
17
- msgs[:conf_path].publish app_topic.id
18
- sleep 1
19
- msgs[:run_application].publish app_topic.id
20
- end
12
+ app.on_status do |m|
13
+ if m[:status_type] == 'APP_EVENT'
14
+ after(2) { OmfCommon.comm.disconnect } if m[:event] =~ /DONE.(OK|ERROR)/
15
+ info m[:msg]
16
+ else
17
+ m.each_property do |k, v|
18
+ info "#{k} => #{v.strip}" unless v.nil?
19
+ end
20
+ end
21
+ end
22
+
23
+ app.on_warn do |m|
24
+ warn m[:reason]
25
+ end
21
26
 
22
- app_topic.on_message do |m|
23
- if m.operation == :inform
24
- case m.read_content("itype")
25
- when 'STATUS'
26
- if m.read_property("status_type") == 'APP_EVENT'
27
- after (2) { comm.disconnect } if m.read_property("event") =~ /DONE.(OK|ERROR)/
28
- puts m.read_property("msg")
27
+ app.on_error do |m|
28
+ error m[:reason]
29
29
  end
30
- when 'ERROR'
31
- logger.error m.read_content('reason') if m.read_content("itype") == 'ERROR'
32
- when 'WARN'
33
- logger.warn m.read_content('reason') if m.read_content("itype") == 'WARN'
34
30
  end
31
+ else
32
+ error reply[:reason]
35
33
  end
36
34
  end
37
35
  end
38
36
 
39
- msgs[:req_platform].on_inform_status do |m|
40
- m.each_property do |p|
41
- logger.info "#{p.attr('key')} => #{p.content.strip}"
37
+ OmfCommon.comm.subscribe('testbed') do |testbed|
38
+ unless testbed.error?
39
+ create_app(testbed)
40
+ else
41
+ error testbed.inspect
42
42
  end
43
43
  end
44
-
45
- testbed_topic.subscribe do
46
- msgs[:create].publish testbed_topic.id
47
- end
@@ -1,3 +1,3 @@
1
1
  module OmfEc
2
- VERSION = "6.0.0"
2
+ VERSION = "6.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_ec
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
5
5
  prerelease:
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: 2013-03-18 00:00:00.000000000 Z
12
+ date: 2013-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest