ey_stonith 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ey_stonith/box.rb +10 -6
- data/lib/ey_stonith/config.rb +1 -1
- metadata +2 -2
data/lib/ey_stonith/box.rb
CHANGED
@@ -30,12 +30,16 @@ module EY
|
|
30
30
|
def try_takeover(master_unchanged)
|
31
31
|
@master.with_locked_data do |data|
|
32
32
|
if master_unchanged.call(data.key)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
begin
|
34
|
+
Stonith.logger.info("Locked! Taking over.")
|
35
|
+
@slave = nil
|
36
|
+
@history << :takeover
|
37
|
+
@local_master = LocalMaster.new(@config.notify_uri, @config.cloud_credentials)
|
38
|
+
new_data = @local_master.takeover!(data.instance_id, data.ip)
|
39
|
+
@master.update new_data
|
40
|
+
ensure
|
41
|
+
@history << :done
|
42
|
+
end
|
39
43
|
else
|
40
44
|
Stonith.logger.info("Failed to grab lock, relenting.")
|
41
45
|
@slave.start!
|
data/lib/ey_stonith/config.rb
CHANGED
@@ -13,7 +13,7 @@ module EY
|
|
13
13
|
|
14
14
|
def monitor_heartbeat() 10 end
|
15
15
|
def redis_key() 'ey:stonith' end
|
16
|
-
def redis_db()
|
16
|
+
def redis_db() 14 end
|
17
17
|
def redis_host() redis[:host] end # support sometimes changes this, do not cache!
|
18
18
|
def redis_port() redis[:port] end
|
19
19
|
def master_hostname_from_dna() dna['master_app_server']['private_dns_name'] end
|