consul-ruby-client 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/consul/client/session.rb +20 -20
- data/lib/consul/client/version.rb +1 -1
- data/lib/consul/model/session.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjVlYmRjNDgxNTI3ZTkwM2U0NTI3ODA5YjljNjJjYTAyYmY2ZjY3Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDcxODgzMDkzNWQwM2EzZDRjZWIwOGVkMDc4NGIzMWFlMjgxOWQ1NA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTczMjJjMGNkMWU5YTQyMzlhYTE1OWQyMDM5ZmI4MDExYzBiOGQwNTg3NmYx
|
10
|
+
ZjRiYjMyYzgwOTg5ZDkxOGI2NTEwZmUzM2M2ODFmNjY1YjYxM2Y0ZjVhY2Nm
|
11
|
+
NjgxMmQzY2JmNDE1NGE0OGFiYmFhNDZmMjU0ZDI2ZDU3YmVhM2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjkzMjQxM2FkNDY4NjFjNjRhMmRiMDYzN2UzZTlkZWVhNTlhMDQ0ODEwMWJj
|
14
|
+
NzJhMGFhZDg1YWMyNGM2ZmUxYTRiZjZlOWQxNzUwYTgzZGExNDJmOGVlZTQw
|
15
|
+
NzlhODNhZmRlZTlkMmNhMGQ0ZWNiM2U5ZWIyNmVlYTYyNWJiOTM=
|
@@ -10,30 +10,30 @@ module Consul
|
|
10
10
|
# Public: Creates an instance of Consul::Model::Session with as many preset
|
11
11
|
# defaults as possible.
|
12
12
|
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
13
|
+
# Params -
|
14
|
+
# name - (Required) The name of the session.
|
15
|
+
# opts - (Optional) Options hash
|
16
|
+
# opts[:lock_delay] - Allowance window for leaders to Valid values between '0s' and '60s'
|
17
|
+
# opts[:node] - The name of the node, defaults to the node the agent is running on
|
18
|
+
# opts[:checks] - Health Checks to associate to this session
|
19
|
+
# opts[:behavior] - 'release' or 'destroy' Behaviour when session is invalidated.
|
20
|
+
# opts[:ttl] - When provided Must be between '10s' and '3600s'
|
19
21
|
#
|
20
22
|
# Returns: Consul::Model::Session instance.
|
21
|
-
def self.for_name(name,
|
22
|
-
lock_delay = '15s',
|
23
|
-
node = nil,
|
24
|
-
checks = ['serfHealth'],
|
25
|
-
behaviour = 'release',
|
26
|
-
ttl = nil)
|
23
|
+
def self.for_name(name, opts = {})
|
24
|
+
# lock_delay = '15s',
|
25
|
+
# node = nil,
|
26
|
+
# checks = ['serfHealth'],
|
27
|
+
# behaviour = 'release',
|
28
|
+
# ttl = nil)
|
27
29
|
raise ArgumentError.new "Illegal Name: #{name}" if name.nil?
|
30
|
+
opts = {} if opts.nil?
|
28
31
|
session = Consul::Model::Session.new(name: name)
|
29
|
-
session.lock_delay = lock_delay unless
|
30
|
-
session.node = node
|
31
|
-
checks = [] if
|
32
|
-
|
33
|
-
session.
|
34
|
-
behaviour = 'release' if behaviour.nil? or behaviour != 'release' or behaviour != 'destroy'
|
35
|
-
session.behaviour = behaviour
|
36
|
-
session.ttl = ttl unless ttl.nil?
|
32
|
+
session.lock_delay = opts[:lock_delay] unless opts.has_key?(:lock_delay)
|
33
|
+
session.node = opts[:node] unless opts.has_key?(:node)
|
34
|
+
session.checks = opts[:checks] if opts.has_key?(:checks)
|
35
|
+
session.behavior = opts[:behavior] if opts.has_key?(:behavior)
|
36
|
+
session.ttl = opts[:ttl] unless opts.has_key?(:ttl)
|
37
37
|
session
|
38
38
|
end
|
39
39
|
|
data/lib/consul/model/session.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hotan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|