omf_rc 6.0.8.pre.2 → 6.0.8.pre.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ODI4YWUzNzdlZjFmM2VlNDc0MjU5ZjcxMWMzZGM5ZTBhNGU1OGU1MzRhZjVl
|
10
|
-
NDU3ZGRjZjM5MzQ1NjQzN2RiY2E3NjU0NzRmZGNjZjVkYjQ3ZTA3Y2FjMTdm
|
11
|
-
YTY0MjdjZjQ0ZTQzOGU2OTk1YzMzYTdjYTdhY2NjN2JmMWRmOGM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzdiYjNjMmUyMzdkYmQwMDIwODM3YmNjMDRiOTc0MTU1MWE2YzhjZDU3Nzgy
|
14
|
-
MGM2MDM2Mjk1YmQxYWZjMDQ0NGExMDlmZjRiYjU0MDVjMzI1OGFkOWM5NWJk
|
15
|
-
MzU5MTJkODU1NTQ1NGIwMGI5ZjBkY2EwNWU3MmUwNTk1MTE3ZmM=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5a92080ab8ac073244c065f60d87806a27fc685b
|
4
|
+
data.tar.gz: a8948f02267a30d879352a6dc03181137764d92e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f1dd69b9f12dfb89a45456da944ef20825f8e35eb2647fe368243fc9454d54149ee8aaa7d60ceb1ab59d8b371c78d3583a0535350cfd16c5980df87d08c6286
|
7
|
+
data.tar.gz: 458b124483db9d371d4850064058e2c95bbfbe42cd6c146ad36bec6e9808968cea0f072682d1b1327b35ee28a2fabe2b7e5ebfeb547b22060353195093404193
|
data/bin/omf_rc
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
4
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
5
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
6
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
7
|
+
|
8
|
+
puts "OMF Resource Controller - Copyright (c) 2012-13 National ICT Australia Limited (NICTA)"
|
3
9
|
abort "Please use Ruby 1.9.3 or higher" if RUBY_VERSION < "1.9.3"
|
4
10
|
|
5
11
|
# The following is to work around a bug in activesupport triggered by
|
@@ -2,12 +2,17 @@
|
|
2
2
|
# default topic name is this machine's hostname
|
3
3
|
# default xmpp user name/password is "hostname-pid"
|
4
4
|
# this is to ensure that every RC has its own topic and XMPP account
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
uid: <%= Socket.gethostname %>
|
6
|
+
uri: xmpp://<%= "#{Socket.gethostname}-#{Process.pid}" %>:<%= "#{Socket.gethostname}-#{Process.pid}" %>@localhost
|
7
|
+
environment: production
|
8
|
+
debug: false
|
9
|
+
|
10
|
+
credentials:
|
11
|
+
root_cert_dir: /path_to_folder_contains_root_certs
|
12
|
+
entity_cert: /path_to_cert_used_by_this_rc
|
13
|
+
entity_key: /path_to_private_key_used_by_this_rc
|
14
|
+
|
15
|
+
communication:
|
16
|
+
auth:
|
17
|
+
authenticate: true
|
9
18
|
|
10
|
-
:auth:
|
11
|
-
:root_cert_dir: /path_to_folder_contains_root_certs
|
12
|
-
:entity_cert: /path_to_cert_used_by_this_rc
|
13
|
-
:entity_key: /path_to_private_key_used_by_this_rc
|
@@ -106,6 +106,7 @@ class OmfRc::ResourceProxy::AbstractResource
|
|
106
106
|
@uid = (@opts.delete(:uid) || SecureRandom.uuid).to_s
|
107
107
|
@hrn = @opts.delete(:hrn)
|
108
108
|
@hrn = @hrn.to_s if @hrn
|
109
|
+
@node_index = nil
|
109
110
|
|
110
111
|
@children = []
|
111
112
|
@membership = []
|
@@ -118,7 +119,8 @@ class OmfRc::ResourceProxy::AbstractResource
|
|
118
119
|
|
119
120
|
if t.error?
|
120
121
|
warn "Could not create topic '#{uid}', will shutdown, trying to clean up old topics. Please start it again once it has been shutdown."
|
121
|
-
OmfCommon.comm.disconnect
|
122
|
+
OmfCommon.comm.disconnect
|
123
|
+
OmfCommon.eventloop.stop
|
122
124
|
else
|
123
125
|
begin
|
124
126
|
# Setup authentication related properties
|
@@ -341,18 +343,34 @@ class OmfRc::ResourceProxy::AbstractResource
|
|
341
343
|
|
342
344
|
# Make resource part of the group topic, it will overwrite existing membership array
|
343
345
|
#
|
344
|
-
# @param [String|Array] args name of group topic/topics
|
346
|
+
# @param [String|Array|Hash] args name of group topic/topics
|
347
|
+
#
|
348
|
+
# @example Explaining argument values
|
349
|
+
#
|
350
|
+
# # Join a single group
|
351
|
+
# "group_1"
|
352
|
+
#
|
353
|
+
# # Join multiple group
|
354
|
+
# ["group_1", "group_2"]
|
355
|
+
#
|
356
|
+
# # Leave a single group or multiple groups
|
357
|
+
# { leave: ["group_1", "group_2"] } or { leave: "group_1" }
|
345
358
|
def configure_membership(*args)
|
346
|
-
|
359
|
+
case args[0]
|
360
|
+
when Symbol, String, Array
|
361
|
+
new_membership = [args[0]].flatten.compact
|
362
|
+
when Hash
|
363
|
+
leave_membership = [args[0][:leave]].flatten.compact
|
364
|
+
end
|
347
365
|
|
348
|
-
new_membership.each do |new_m|
|
366
|
+
new_membership && new_membership.each do |new_m|
|
349
367
|
unless @membership.include?(new_m)
|
350
368
|
OmfCommon.comm.subscribe(new_m) do |t|
|
351
369
|
if t.error?
|
352
370
|
warn "Group #{new_m} disappeared"
|
353
|
-
|
354
|
-
|
355
|
-
|
371
|
+
self.synchronize do
|
372
|
+
@membership.delete(m)
|
373
|
+
end
|
356
374
|
else
|
357
375
|
self.synchronize do
|
358
376
|
@membership << new_m
|
@@ -367,9 +385,29 @@ class OmfRc::ResourceProxy::AbstractResource
|
|
367
385
|
end
|
368
386
|
end
|
369
387
|
end
|
388
|
+
|
389
|
+
leave_membership && leave_membership.each do |leave_m|
|
390
|
+
if (leave_m_topic = @membership_topics[leave_m])
|
391
|
+
self.synchronize do
|
392
|
+
leave_m_topic.unsubscribe(leave_m)
|
393
|
+
@membership.delete(leave_m)
|
394
|
+
@membership_topics.delete_if { |k, v| k == leave_m }
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
370
399
|
@membership
|
371
400
|
end
|
372
401
|
|
402
|
+
# Set the node index, overwriting any previous index
|
403
|
+
# The index is a unique integer for each node in an experiment
|
404
|
+
# It's used e.g. to give each node an IP address such as x.x.x.node_index
|
405
|
+
#
|
406
|
+
# @param [String|Array] args name of group topic/topics
|
407
|
+
def configure_node_index(index)
|
408
|
+
@node_index = index
|
409
|
+
end
|
410
|
+
|
373
411
|
# @!endgroup
|
374
412
|
|
375
413
|
# Parse omf message and execute as instructed by the message
|
data/lib/omf_rc/runner.rb
CHANGED
@@ -21,7 +21,7 @@ module OmfRc
|
|
21
21
|
class Runner
|
22
22
|
include Hashie
|
23
23
|
|
24
|
-
attr_accessor :gopts, :copts, :def_opts
|
24
|
+
attr_accessor :gopts, :copts, :def_opts, :node_index
|
25
25
|
attr_accessor :opts
|
26
26
|
|
27
27
|
def initialize()
|
@@ -66,6 +66,7 @@ module OmfRc
|
|
66
66
|
# TODO: Should release resources first
|
67
67
|
info "Stopping ..."
|
68
68
|
OmfCommon.comm.disconnect
|
69
|
+
OmfCommon.eventloop.stop
|
69
70
|
end
|
70
71
|
|
71
72
|
# Load extensions
|
@@ -84,7 +84,17 @@ describe AbstractResource do
|
|
84
84
|
|
85
85
|
it "must be able to configure membership (join group)" do
|
86
86
|
@parent.configure_membership(:test_group)
|
87
|
+
@parent.configure_membership([:test_group, 'test_group_2'])
|
87
88
|
@parent.request_membership.must_include :test_group
|
89
|
+
@parent.request_membership.must_include 'test_group_2'
|
90
|
+
end
|
91
|
+
|
92
|
+
it "must be able to configure membership (leave group)" do
|
93
|
+
@parent.configure_membership([:test_group, 'test_group_2'])
|
94
|
+
@parent.configure_membership({ leave: [:test_group] })
|
95
|
+
@parent.request_membership.must_equal ['test_group_2']
|
96
|
+
@parent.configure_membership({ leave: [:test_group, 'test_group_2'] })
|
97
|
+
@parent.request_membership.must_equal []
|
88
98
|
end
|
89
99
|
end
|
90
100
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_rc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.8.pre.
|
4
|
+
version: 6.0.8.pre.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NICTA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -42,28 +42,28 @@ dependencies:
|
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 6.0.8.pre.
|
75
|
+
version: 6.0.8.pre.3
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 6.0.8.pre.
|
82
|
+
version: 6.0.8.pre.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: cocaine
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,14 +98,14 @@ dependencies:
|
|
98
98
|
name: mocha
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Resource controller of OMF, a generic framework for controlling and managing
|
@@ -199,12 +199,12 @@ require_paths:
|
|
199
199
|
- lib
|
200
200
|
required_ruby_version: !ruby/object:Gem::Requirement
|
201
201
|
requirements:
|
202
|
-
- -
|
202
|
+
- - '>='
|
203
203
|
- !ruby/object:Gem::Version
|
204
204
|
version: 1.9.3
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
|
-
- -
|
207
|
+
- - '>'
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: 1.3.1
|
210
210
|
requirements: []
|