capistrano-consul_kv_lock 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1faefc322b8e5b7f0b50d750d6b8e891e23fd776
4
- data.tar.gz: b2702796331c0bafe1fb3703dee0479abeb2ff48
3
+ metadata.gz: 054025d77f91b796cce6adc6a0e0c142da62d75b
4
+ data.tar.gz: 838748f9450e7bfc29dc251b1e2d28620c9d37fb
5
5
  SHA512:
6
- metadata.gz: 5ddd65c39dec7d0b59eb9b6385348fde4a6bd044e4009cc7dae7955e628d5b3d9c76e8bcffb0f6a5c7d274480d38d4f42c645ce8316794da493af529a595ba62
7
- data.tar.gz: 27744fca1979c3c2a393f0e3f6b30e899bd6b99622784ae99a8a6dda3702008c38dd3543fcd6effe134be0849a3cfaeecf73b396283da0975cdfd6217b314a0f
6
+ metadata.gz: 915ac3ee71d21d003800496b0d2d2723889a8f9f542d792dcf5bc4a90d9d8c07c421d301079028b7122dc5d671a5202920f618c650dc4f56944ca830001232ed
7
+ data.tar.gz: 4cd3ca73cf866b8f0d1272611a4a05085135a56b8f643162db4bfc90554c857b66708fb6bb2928bcfe6fd3e1dce6263df2410f7511098a01462bde68a28b45b4
@@ -16,24 +16,33 @@ module Capistrano
16
16
 
17
17
  class Latch
18
18
  def self.set_instance(consul_url, options={})
19
- @_instance ||= p(new(consul_url, options))
19
+ @_instance ||= new(consul_url, options)
20
+ logger.debug "Registered latch instance: #{@_instance.inspect}"
21
+ @_instance
20
22
  end
21
23
 
22
24
  def self.instance
23
25
  @_instance
24
26
  end
25
27
 
28
+ def self.logger
29
+ @_logger ||= SSHKittyLogger.new
30
+ end
31
+
26
32
  def initialize(consul_url, options={})
27
- @logger = SSHKittyLogger.new
28
33
  @client = begin
29
34
  consul = URI.parse(consul_url)
30
- Consul::Client.v1.http(host: consul.host, port: consul.port, logger: @logger)
35
+ Consul::Client.v1.http(host: consul.host, port: consul.port, logger: logger)
31
36
  end
32
37
  @lock_key = options[:consul_lock_key] || 'deployment/locked'
33
38
  @session_id = nil
34
39
  end
35
40
  attr_reader :client, :lock_key
36
41
 
42
+ def logger
43
+ self.class.logger
44
+ end
45
+
37
46
  def session_request
38
47
  {
39
48
  "LockDelay" => 15,
@@ -54,7 +63,7 @@ module Capistrano
54
63
  end
55
64
 
56
65
  def create_session
57
- @logger.debug "Session request: #{session_request.inspect}"
66
+ logger.debug "Session request: #{session_request.inspect}"
58
67
  r = client.put("/session/create", session_request)
59
68
  @session_id = r['ID']
60
69
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module ConsulKvLock
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-consul_kv_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uchio KONDO