ey_stonith 0.1.5.pre2 → 0.1.5.pre3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ey_stonith/awsm_notifier.rb +5 -5
- data/lib/ey_stonith/commands/abstract.rb +8 -0
- data/lib/ey_stonith/commands/check.rb +1 -1
- data/lib/ey_stonith/commands/claim.rb +2 -0
- data/lib/ey_stonith/commands/cron.rb +2 -1
- data/lib/ey_stonith/commands/resume.rb +1 -0
- data/lib/ey_stonith/commands/stop.rb +2 -0
- data/lib/ey_stonith/commands/takeover.rb +2 -1
- data/lib/ey_stonith/commands.rb +1 -1
- metadata +3 -3
@@ -46,13 +46,13 @@ module EY
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# ripped from restclient so we can use eventmachine
|
49
|
-
def process_payload(
|
50
|
-
|
49
|
+
def process_payload(payload = nil, parent_key = nil)
|
50
|
+
payload.keys.map do |k|
|
51
51
|
key = parent_key ? "#{parent_key}[#{k}]" : k
|
52
|
-
if
|
53
|
-
process_payload(
|
52
|
+
if payload[k].is_a? Hash
|
53
|
+
process_payload(payload[k], key)
|
54
54
|
else
|
55
|
-
value = URI.escape(
|
55
|
+
value = URI.escape(payload[k].to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
56
56
|
"#{key}=#{value}"
|
57
57
|
end
|
58
58
|
end.join("&")
|
@@ -63,6 +63,14 @@ module EY
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
def script
|
67
|
+
@script ||= File.join(File.dirname($0), SCRIPT_NAME)
|
68
|
+
end
|
69
|
+
|
70
|
+
def execute(command, args = "")
|
71
|
+
exec "#{script}-#{command}#{command_options} #{args}"
|
72
|
+
end
|
73
|
+
|
66
74
|
def parse!
|
67
75
|
parser.parse!(@argv)
|
68
76
|
end
|
@@ -45,7 +45,7 @@ module EY
|
|
45
45
|
|
46
46
|
if check_recorder.limit_exceeded?
|
47
47
|
Stonith.logger.info "Invoking takeover of instance #{instance_id}"
|
48
|
-
|
48
|
+
execute :takeover, "--instance #{instance_id}"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -35,6 +35,7 @@ module EY
|
|
35
35
|
return unless master_hostname
|
36
36
|
|
37
37
|
if config.meta_data_hostname == master_hostname
|
38
|
+
history << :claim
|
38
39
|
abort "Already claimed, not claiming."
|
39
40
|
else
|
40
41
|
claim_path.delete
|
@@ -85,6 +86,7 @@ Failed attempts: #{attempts}
|
|
85
86
|
|
86
87
|
if config.meta_data_hostname == master_hostname
|
87
88
|
claim_path.open('w') {}
|
89
|
+
history << :claim
|
88
90
|
abort "Already claimed, not claiming. Touching claim file."
|
89
91
|
else
|
90
92
|
abort "#{master_hostname} is master, not claiming."
|
@@ -11,6 +11,7 @@ module EY
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def invoke
|
14
|
+
Stonith.logger.info "Stonith started"
|
14
15
|
heartbeat_loop do |beat|
|
15
16
|
unless_stopped { run_commands if beat.zero? }
|
16
17
|
sleep 1
|
@@ -31,7 +32,7 @@ module EY
|
|
31
32
|
|
32
33
|
def run_commands
|
33
34
|
%w[claim notify check].each do |cmd|
|
34
|
-
system("
|
35
|
+
system("#{script} #{cmd}#{command_options}")
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
data/lib/ey_stonith/commands.rb
CHANGED
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.1.5.
|
9
|
+
- pre3
|
10
|
+
version: 0.1.5.pre3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ezra Zygmuntowicz
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-04-
|
20
|
+
date: 2010-04-19 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|