cirrocumulus 0.6.3 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -22
- data/lib/cirrocumulus.rb +8 -2
- data/lib/cirrocumulus/{message.rb → agents/message.rb} +0 -0
- data/lib/cirrocumulus/channels.rb +129 -0
- data/lib/cirrocumulus/channels/jabber.rb +168 -0
- data/lib/cirrocumulus/environment.rb +46 -0
- data/lib/cirrocumulus/facts.rb +135 -0
- data/lib/cirrocumulus/identifier.rb +84 -0
- data/lib/cirrocumulus/ontology.rb +333 -49
- data/lib/cirrocumulus/pattern_matching.rb +175 -0
- data/lib/cirrocumulus/remote_console.rb +29 -0
- data/lib/cirrocumulus/rule_queue.rb +69 -0
- data/lib/cirrocumulus/rules/engine.rb +7 -5
- data/lib/cirrocumulus/rules/fact.rb +22 -0
- data/lib/cirrocumulus/rules/pattern_matcher.rb +19 -0
- data/lib/cirrocumulus/rules/run_queue.rb +1 -0
- data/lib/cirrocumulus/saga.rb +44 -25
- data/lib/console.rb +96 -0
- metadata +79 -72
- data/.document +0 -5
- data/.idea/.name +0 -1
- data/.idea/.rakeTasks +0 -7
- data/.idea/cirrocumulus.iml +0 -87
- data/.idea/encodings.xml +0 -5
- data/.idea/misc.xml +0 -5
- data/.idea/modules.xml +0 -9
- data/.idea/scopes/scope_settings.xml +0 -5
- data/.idea/vcs.xml +0 -7
- data/.idea/workspace.xml +0 -614
- data/Gemfile +0 -18
- data/Gemfile.lock +0 -43
- data/Rakefile +0 -37
- data/VERSION +0 -1
- data/cirrocumulus.gemspec +0 -106
- data/lib/.gitignore +0 -5
- data/lib/cirrocumulus/agent_wrapper.rb +0 -67
- data/lib/cirrocumulus/jabber_bus.rb +0 -140
- data/lib/cirrocumulus/rule_engine.rb +0 -2
- data/lib/cirrocumulus/rule_server.rb +0 -49
- data/test/Gemfile +0 -3
- data/test/Gemfile.lock +0 -27
- data/test/helper.rb +0 -18
- data/test/test.rb +0 -85
- data/test/test2.rb +0 -30
- data/test/test_cirrocumulus.rb +0 -7
data/test/Gemfile
DELETED
data/test/Gemfile.lock
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (2.3.14)
|
5
|
-
cirrocumulus (0.6.1)
|
6
|
-
activesupport (~> 2.3.11)
|
7
|
-
deil_sexpistol
|
8
|
-
eventmachine
|
9
|
-
guid
|
10
|
-
log4r (~> 1.1.9)
|
11
|
-
systemu
|
12
|
-
xmpp4r (~> 0.5)
|
13
|
-
xmpp4r-simple
|
14
|
-
deil_sexpistol (0.0.8)
|
15
|
-
eventmachine (0.12.10)
|
16
|
-
guid (0.1.1)
|
17
|
-
log4r (1.1.10)
|
18
|
-
systemu (2.4.2)
|
19
|
-
xmpp4r (0.5)
|
20
|
-
xmpp4r-simple (0.8.8)
|
21
|
-
xmpp4r (>= 0.3.2)
|
22
|
-
|
23
|
-
PLATFORMS
|
24
|
-
ruby
|
25
|
-
|
26
|
-
DEPENDENCIES
|
27
|
-
cirrocumulus
|
data/test/helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
require 'shoulda'
|
12
|
-
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
-
require 'cirrocumulus'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|
data/test/test.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
require 'active_support'
|
3
|
-
require 'cirrocumulus/rule_engine'
|
4
|
-
|
5
|
-
class Test < RuleEngine::Base
|
6
|
-
rule 'convert', [[:temperature, :X, 'F']] do |engine, params|
|
7
|
-
puts "qqq"
|
8
|
-
x = params[:X].to_i
|
9
|
-
engine.retract([:temperature, x, 'F'])
|
10
|
-
y = 5*(x - 32)/9
|
11
|
-
engine.assert([:temperature, y, 'C'])
|
12
|
-
end
|
13
|
-
|
14
|
-
rule 'test', [ [:a, :B, :c], [:c, :B, :a]], :for => 5.seconds do |engine, params|
|
15
|
-
p "test"
|
16
|
-
p params
|
17
|
-
end
|
18
|
-
=begin
|
19
|
-
rule 'guest_powered_off', [[:guest, :X, :powered_off]], :for => 5.seconds do |engine, params|
|
20
|
-
puts "guest_powered_off"
|
21
|
-
end
|
22
|
-
|
23
|
-
rule 'monitor_md', [[:virtual_disk, :X, :active], [:mdraid, :X, :failed]] do |engine, params|
|
24
|
-
# md devices is failed, but virtual disk should be up
|
25
|
-
p params
|
26
|
-
puts "virtual disk #{params[:X]} should be up, but corresponding md devices is failed!"
|
27
|
-
end
|
28
|
-
=end
|
29
|
-
end
|
30
|
-
|
31
|
-
#RuleEngine::Server.run()
|
32
|
-
|
33
|
-
e = Test.new
|
34
|
-
|
35
|
-
#e.assert [:i, :will, :expire, :soon], :expires => 10.seconds
|
36
|
-
#e.replace [:guest, :X, :powered_off], "q1w2", :expires => 2.seconds
|
37
|
-
e.assert [:a, 'b', :c]
|
38
|
-
e.assert [:a, 'haha', :c], :expires => 3.seconds
|
39
|
-
e.assert [:c, 'b', :a], :expires => 6.seconds
|
40
|
-
|
41
|
-
e.start()
|
42
|
-
|
43
|
-
while true
|
44
|
-
sleep 1
|
45
|
-
end
|
46
|
-
|
47
|
-
exit 0
|
48
|
-
|
49
|
-
e.assert [:guest, "233bed174ab0802fd908f981d64d185b", :powered_off]
|
50
|
-
e.assert [:guest, "233bed174ab0802fd908f981d64d185b", :running]
|
51
|
-
e.assert [:guest, "233bed174ab0802fd908f981d64d185b", :state, :powered_on]
|
52
|
-
e.replace [:guest, "233bed174ab0802fd908f981d64d185b", :state, :STATE], :powered_off
|
53
|
-
|
54
|
-
p e.match [:guest, "233bed174ab0802fd908f981d64d185b", :running]
|
55
|
-
#while true do
|
56
|
-
e.tick()
|
57
|
-
# sleep 1
|
58
|
-
#end
|
59
|
-
|
60
|
-
gets
|
61
|
-
e.dump_kb()
|
62
|
-
exit(0)
|
63
|
-
|
64
|
-
e.assert [:virtual_disk, 163, :active]
|
65
|
-
#e.assert [:virtual_disk, 139, :active]
|
66
|
-
#e.assert [:virtual_disk, 145, :active]
|
67
|
-
#e.assert [:virtual_disk, 146, :active]
|
68
|
-
#e.assert [:virtual_disk, 149, :active]
|
69
|
-
e.assert [:virtual_disk, 153, :active]
|
70
|
-
#e.assert [:virtual_disk, 154, :active]
|
71
|
-
#e.assert [:virtual_disk, 156, :active]
|
72
|
-
e.assert [:virtual_disk, 158, :active]
|
73
|
-
#e.assert [:virtual_disk, 137, :active]
|
74
|
-
#e.assert [:virtual_disk, 135, :active]
|
75
|
-
#e.assert [:virtual_disk, 159, :active]
|
76
|
-
#e.assert [:virtual_disk, 103, :active]
|
77
|
-
#e.assert [:virtual_disk, 102, :active]
|
78
|
-
#e.assert [:virtual_disk, 20, :active]
|
79
|
-
#e.assert [:virtual_disk, 2, :active]
|
80
|
-
#e.assert [:virtual_disk, 777, :active]
|
81
|
-
#e.assert [:virtual_disk, 90, :active]
|
82
|
-
e.assert [:mdraid, 153, :failed], true
|
83
|
-
e.assert [:mdraid, 158, :failed], true
|
84
|
-
e.execute()
|
85
|
-
gets
|
data/test/test2.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'sexpistol'
|
3
|
-
|
4
|
-
def map_sub(arr)
|
5
|
-
return [] if arr.nil?
|
6
|
-
return arr if !arr.is_a?(Array)
|
7
|
-
return [] if arr.size == 0
|
8
|
-
return {arr[0] => []} if arr.size == 1
|
9
|
-
return {arr[0] => map_sub(arr[1])} if arr.size == 2
|
10
|
-
|
11
|
-
res = {arr[0] => []}
|
12
|
-
|
13
|
-
arr.each_with_index do |item,i|
|
14
|
-
next if i == 0
|
15
|
-
res[arr[0]] << map_sub(item)
|
16
|
-
end
|
17
|
-
|
18
|
-
res
|
19
|
-
end
|
20
|
-
|
21
|
-
def map(arr)
|
22
|
-
return map_sub(arr[0]) if arr.size == 1
|
23
|
-
return map_sub(arr)
|
24
|
-
end
|
25
|
-
|
26
|
-
s = Sexpistol.new
|
27
|
-
e = s.parse_string "(create (vds (ram 256) (eth \"1\" \"2\")))"
|
28
|
-
|
29
|
-
p e
|
30
|
-
p map(e)
|
data/test/test_cirrocumulus.rb
DELETED