right_agent 1.0.1 → 2.0.7
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.
- data/README.rdoc +10 -8
- data/Rakefile +31 -5
- data/lib/right_agent.rb +6 -1
- data/lib/right_agent/actor.rb +4 -20
- data/lib/right_agent/actors/agent_manager.rb +1 -1
- data/lib/right_agent/agent.rb +357 -144
- data/lib/right_agent/agent_config.rb +7 -6
- data/lib/right_agent/agent_identity.rb +13 -11
- data/lib/right_agent/agent_tag_manager.rb +60 -64
- data/{spec/results_mock.rb → lib/right_agent/clients.rb} +10 -24
- data/lib/right_agent/clients/api_client.rb +383 -0
- data/lib/right_agent/clients/auth_client.rb +247 -0
- data/lib/right_agent/clients/balanced_http_client.rb +369 -0
- data/lib/right_agent/clients/base_retry_client.rb +495 -0
- data/lib/right_agent/clients/right_http_client.rb +279 -0
- data/lib/right_agent/clients/router_client.rb +493 -0
- data/lib/right_agent/command/command_io.rb +4 -4
- data/lib/right_agent/command/command_parser.rb +2 -2
- data/lib/right_agent/command/command_runner.rb +1 -1
- data/lib/right_agent/connectivity_checker.rb +179 -0
- data/lib/right_agent/core_payload_types/secure_document_location.rb +2 -2
- data/lib/right_agent/dispatcher.rb +12 -10
- data/lib/right_agent/enrollment_result.rb +16 -12
- data/lib/right_agent/exceptions.rb +34 -20
- data/lib/right_agent/history.rb +10 -5
- data/lib/right_agent/log.rb +5 -5
- data/lib/right_agent/minimal.rb +1 -0
- data/lib/right_agent/multiplexer.rb +1 -1
- data/lib/right_agent/offline_handler.rb +270 -0
- data/lib/right_agent/packets.rb +7 -7
- data/lib/right_agent/payload_formatter.rb +1 -1
- data/lib/right_agent/pending_requests.rb +128 -0
- data/lib/right_agent/platform.rb +1 -1
- data/lib/right_agent/protocol_version_mixin.rb +69 -0
- data/lib/right_agent/{idempotent_request.rb → retryable_request.rb} +7 -7
- data/lib/right_agent/scripts/agent_controller.rb +28 -26
- data/lib/right_agent/scripts/agent_deployer.rb +37 -22
- data/lib/right_agent/scripts/common_parser.rb +10 -3
- data/lib/right_agent/secure_identity.rb +1 -1
- data/lib/right_agent/sender.rb +299 -785
- data/lib/right_agent/serialize/secure_serializer.rb +3 -1
- data/lib/right_agent/serialize/secure_serializer_initializer.rb +2 -2
- data/lib/right_agent/serialize/serializable.rb +8 -3
- data/right_agent.gemspec +49 -18
- data/spec/agent_config_spec.rb +7 -7
- data/spec/agent_identity_spec.rb +7 -4
- data/spec/agent_spec.rb +43 -7
- data/spec/agent_tag_manager_spec.rb +72 -83
- data/spec/clients/api_client_spec.rb +423 -0
- data/spec/clients/auth_client_spec.rb +272 -0
- data/spec/clients/balanced_http_client_spec.rb +576 -0
- data/spec/clients/base_retry_client_spec.rb +635 -0
- data/spec/clients/router_client_spec.rb +594 -0
- data/spec/clients/spec_helper.rb +111 -0
- data/spec/command/command_io_spec.rb +1 -1
- data/spec/command/command_parser_spec.rb +1 -1
- data/spec/connectivity_checker_spec.rb +83 -0
- data/spec/dispatcher_spec.rb +3 -2
- data/spec/enrollment_result_spec.rb +2 -2
- data/spec/history_spec.rb +51 -39
- data/spec/offline_handler_spec.rb +340 -0
- data/spec/pending_requests_spec.rb +136 -0
- data/spec/{idempotent_request_spec.rb → retryable_request_spec.rb} +73 -73
- data/spec/sender_spec.rb +835 -1052
- data/spec/serialize/secure_serializer_spec.rb +3 -2
- data/spec/spec_helper.rb +54 -1
- metadata +71 -12
@@ -74,8 +74,9 @@ describe RightScale::SecureSerializer do
|
|
74
74
|
lambda { RightScale::SecureSerializer.load(YAML.dump(data)) }.should raise_error(RightScale::Serializer::SerializationError)
|
75
75
|
end
|
76
76
|
|
77
|
-
# Test with protocol
|
78
|
-
[[:msgpack,
|
77
|
+
# Test with protocol versions on the boundary where msgpack was first supported
|
78
|
+
[[:msgpack, version_can_handle_msgpack_result, JSON],
|
79
|
+
[:json, version_cannot_handle_msgpack_result, MessagePack]].each do |type, version, other_class|
|
79
80
|
|
80
81
|
context "using #{type.inspect}" do
|
81
82
|
|
data/spec/spec_helper.rb
CHANGED
@@ -29,7 +29,6 @@ require 'eventmachine'
|
|
29
29
|
require 'fileutils'
|
30
30
|
|
31
31
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'right_agent'))
|
32
|
-
require File.expand_path(File.join(File.dirname(__FILE__), 'results_mock'))
|
33
32
|
|
34
33
|
RSpec.configure do |c|
|
35
34
|
c.mock_with(:flexmock)
|
@@ -75,3 +74,57 @@ module RightScale
|
|
75
74
|
end # Log
|
76
75
|
|
77
76
|
end
|
77
|
+
|
78
|
+
# Mock RestClient exceptions since cannot create directly without a
|
79
|
+
# RestClient::Response, but need RestClient interface for error reporting
|
80
|
+
class RestExceptionMock < RestClient::Exception
|
81
|
+
class Response
|
82
|
+
attr_reader :headers
|
83
|
+
|
84
|
+
def initialize(headers)
|
85
|
+
@headers = headers || {}
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
attr_accessor :message
|
90
|
+
attr_reader :http_code, :http_body, :response
|
91
|
+
|
92
|
+
def initialize(http_code, http_body = nil, response_headers = nil)
|
93
|
+
@message = "#{http_code} #{RestClient::STATUSES[http_code]}"
|
94
|
+
@http_code = http_code
|
95
|
+
@http_body = http_body
|
96
|
+
@response = Response.new(response_headers)
|
97
|
+
end
|
98
|
+
|
99
|
+
def inspect
|
100
|
+
"#{@message}: #{@http_body}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Functions for setting version per ProtocolVersionMixin
|
105
|
+
def version_cannot_put_version_in_packet; RightScale::Packet::DEFAULT_VERSION end
|
106
|
+
def version_can_put_version_in_packet; 12 end
|
107
|
+
|
108
|
+
def version_cannot_use_mapper_query_tags; 7 end
|
109
|
+
def version_can_use_mapper_query_tags; 8 end
|
110
|
+
|
111
|
+
def version_cannot_handle_request_retries; 8 end
|
112
|
+
def version_can_handle_request_retries; 9 end
|
113
|
+
|
114
|
+
def version_cannot_route_to_response_queue; 9 end
|
115
|
+
def version_can_route_to_response_queue; 10 end
|
116
|
+
|
117
|
+
def version_cannot_handle_non_nanite_ids; 9 end
|
118
|
+
def version_can_handle_non_nanite_ids; 10 end
|
119
|
+
|
120
|
+
def version_cannot_handle_multicast_result; 9 end
|
121
|
+
def version_can_handle_multicast_result; 10 end
|
122
|
+
|
123
|
+
def version_cannot_handle_msgpack_result; 11 end
|
124
|
+
def version_can_handle_msgpack_result; 12 end
|
125
|
+
|
126
|
+
def version_cannot_handle_non_delivery_result; 12 end
|
127
|
+
def version_can_handle_non_delivery_result; 13 end
|
128
|
+
|
129
|
+
def version_cannot_handle_http_result; 22 end
|
130
|
+
def version_can_handle_http_result; 23 end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: right_support
|
@@ -52,6 +52,38 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - '='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.7.0.alpha
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - '='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.7.0.alpha
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: faye-websocket
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - '='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.7.0
|
79
|
+
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - '='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.7.0
|
55
87
|
- !ruby/object:Gem::Dependency
|
56
88
|
name: eventmachine
|
57
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,17 +179,25 @@ dependencies:
|
|
147
179
|
description: ! 'RightAgent provides a foundation for running an agent on a server
|
148
180
|
to interface
|
149
181
|
|
150
|
-
in a secure fashion with other agents in the RightScale system
|
182
|
+
in a secure fashion with other agents in the RightScale system using RightNet,
|
183
|
+
|
184
|
+
which operates in either HTTP or AMQP mode. When using HTTP, RightAgent
|
185
|
+
|
186
|
+
makes requests to RightApi servers and receives requests using long-polling or
|
187
|
+
|
188
|
+
WebSockets via the RightNet router. To respond to requests it posts to the
|
189
|
+
|
190
|
+
HTTP router. When using AMQP, RightAgent uses RabbitMQ as the message bus and
|
151
191
|
|
152
|
-
|
192
|
+
the RightNet router as the routing node to make requests; to receives requests
|
153
193
|
|
154
|
-
|
194
|
+
routed to it by the RightNet router, it establishes a queue on startup. The
|
155
195
|
|
156
|
-
|
196
|
+
packets are structured to invoke services in the agent represented by actors
|
157
197
|
|
158
|
-
|
198
|
+
and methods. The RightAgent may respond to these requests with a result packet
|
159
199
|
|
160
|
-
|
200
|
+
that the router then routes to the originator.
|
161
201
|
|
162
202
|
'
|
163
203
|
email: lee@rightscale.com
|
@@ -178,6 +218,13 @@ files:
|
|
178
218
|
- lib/right_agent/agent_identity.rb
|
179
219
|
- lib/right_agent/agent_tag_manager.rb
|
180
220
|
- lib/right_agent/audit_formatter.rb
|
221
|
+
- lib/right_agent/clients.rb
|
222
|
+
- lib/right_agent/clients/api_client.rb
|
223
|
+
- lib/right_agent/clients/auth_client.rb
|
224
|
+
- lib/right_agent/clients/balanced_http_client.rb
|
225
|
+
- lib/right_agent/clients/base_retry_client.rb
|
226
|
+
- lib/right_agent/clients/right_http_client.rb
|
227
|
+
- lib/right_agent/clients/router_client.rb
|
181
228
|
- lib/right_agent/command.rb
|
182
229
|
- lib/right_agent/command/agent_manager_commands.rb
|
183
230
|
- lib/right_agent/command/command_client.rb
|
@@ -186,6 +233,7 @@ files:
|
|
186
233
|
- lib/right_agent/command/command_parser.rb
|
187
234
|
- lib/right_agent/command/command_runner.rb
|
188
235
|
- lib/right_agent/command/command_serializer.rb
|
236
|
+
- lib/right_agent/connectivity_checker.rb
|
189
237
|
- lib/right_agent/console.rb
|
190
238
|
- lib/right_agent/core_payload_types.rb
|
191
239
|
- lib/right_agent/core_payload_types/cookbook.rb
|
@@ -213,7 +261,6 @@ files:
|
|
213
261
|
- lib/right_agent/enrollment_result.rb
|
214
262
|
- lib/right_agent/exceptions.rb
|
215
263
|
- lib/right_agent/history.rb
|
216
|
-
- lib/right_agent/idempotent_request.rb
|
217
264
|
- lib/right_agent/log.rb
|
218
265
|
- lib/right_agent/minimal.rb
|
219
266
|
- lib/right_agent/monkey_patches.rb
|
@@ -230,9 +277,11 @@ files:
|
|
230
277
|
- lib/right_agent/monkey_patches/ruby_patch/windows_patch/time_patch.rb
|
231
278
|
- lib/right_agent/monkey_patches/ruby_patch/windows_patch/win32ole_patch.rb
|
232
279
|
- lib/right_agent/multiplexer.rb
|
280
|
+
- lib/right_agent/offline_handler.rb
|
233
281
|
- lib/right_agent/operation_result.rb
|
234
282
|
- lib/right_agent/packets.rb
|
235
283
|
- lib/right_agent/payload_formatter.rb
|
284
|
+
- lib/right_agent/pending_requests.rb
|
236
285
|
- lib/right_agent/pid_file.rb
|
237
286
|
- lib/right_agent/platform.rb
|
238
287
|
- lib/right_agent/platform/unix/darwin/platform.rb
|
@@ -241,6 +290,8 @@ files:
|
|
241
290
|
- lib/right_agent/platform/windows/mingw/platform.rb
|
242
291
|
- lib/right_agent/platform/windows/mswin/platform.rb
|
243
292
|
- lib/right_agent/platform/windows/platform.rb
|
293
|
+
- lib/right_agent/protocol_version_mixin.rb
|
294
|
+
- lib/right_agent/retryable_request.rb
|
244
295
|
- lib/right_agent/scripts/agent_controller.rb
|
245
296
|
- lib/right_agent/scripts/agent_deployer.rb
|
246
297
|
- lib/right_agent/scripts/common_parser.rb
|
@@ -273,11 +324,18 @@ files:
|
|
273
324
|
- spec/agent_identity_spec.rb
|
274
325
|
- spec/agent_spec.rb
|
275
326
|
- spec/agent_tag_manager_spec.rb
|
327
|
+
- spec/clients/api_client_spec.rb
|
328
|
+
- spec/clients/auth_client_spec.rb
|
329
|
+
- spec/clients/balanced_http_client_spec.rb
|
330
|
+
- spec/clients/base_retry_client_spec.rb
|
331
|
+
- spec/clients/router_client_spec.rb
|
332
|
+
- spec/clients/spec_helper.rb
|
276
333
|
- spec/command/agent_manager_commands_spec.rb
|
277
334
|
- spec/command/command_io_spec.rb
|
278
335
|
- spec/command/command_parser_spec.rb
|
279
336
|
- spec/command/command_runner_spec.rb
|
280
337
|
- spec/command/command_serializer_spec.rb
|
338
|
+
- spec/connectivity_checker_spec.rb
|
281
339
|
- spec/core_payload_types/dev_repositories_spec.rb
|
282
340
|
- spec/core_payload_types/dev_repository_spec.rb
|
283
341
|
- spec/core_payload_types/executable_bundle_spec.rb
|
@@ -290,12 +348,13 @@ files:
|
|
290
348
|
- spec/dispatcher_spec.rb
|
291
349
|
- spec/enrollment_result_spec.rb
|
292
350
|
- spec/history_spec.rb
|
293
|
-
- spec/idempotent_request_spec.rb
|
294
351
|
- spec/log_spec.rb
|
295
352
|
- spec/monkey_patches/eventmachine_spec.rb
|
296
353
|
- spec/multiplexer_spec.rb
|
354
|
+
- spec/offline_handler_spec.rb
|
297
355
|
- spec/operation_result_spec.rb
|
298
356
|
- spec/packets_spec.rb
|
357
|
+
- spec/pending_requests_spec.rb
|
299
358
|
- spec/platform/spec_helper.rb
|
300
359
|
- spec/platform/unix/darwin/platform_spec.rb
|
301
360
|
- spec/platform/unix/linux/platform_spec.rb
|
@@ -303,7 +362,7 @@ files:
|
|
303
362
|
- spec/platform/windows/mingw/platform_spec.rb
|
304
363
|
- spec/platform/windows/mswin/platform_spec.rb
|
305
364
|
- spec/platform/windows/spec_helper.rb
|
306
|
-
- spec/
|
365
|
+
- spec/retryable_request_spec.rb
|
307
366
|
- spec/secure_identity_spec.rb
|
308
367
|
- spec/security/cached_certificate_store_proxy_spec.rb
|
309
368
|
- spec/security/certificate_cache_spec.rb
|
@@ -346,7 +405,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
346
405
|
version: '0'
|
347
406
|
segments:
|
348
407
|
- 0
|
349
|
-
hash: -
|
408
|
+
hash: -1817530941733034469
|
350
409
|
requirements: []
|
351
410
|
rubyforge_project:
|
352
411
|
rubygems_version: 1.8.26
|