right_support 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -119,7 +119,7 @@ module RightSupport::DB
|
|
119
119
|
DEFAULT_TIMEOUT = 10
|
120
120
|
|
121
121
|
# Default maximum number of rows to retrieve in one chunk
|
122
|
-
DEFAULT_COUNT =
|
122
|
+
DEFAULT_COUNT = 100
|
123
123
|
|
124
124
|
# Wrappers for Cassandra client
|
125
125
|
class << self
|
@@ -223,7 +223,6 @@ module RightSupport::DB
|
|
223
223
|
do_op(:get, column_family, k, opt)
|
224
224
|
else
|
225
225
|
opt = opt.clone
|
226
|
-
opt[:start] ||= ""
|
227
226
|
opt[:count] = DEFAULT_COUNT
|
228
227
|
columns = Cassandra::OrderedHash.new
|
229
228
|
while true
|
@@ -31,7 +31,8 @@ module RightSupport::Net::Balancing
|
|
31
31
|
DEFAULT_YELLOW_STATES = 4
|
32
32
|
DEFAULT_RESET_TIME = 300
|
33
33
|
|
34
|
-
def initialize(endpoints, yellow_states=nil, reset_time=nil, on_health_change=nil)
|
34
|
+
def initialize(policy, endpoints, yellow_states=nil, reset_time=nil, on_health_change=nil)
|
35
|
+
@policy = policy
|
35
36
|
@endpoints = Hash.new
|
36
37
|
@yellow_states = yellow_states || DEFAULT_YELLOW_STATES
|
37
38
|
@reset_time = reset_time || DEFAULT_RESET_TIME
|
@@ -60,6 +61,7 @@ module RightSupport::Net::Balancing
|
|
60
61
|
def update_state(endpoint, change, t1)
|
61
62
|
@endpoints[endpoint][:timestamp] = t1
|
62
63
|
n_level = @endpoints[endpoint][:n_level] += change
|
64
|
+
logger.info("RequestBalancer: Health of endpoint '#{endpoint}' #{change < 0 ? 'improved' : 'worsened'} to '#{state_color(n_level)}'")
|
63
65
|
if @on_health_change &&
|
64
66
|
(n_level < @min_n_level ||
|
65
67
|
(n_level > @min_n_level && n_level == @endpoints.map { |(k, v)| v[:n_level] }.min))
|
@@ -88,6 +90,10 @@ module RightSupport::Net::Balancing
|
|
88
90
|
endpoints.each { |ep| @endpoints[ep] = {:n_level => @min_n_level, :timestamp => 0} }
|
89
91
|
end
|
90
92
|
|
93
|
+
# Return the logger that our surrounding policy uses
|
94
|
+
def logger
|
95
|
+
@policy.logger
|
96
|
+
end
|
91
97
|
end
|
92
98
|
# has several levels (@yellow_states) to determine the health of the endpoint. The
|
93
99
|
# balancer works by avoiding "red" endpoints and retrying them after awhile. Here is a
|
@@ -110,6 +116,7 @@ module RightSupport::Net::Balancing
|
|
110
116
|
# transitions from red to yellow, and so on.
|
111
117
|
|
112
118
|
class HealthCheck
|
119
|
+
include RightSupport::Log::Mixin
|
113
120
|
|
114
121
|
def initialize(options = {})
|
115
122
|
@options = options
|
@@ -122,7 +129,7 @@ module RightSupport::Net::Balancing
|
|
122
129
|
@health_check = @options.delete(:health_check)
|
123
130
|
@counter = rand(0xffff) % endpoints.size
|
124
131
|
@last_size = endpoints.size
|
125
|
-
@stack = EndpointsStack.new(endpoints, @options[:yellow_states], @options[:reset_time], @options[:on_health_change])
|
132
|
+
@stack = EndpointsStack.new(self, endpoints, @options[:yellow_states], @options[:reset_time], @options[:on_health_change])
|
126
133
|
end
|
127
134
|
end
|
128
135
|
|
@@ -65,6 +65,7 @@ module RightSupport::Validation
|
|
65
65
|
alg = pem_key?(key_material)
|
66
66
|
return false unless alg
|
67
67
|
key = alg.new(key_material, passphrase || 'dummy passphrase, should never work')
|
68
|
+
key.to_der #make sure it's valid in addition to being well formed
|
68
69
|
return key.private?
|
69
70
|
rescue ::OpenSSL::PKey::PKeyError, NotImplementedError
|
70
71
|
return false
|
@@ -82,6 +83,7 @@ module RightSupport::Validation
|
|
82
83
|
alg = pem_key?(key_material)
|
83
84
|
return false unless alg
|
84
85
|
key = alg.new(key_material)
|
86
|
+
key.to_der #make sure it's valid in addition to being well formed
|
85
87
|
return key.public?
|
86
88
|
rescue ::OpenSSL::PKey::PKeyError, NotImplementedError
|
87
89
|
return false
|
@@ -60,7 +60,8 @@ if_require_succeeds('net/ssh') do
|
|
60
60
|
# If the key is well-formed and valid, return true. Otherwise, return false.
|
61
61
|
def ssh_public_key?(key_material)
|
62
62
|
return false if key_material.nil? || key_material.empty?
|
63
|
-
::Net::SSH::KeyFactory.load_data_public_key(key_material)
|
63
|
+
key = ::Net::SSH::KeyFactory.load_data_public_key(key_material)
|
64
|
+
key.to_der #make sure it's valid in addition to being well formed
|
64
65
|
return true
|
65
66
|
rescue ::Net::SSH::Exception, ::OpenSSL::PKey::PKeyError, NotImplementedError
|
66
67
|
return false
|
data/right_support.gemspec
CHANGED
@@ -7,8 +7,8 @@ spec = Gem::Specification.new do |s|
|
|
7
7
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
|
8
8
|
|
9
9
|
s.name = 'right_support'
|
10
|
-
s.version = '1.3.
|
11
|
-
s.date = '2012-03-
|
10
|
+
s.version = '1.3.1'
|
11
|
+
s.date = '2012-03-14'
|
12
12
|
|
13
13
|
s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff']
|
14
14
|
s.email = 'support@rightscale.com'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 1
|
10
|
+
version: 1.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tony Spataro
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2012-03-
|
21
|
+
date: 2012-03-14 00:00:00 -07:00
|
22
22
|
default_executable:
|
23
23
|
dependencies: []
|
24
24
|
|