rha 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +0 -0
- data/MIT-LICENSE +21 -0
- data/README +73 -0
- data/lib/rha/authkeys.rb +80 -0
- data/lib/rha/daemon.rb +227 -0
- data/lib/rha/ha_cf.rb +762 -0
- data/lib/rha/haresources.rb +63 -0
- data/lib/rha/version.rb +17 -0
- data/lib/rha.rb +9 -0
- data/setup.rb +1585 -0
- data/test/test_helper.rb +2 -0
- data/test/test_rha.rb +11 -0
- metadata +78 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
# = rha - A Heartbeat gem for Ruby
|
2
|
+
#
|
3
|
+
# Homepage:: http://github.com/jjuliano/rha
|
4
|
+
# Author:: Joel Bryan Juliano
|
5
|
+
# Copyright:: (cc) 2011 Joel Bryan Juliano
|
6
|
+
# License:: MIT
|
7
|
+
|
8
|
+
#
|
9
|
+
# class RhaResources.new( array, str, array)
|
10
|
+
#
|
11
|
+
|
12
|
+
#
|
13
|
+
# RhaResources is the built-in resource manager configuration for heartbeat.
|
14
|
+
#
|
15
|
+
class RhaResources
|
16
|
+
|
17
|
+
#
|
18
|
+
# The preferred_node is the node that this resource group would prefer to be run on.
|
19
|
+
# This usually takes the form of the hostname, or running 'uname -n'.
|
20
|
+
#
|
21
|
+
attr_accessor :preferred_node
|
22
|
+
|
23
|
+
#
|
24
|
+
# The resource_name is usually the IP address of the preferred_node cluster.
|
25
|
+
#
|
26
|
+
attr_accessor :resource_name
|
27
|
+
|
28
|
+
#
|
29
|
+
# The script_name is the services that will be started by heartbeat.
|
30
|
+
# It looks in the /etc/init.d for the matched services (ie. nginx, httpd, smb)
|
31
|
+
# Services/Daemons on this line are separated by a single space.
|
32
|
+
#
|
33
|
+
# Actions can be invoke via script_name::action (ie. httpd::restart )
|
34
|
+
#
|
35
|
+
attr_accessor :script_name
|
36
|
+
|
37
|
+
#
|
38
|
+
# Returns a new RhaConfig Object
|
39
|
+
#
|
40
|
+
def initialize()
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Compile the RhaConfig configuration
|
45
|
+
#
|
46
|
+
def config
|
47
|
+
haresources = option_string()
|
48
|
+
return haresources
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def option_string()
|
54
|
+
ostring = "#{@preferred_node} #{@resource_name} "
|
55
|
+
|
56
|
+
if @script_name
|
57
|
+
ostring += @script_name.to_s
|
58
|
+
end
|
59
|
+
|
60
|
+
return ostring
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
data/lib/rha/version.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# = rha - A Heartbeat gem for Ruby
|
2
|
+
#
|
3
|
+
# Homepage:: http://github.com/jjuliano/rha
|
4
|
+
# Author:: Joel Bryan Juliano
|
5
|
+
# Copyright:: (cc) 2011 Joel Bryan Juliano
|
6
|
+
# License:: MIT
|
7
|
+
|
8
|
+
module Rha #:nodoc:
|
9
|
+
module VERSION #:nodoc:
|
10
|
+
MAJOR = 0
|
11
|
+
MINOR = 1
|
12
|
+
TINY = 0
|
13
|
+
|
14
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
data/lib/rha.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# = rha - A Heartbeat gem for Ruby
|
2
|
+
#
|
3
|
+
# Homepage:: http://github.com/jjuliano/rha
|
4
|
+
# Author:: Joel Bryan Juliano
|
5
|
+
# Copyright:: (cc) 2011 Joel Bryan Juliano
|
6
|
+
# License:: MIT
|
7
|
+
|
8
|
+
Dir[File.join(File.dirname(__FILE__), 'rha/**/*.rb')].sort.each { |lib| require lib }
|
9
|
+
|