right_agent 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/lib/right_agent.rb +1 -0
  3. data/lib/right_agent/actor.rb +0 -28
  4. data/lib/right_agent/actors/agent_manager.rb +20 -18
  5. data/lib/right_agent/agent.rb +69 -87
  6. data/lib/right_agent/agent_tag_manager.rb +1 -1
  7. data/lib/right_agent/clients/api_client.rb +0 -1
  8. data/lib/right_agent/clients/auth_client.rb +2 -6
  9. data/lib/right_agent/clients/balanced_http_client.rb +2 -2
  10. data/lib/right_agent/clients/base_retry_client.rb +12 -19
  11. data/lib/right_agent/clients/right_http_client.rb +1 -5
  12. data/lib/right_agent/clients/router_client.rb +8 -15
  13. data/lib/right_agent/command/command_parser.rb +3 -3
  14. data/lib/right_agent/command/command_runner.rb +1 -1
  15. data/lib/right_agent/connectivity_checker.rb +7 -11
  16. data/lib/right_agent/dispatcher.rb +7 -42
  17. data/lib/right_agent/enrollment_result.rb +2 -2
  18. data/lib/right_agent/error_tracker.rb +202 -0
  19. data/lib/right_agent/log.rb +0 -2
  20. data/lib/right_agent/packets.rb +1 -1
  21. data/lib/right_agent/pending_requests.rb +10 -4
  22. data/lib/right_agent/pid_file.rb +3 -3
  23. data/lib/right_agent/protocol_version_mixin.rb +3 -3
  24. data/lib/right_agent/scripts/agent_deployer.rb +13 -1
  25. data/lib/right_agent/sender.rb +14 -30
  26. data/lib/right_agent/serialize/secure_serializer.rb +4 -4
  27. data/right_agent.gemspec +2 -2
  28. data/spec/agent_spec.rb +5 -5
  29. data/spec/clients/auth_client_spec.rb +1 -1
  30. data/spec/clients/balanced_http_client_spec.rb +4 -2
  31. data/spec/clients/base_retry_client_spec.rb +5 -6
  32. data/spec/clients/router_client_spec.rb +1 -4
  33. data/spec/dispatcher_spec.rb +6 -55
  34. data/spec/error_tracker_spec.rb +293 -0
  35. data/spec/pending_requests_spec.rb +2 -2
  36. data/spec/sender_spec.rb +3 -3
  37. data/spec/spec_helper.rb +4 -2
  38. metadata +33 -66
@@ -120,7 +120,7 @@ describe RightScale::PendingRequests do
120
120
  flexmock(Time).should_receive(:now).and_return(now, now + 10, now + 10, now + 20, now + 20, now + 30)
121
121
  pending_requests = RightScale::PendingRequests.new
122
122
  add_requests(pending_requests, [@request, @push])
123
- pending_requests.youngest_age.should == 10
123
+ RightScale::PendingRequests.youngest_age(pending_requests).should == 10
124
124
  end
125
125
  end
126
126
 
@@ -130,7 +130,7 @@ describe RightScale::PendingRequests do
130
130
  flexmock(Time).should_receive(:now).and_return(now, now + 10, now + 10, now + 20, now + 20, now + 30)
131
131
  pending_requests = RightScale::PendingRequests.new
132
132
  add_requests(pending_requests, [@request, @push])
133
- pending_requests.oldest_age.should == 20
133
+ RightScale::PendingRequests.oldest_age(pending_requests).should == 20
134
134
  end
135
135
  end
136
136
  end
@@ -921,7 +921,7 @@ describe RightScale::Sender do
921
921
 
922
922
  context "when fails" do
923
923
  it "raises TemporarilyOffline if no connected brokers" do
924
- @log.should_receive(:error).with(/Failed to publish/, RightAMQP::HABrokerClient::NoConnectedBrokers).once
924
+ @log.should_receive(:error).with(/Failed to publish/, RightAMQP::HABrokerClient::NoConnectedBrokers, :no_trace).once
925
925
  @client.should_receive(:publish).and_raise(RightAMQP::HABrokerClient::NoConnectedBrokers).once
926
926
  lambda { @sender.send(:amqp_send_once, @packet) }.should raise_error(RightScale::Sender::TemporarilyOffline)
927
927
  end
@@ -947,7 +947,7 @@ describe RightScale::Sender do
947
947
  end
948
948
 
949
949
  it "does not rescue if publish fails" do
950
- @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers).once
950
+ @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers, :no_trace).once
951
951
  @client.should_receive(:publish).and_raise(RightAMQP::HABrokerClient::NoConnectedBrokers).once
952
952
  lambda { @sender.send(:amqp_send_retry, @packet, @token) }.should raise_error(RightScale::Sender::TemporarilyOffline)
953
953
  end
@@ -1040,7 +1040,7 @@ describe RightScale::Sender do
1040
1040
  @client.should_receive(:publish).and_return(@broker_ids).once.ordered
1041
1041
  @client.should_receive(:publish).and_raise(RightAMQP::HABrokerClient::NoConnectedBrokers).once.ordered
1042
1042
  flexmock(EM).should_receive(:add_timer).and_yield.once
1043
- @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers).once
1043
+ @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers, :no_trace).once
1044
1044
  @log.should_receive(:error).with(/Failed retry.*temporarily offline/).once
1045
1045
  @sender.send(:amqp_send, :send_request, @target, @packet, @received_at, &@callback).should be_true
1046
1046
  @sender.pending_requests[@token].should_not be_nil
@@ -40,6 +40,8 @@ $TESTING = true
40
40
  $VERBOSE = nil # Disable constant redefined warning
41
41
  TEST_SOCKET_PORT = 80000
42
42
 
43
+ RightScale::ErrorTracker.init(RightScale::Agent, "test_agent", :trace_level => RightScale::Agent::TRACE_LEVEL)
44
+
43
45
  module RightScale
44
46
 
45
47
  module SpecHelper
@@ -79,8 +81,8 @@ end
79
81
  def version_cannot_put_version_in_packet; RightScale::Packet::DEFAULT_VERSION end
80
82
  def version_can_put_version_in_packet; 12 end
81
83
 
82
- def version_cannot_use_mapper_query_tags; 7 end
83
- def version_can_use_mapper_query_tags; 8 end
84
+ def version_cannot_use_router_query_tags; 7 end
85
+ def version_can_use_router_query_tags; 8 end
84
86
 
85
87
  def version_cannot_handle_request_retries; 8 end
86
88
  def version_can_handle_request_retries; 9 end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
5
- prerelease:
4
+ version: 2.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Lee Kirchhoff
@@ -12,50 +11,45 @@ authors:
12
11
  autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2014-05-07 00:00:00.000000000 Z
14
+ date: 2014-05-27 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: right_support
19
18
  requirement: !ruby/object:Gem::Requirement
20
- none: false
21
19
  requirements:
22
- - - ! '>='
20
+ - - ">="
23
21
  - !ruby/object:Gem::Version
24
22
  version: 2.4.1
25
- - - <
23
+ - - "<"
26
24
  - !ruby/object:Gem::Version
27
25
  version: '3.0'
28
26
  type: :runtime
29
27
  prerelease: false
30
28
  version_requirements: !ruby/object:Gem::Requirement
31
- none: false
32
29
  requirements:
33
- - - ! '>='
30
+ - - ">="
34
31
  - !ruby/object:Gem::Version
35
32
  version: 2.4.1
36
- - - <
33
+ - - "<"
37
34
  - !ruby/object:Gem::Version
38
35
  version: '3.0'
39
36
  - !ruby/object:Gem::Dependency
40
37
  name: right_amqp
41
38
  requirement: !ruby/object:Gem::Requirement
42
- none: false
43
39
  requirements:
44
- - - ~>
40
+ - - "~>"
45
41
  - !ruby/object:Gem::Version
46
42
  version: '0.7'
47
43
  type: :runtime
48
44
  prerelease: false
49
45
  version_requirements: !ruby/object:Gem::Requirement
50
- none: false
51
46
  requirements:
52
- - - ~>
47
+ - - "~>"
53
48
  - !ruby/object:Gem::Version
54
49
  version: '0.7'
55
50
  - !ruby/object:Gem::Dependency
56
51
  name: rest-client
57
52
  requirement: !ruby/object:Gem::Requirement
58
- none: false
59
53
  requirements:
60
54
  - - '='
61
55
  - !ruby/object:Gem::Version
@@ -63,7 +57,6 @@ dependencies:
63
57
  type: :runtime
64
58
  prerelease: false
65
59
  version_requirements: !ruby/object:Gem::Requirement
66
- none: false
67
60
  requirements:
68
61
  - - '='
69
62
  - !ruby/object:Gem::Version
@@ -71,7 +64,6 @@ dependencies:
71
64
  - !ruby/object:Gem::Dependency
72
65
  name: faye-websocket
73
66
  requirement: !ruby/object:Gem::Requirement
74
- none: false
75
67
  requirements:
76
68
  - - '='
77
69
  - !ruby/object:Gem::Version
@@ -79,7 +71,6 @@ dependencies:
79
71
  type: :runtime
80
72
  prerelease: false
81
73
  version_requirements: !ruby/object:Gem::Requirement
82
- none: false
83
74
  requirements:
84
75
  - - '='
85
76
  - !ruby/object:Gem::Version
@@ -87,119 +78,97 @@ dependencies:
87
78
  - !ruby/object:Gem::Dependency
88
79
  name: eventmachine
89
80
  requirement: !ruby/object:Gem::Requirement
90
- none: false
91
81
  requirements:
92
- - - ! '>='
82
+ - - ">="
93
83
  - !ruby/object:Gem::Version
94
84
  version: 0.12.10
95
- - - <
85
+ - - "<"
96
86
  - !ruby/object:Gem::Version
97
87
  version: '2.0'
98
88
  type: :runtime
99
89
  prerelease: false
100
90
  version_requirements: !ruby/object:Gem::Requirement
101
- none: false
102
91
  requirements:
103
- - - ! '>='
92
+ - - ">="
104
93
  - !ruby/object:Gem::Version
105
94
  version: 0.12.10
106
- - - <
95
+ - - "<"
107
96
  - !ruby/object:Gem::Version
108
97
  version: '2.0'
109
98
  - !ruby/object:Gem::Dependency
110
99
  name: net-ssh
111
100
  requirement: !ruby/object:Gem::Requirement
112
- none: false
113
101
  requirements:
114
- - - ~>
102
+ - - "~>"
115
103
  - !ruby/object:Gem::Version
116
104
  version: '2.0'
117
105
  type: :runtime
118
106
  prerelease: false
119
107
  version_requirements: !ruby/object:Gem::Requirement
120
- none: false
121
108
  requirements:
122
- - - ~>
109
+ - - "~>"
123
110
  - !ruby/object:Gem::Version
124
111
  version: '2.0'
125
112
  - !ruby/object:Gem::Dependency
126
113
  name: ffi
127
114
  requirement: !ruby/object:Gem::Requirement
128
- none: false
129
115
  requirements:
130
- - - ! '>='
116
+ - - ">="
131
117
  - !ruby/object:Gem::Version
132
118
  version: '0'
133
119
  type: :runtime
134
120
  prerelease: false
135
121
  version_requirements: !ruby/object:Gem::Requirement
136
- none: false
137
122
  requirements:
138
- - - ! '>='
123
+ - - ">="
139
124
  - !ruby/object:Gem::Version
140
125
  version: '0'
141
126
  - !ruby/object:Gem::Dependency
142
127
  name: msgpack
143
128
  requirement: !ruby/object:Gem::Requirement
144
- none: false
145
129
  requirements:
146
- - - ! '>='
130
+ - - ">="
147
131
  - !ruby/object:Gem::Version
148
132
  version: 0.4.4
149
- - - <
133
+ - - "<"
150
134
  - !ruby/object:Gem::Version
151
135
  version: '0.6'
152
136
  type: :runtime
153
137
  prerelease: false
154
138
  version_requirements: !ruby/object:Gem::Requirement
155
- none: false
156
139
  requirements:
157
- - - ! '>='
140
+ - - ">="
158
141
  - !ruby/object:Gem::Version
159
142
  version: 0.4.4
160
- - - <
143
+ - - "<"
161
144
  - !ruby/object:Gem::Version
162
145
  version: '0.6'
163
146
  - !ruby/object:Gem::Dependency
164
147
  name: json
165
148
  requirement: !ruby/object:Gem::Requirement
166
- none: false
167
149
  requirements:
168
- - - ~>
150
+ - - "~>"
169
151
  - !ruby/object:Gem::Version
170
152
  version: '1.4'
171
153
  type: :runtime
172
154
  prerelease: false
173
155
  version_requirements: !ruby/object:Gem::Requirement
174
- none: false
175
156
  requirements:
176
- - - ~>
157
+ - - "~>"
177
158
  - !ruby/object:Gem::Version
178
159
  version: '1.4'
179
- description: ! 'RightAgent provides a foundation for running an agent on a server
180
- to interface
181
-
160
+ description: |
161
+ RightAgent provides a foundation for running an agent on a server to interface
182
162
  in a secure fashion with other agents in the RightScale system using RightNet,
183
-
184
163
  which operates in either HTTP or AMQP mode. When using HTTP, RightAgent
185
-
186
164
  makes requests to RightApi servers and receives requests using long-polling or
187
-
188
165
  WebSockets via the RightNet router. To respond to requests it posts to the
189
-
190
166
  HTTP router. When using AMQP, RightAgent uses RabbitMQ as the message bus and
191
-
192
167
  the RightNet router as the routing node to make requests; to receives requests
193
-
194
168
  routed to it by the RightNet router, it establishes a queue on startup. The
195
-
196
169
  packets are structured to invoke services in the agent represented by actors
197
-
198
170
  and methods. The RightAgent may respond to these requests with a result packet
199
-
200
171
  that the router then routes to the originator.
201
-
202
- '
203
172
  email: lee@rightscale.com
204
173
  executables: []
205
174
  extensions: []
@@ -261,6 +230,7 @@ files:
261
230
  - lib/right_agent/dispatched_cache.rb
262
231
  - lib/right_agent/dispatcher.rb
263
232
  - lib/right_agent/enrollment_result.rb
233
+ - lib/right_agent/error_tracker.rb
264
234
  - lib/right_agent/eventmachine_spawn.rb
265
235
  - lib/right_agent/exceptions.rb
266
236
  - lib/right_agent/history.rb
@@ -353,6 +323,7 @@ files:
353
323
  - spec/dispatched_cache_spec.rb
354
324
  - spec/dispatcher_spec.rb
355
325
  - spec/enrollment_result_spec.rb
326
+ - spec/error_tracker_spec.rb
356
327
  - spec/history_spec.rb
357
328
  - spec/http_exceptions_spec.rb
358
329
  - spec/log_spec.rb
@@ -390,33 +361,29 @@ files:
390
361
  - spec/tracer_spec.rb
391
362
  homepage: https://github.com/rightscale/right_agent
392
363
  licenses: []
364
+ metadata: {}
393
365
  post_install_message:
394
366
  rdoc_options:
395
- - --main
367
+ - "--main"
396
368
  - README.rdoc
397
- - --title
369
+ - "--title"
398
370
  - RightAgent
399
371
  require_paths:
400
372
  - lib
401
373
  required_ruby_version: !ruby/object:Gem::Requirement
402
- none: false
403
374
  requirements:
404
- - - ! '>='
375
+ - - ">="
405
376
  - !ruby/object:Gem::Version
406
377
  version: 1.8.7
407
378
  required_rubygems_version: !ruby/object:Gem::Requirement
408
- none: false
409
379
  requirements:
410
- - - ! '>='
380
+ - - ">="
411
381
  - !ruby/object:Gem::Version
412
382
  version: '0'
413
- segments:
414
- - 0
415
- hash: 354755465369324207
416
383
  requirements: []
417
384
  rubyforge_project:
418
- rubygems_version: 1.8.26
385
+ rubygems_version: 2.2.2
419
386
  signing_key:
420
- specification_version: 3
387
+ specification_version: 4
421
388
  summary: Agent for interfacing server with RightScale system
422
389
  test_files: []