capistrano3-consul 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/consul.rb +14 -4
- data/lib/capistrano/consul/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec4fea00b59c2d6725add8812d33b5b29590113de30754cea87e2cc2e8cd79e4
|
4
|
+
data.tar.gz: 409cfb7199c9e81cd88f1486f6938f2f488b5cbe27e24c2fd07d3242cf85ee37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 667513bf87e8b78a699d5bb04be0d49eb69e41b686f30d4e405f6dc50c0a707c6f872fa5d15cc256ca56c369f45811a4ff1acbea385812be89971dc3335466bf
|
7
|
+
data.tar.gz: 8488f45a37a04f2596ead0d43df62bdf309976eef7ad4443ddc2abbd69771b127dd3da8fe98b446a8a0d7a521fa273d708120ba84198e84e918ab80ceeb92e5f
|
data/lib/capistrano/consul.rb
CHANGED
@@ -6,9 +6,11 @@ module Capistrano
|
|
6
6
|
module Consul
|
7
7
|
def self.setup
|
8
8
|
return if @url
|
9
|
+
|
9
10
|
@url = fetch(:consul_url)
|
10
11
|
@token = fetch(:consul_token)
|
11
12
|
return false unless @url
|
13
|
+
|
12
14
|
@ssh_gateway = fetch(:consul_ssh_gateway)
|
13
15
|
if @ssh_gateway
|
14
16
|
@gateway = Net::SSH::Gateway.new(@ssh_gateway[:host], @ssh_gateway[:username] || @ssh_gateway[:user], @ssh_gateway[:options] || {})
|
@@ -28,16 +30,24 @@ module Capistrano
|
|
28
30
|
def consul_all_nodes(properties = {})
|
29
31
|
Consul.setup
|
30
32
|
Diplomat::Node.get_all.each_with_index do |node, index|
|
31
|
-
|
32
|
-
|
33
|
+
if block_given?
|
34
|
+
yield(node)
|
35
|
+
else
|
36
|
+
extra_properties = index.zero? ? { primary: true } : {}
|
37
|
+
server(node['Address'], properties.merge(extra_properties))
|
38
|
+
end
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
36
42
|
def consul_service(service_name, properties = {})
|
37
43
|
Consul.setup
|
38
44
|
Diplomat::Service.get(service_name, :all).each_with_index do |node, index|
|
39
|
-
|
40
|
-
|
45
|
+
if block_given?
|
46
|
+
yield(node)
|
47
|
+
else
|
48
|
+
extra_properties = index.zero? ? { primary: true } : {}
|
49
|
+
server(node['Address'], properties.merge(extra_properties))
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
43
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano3-consul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Fernandez (magec)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|