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.
@@ -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
- Stonith.logger.info("Locked! Taking over.")
34
- @slave = nil
35
- @history << :takeover
36
- @local_master = LocalMaster.new(@config.notify_uri, @config.cloud_credentials)
37
- new_data = @local_master.takeover!(data.instance_id, data.ip)
38
- @master.update new_data
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!
@@ -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() 15 end
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ezra Zygmuntowicz