scout 5.3.4 → 5.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,9 +1,14 @@
1
1
  == Master
2
2
 
3
+ == 5.3.5
4
+
5
+ * Moved proxy support to explicit command line flags --http_proxy and https_proxy
6
+ * fixed two unused variables that were causing warnings under 1.9.3
7
+
3
8
  == 5.3.4
4
9
 
5
10
  * Incorporating sleep interval into Server#time_to_checkin?
6
- * Added proxy support via http_proxy environment variable
11
+ * Added proxy support command line flags
7
12
 
8
13
  == 5.3.3
9
14
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby -wKU
2
2
 
3
3
  module Scout
4
- VERSION = "5.3.4".freeze
4
+ VERSION = "5.3.5".freeze
5
5
  end
6
6
 
7
7
  require "scout/command"
@@ -72,6 +72,16 @@ module Scout
72
72
  options[:server_name] = server_name
73
73
  end
74
74
 
75
+ opts.on("--http-proxy URL", String,
76
+ "Optional http proxy for non-SSL traffic." ) do |http_proxy|
77
+ options[:http_proxy] = http_proxy
78
+ end
79
+
80
+ opts.on("--https-proxy URL", String,
81
+ "Optional https proxy for SSL traffic." ) do |https_proxy|
82
+ options[:https_proxy] = https_proxy
83
+ end
84
+
75
85
  opts.separator " "
76
86
  opts.separator "Common Options:"
77
87
  opts.separator "--------------------------------------------------------------------------"
@@ -154,6 +164,8 @@ module Scout
154
164
  @level = options[:level] || "info"
155
165
  @force = options[:force] || false
156
166
  @server_name = options[:server_name]
167
+ @http_proxy = options[:http_proxy] || ""
168
+ @https_proxy = options[:https_proxy] || ""
157
169
 
158
170
  @args = args
159
171
 
@@ -22,7 +22,7 @@ module Scout
22
22
 
23
23
  puts "\nAttempting to contact the server..."
24
24
  begin
25
- Scout::Server.new(server, key, history, log) do |scout|
25
+ Scout::Server.new(server, key, history, log, @http_proxy, @https_proxy) do |scout|
26
26
  scout.fetch_plan
27
27
  scout.run_plugins_by_plan
28
28
  end
@@ -9,7 +9,7 @@ module Scout
9
9
  configuration_directory = config_dir
10
10
  log.debug("Configuration directory is #{configuration_directory} ") if log
11
11
  # TODO: too much external logic of command doing things TO server. This should be moved into the server class.
12
- @scout = Scout::Server.new(server, key, history, log, server_name)
12
+ @scout = Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy)
13
13
  @scout.load_history
14
14
 
15
15
  unless $stdin.tty?
@@ -11,7 +11,7 @@ module Scout
11
11
  VERIFY_MODE = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
12
12
 
13
13
  def run
14
- url, *provided_options = @args
14
+ url = @args.first
15
15
  # read the plugin_code from the file specified
16
16
  if url.nil? or url == ''
17
17
  puts "Please specify the path to the plugin (scout sign /path/to/plugin.rb)"
@@ -35,7 +35,13 @@ module Scout
35
35
 
36
36
  puts "Posting Signature..."
37
37
  uri = URI.parse(url)
38
- http = Net::HTTP.new(uri.host, uri.port)
38
+
39
+ # take care of http/https proxy, if specified in command line options
40
+ # Given a blank string, the proxy_uri URI instance's host/port/user/pass will be nil
41
+ # Net::HTTP::Proxy returns a regular Net::HTTP class if the first argument (host) is nil
42
+ proxy_uri = URI.parse(uri.is_a?(URI::HTTPS) ? @https_proxy : @http_proxy)
43
+ http=Net::HTTP::Proxy(proxy_uri.host,proxy_uri.port,proxy_uri.user,proxy_uri.port).new(uri.host, uri.port)
44
+
39
45
  if uri.is_a?(URI::HTTPS)
40
46
  http.use_ssl = true
41
47
  http.ca_file = CA_FILE
@@ -45,7 +45,7 @@ module Scout
45
45
  puts "== You haven't provided any options for running this plugin."
46
46
  end
47
47
 
48
- Scout::Server.new(nil, nil, history, log) do |scout|
48
+ Scout::Server.new(nil, nil, history, log, @http_proxy, @https_proxy) do |scout|
49
49
  scout.prepare_checkin
50
50
  scout.process_plugin( 'interval' => 0,
51
51
  'plugin_id' => 1,
@@ -41,13 +41,15 @@ module Scout
41
41
  attr_reader :plugin_config
42
42
 
43
43
  # Creates a new Scout Server connection.
44
- def initialize(server, client_key, history_file, logger = nil, server_name=nil)
44
+ def initialize(server, client_key, history_file, logger = nil, server_name=nil, http_proxy='', https_proxy='')
45
45
  @server = server
46
46
  @client_key = client_key
47
47
  @history_file = history_file
48
48
  @history = Hash.new
49
49
  @logger = logger
50
50
  @server_name = server_name
51
+ @http_proxy = http_proxy
52
+ @https_proxy = https_proxy
51
53
  @plugin_plan = []
52
54
  @plugins_with_signature_errors = []
53
55
  @directives = {} # take_snapshots, interval, sleep_interval
@@ -493,7 +495,7 @@ module Scout
493
495
  contents=File.read(@history_file)
494
496
  begin
495
497
  @history = YAML.load(contents)
496
- rescue => e
498
+ rescue
497
499
  backup_path=File.join(File.dirname(@history_file), "history.corrupt")
498
500
  info "Couldn't parse the history file. Deleting it and resetting to an empty history file. Keeping a backup at #{backup_path}"
499
501
  File.open(backup_path,"w"){|f|f.write contents}
@@ -569,13 +571,13 @@ module Scout
569
571
  def request(url, response_handler, error, &connector)
570
572
  response = nil
571
573
  Timeout.timeout(5 * 60, APITimeoutError) do
572
- if p=ENV['http_proxy']
573
- info("Using HTTP proxy from ENV['http_proxy']=#{p}")
574
- proxy = URI.parse(p)
575
- http = Net::HTTP.proxy(proxy.host,proxy.port).new(url.host, url.port)
576
- else
577
- http = Net::HTTP.new(url.host, url.port)
578
- end
574
+
575
+ # take care of http/https proxy, if specified in command line options
576
+ # Given a blank string, the proxy_uri URI instance's host/port/user/pass will be nil
577
+ # Net::HTTP::Proxy returns a regular Net::HTTP class if the first argument (host) is nil
578
+ proxy_uri = URI.parse(url.is_a?(URI::HTTPS) ? @https_proxy : @http_proxy)
579
+ http=Net::HTTP::Proxy(proxy_uri.host,proxy_uri.port,proxy_uri.user,proxy_uri.port).new(url.host, url.port)
580
+
579
581
  if url.is_a? URI::HTTPS
580
582
  http.use_ssl = true
581
583
  http.ca_file = File.join( File.dirname(__FILE__),
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease: false
6
- segments:
7
- - 5
8
- - 3
9
- - 4
10
- version: 5.3.4
4
+ version: 5.3.5
11
5
  platform: ruby
12
6
  authors:
13
7
  - Scout Monitoring
@@ -15,23 +9,19 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2011-12-02 00:00:00 -08:00
12
+ date: 2011-12-21 00:00:00 -08:00
19
13
  default_executable:
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: elif
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
23
  version: "0"
33
- type: :runtime
34
- version_requirements: *id001
24
+ version:
35
25
  description: |
36
26
  Scout makes monitoring and reporting on your web applications as flexible and simple as possible.
37
27
 
@@ -181,7 +171,6 @@ files:
181
171
  - vendor/json_pure/tools/server.rb
182
172
  - vendor/json_pure/VERSION
183
173
  - Rakefile
184
- - bin/scout
185
174
  - AUTHORS
186
175
  - COPYING
187
176
  - README
@@ -202,27 +191,21 @@ rdoc_options:
202
191
  require_paths:
203
192
  - lib
204
193
  required_ruby_version: !ruby/object:Gem::Requirement
205
- none: false
206
194
  requirements:
207
195
  - - ">="
208
196
  - !ruby/object:Gem::Version
209
- hash: 3
210
- segments:
211
- - 0
212
197
  version: "0"
198
+ version:
213
199
  required_rubygems_version: !ruby/object:Gem::Requirement
214
- none: false
215
200
  requirements:
216
201
  - - ">="
217
202
  - !ruby/object:Gem::Version
218
- hash: 3
219
- segments:
220
- - 0
221
203
  version: "0"
204
+ version:
222
205
  requirements: []
223
206
 
224
207
  rubyforge_project: scout
225
- rubygems_version: 1.3.7
208
+ rubygems_version: 1.3.5
226
209
  signing_key:
227
210
  specification_version: 3
228
211
  summary: Scout makes monitoring and reporting on your web applications as flexible and simple as possible.