scout 5.7.2.pre → 5.7.2.pre.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  * updated pusher gem and associated vendored gems
4
4
  * added support for realtime when using an http proxy
5
+ * added support for proxies during full signing process and troubleshoot
5
6
 
6
7
  # 5.7.1
7
8
 
@@ -6,9 +6,6 @@ module Scout
6
6
  class Command
7
7
  class Sign < Command
8
8
  HELP_URL = "https://scoutapp.com/info/creating_a_plugin#private_plugins"
9
- CA_FILE = File.join( File.dirname(__FILE__),
10
- *%w[.. .. .. data cacert.pem] )
11
- VERIFY_MODE = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
12
9
 
13
10
  def run
14
11
  url = @args.first
@@ -34,19 +31,10 @@ module Scout
34
31
  sig=Base64.encode64(code_signature)
35
32
 
36
33
  puts "Posting Signature..."
37
- uri = URI.parse(url)
38
34
 
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)
35
+ uri = URI.parse(url)
36
+ http = build_http(uri)
44
37
 
45
- if uri.is_a?(URI::HTTPS)
46
- http.use_ssl = true
47
- http.ca_file = CA_FILE
48
- http.verify_mode = VERIFY_MODE
49
- end
50
38
  request = Net::HTTP::Post.new(uri.request_uri)
51
39
  request.set_form_data({'signature' => sig})
52
40
  res = http.request(request)
@@ -65,13 +53,10 @@ module Scout
65
53
 
66
54
  def fetch_code(url)
67
55
  puts "Fetching code..."
56
+
68
57
  uri = URI.parse(url)
69
- http = Net::HTTP.new(uri.host, uri.port)
70
- if uri.is_a?(URI::HTTPS)
71
- http.use_ssl = true
72
- http.ca_file = CA_FILE
73
- http.verify_mode = VERIFY_MODE
74
- end
58
+ http = build_http(uri)
59
+
75
60
  request = Net::HTTP::Get.new(uri.request_uri)
76
61
  res = http.request(request)
77
62
  if !res.is_a?(Net::HTTPOK)
@@ -101,17 +101,11 @@ module Scout
101
101
  end
102
102
  end
103
103
 
104
- def request(url, response_handler, error, &connector)
104
+ def request(uri, response_handler, error, &connector)
105
105
  response = nil
106
106
  Timeout.timeout(5 * 60, APITimeoutError) do
107
- http = Net::HTTP.new(url.host, url.port)
108
- if url.is_a? URI::HTTPS
109
- http.use_ssl = true
110
- http.ca_file = File.join( File.dirname(__FILE__),
111
- *%w[.. .. .. data cacert.pem] )
112
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER |
113
- OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
114
- end
107
+ http = build_http(uri)
108
+
115
109
  response = no_warnings { http.start(&connector) }
116
110
  end
117
111
  case response
data/lib/scout/command.rb CHANGED
@@ -5,6 +5,8 @@ require "fileutils"
5
5
 
6
6
  module Scout
7
7
  class Command
8
+ include Scout::HTTP
9
+
8
10
  def self.user
9
11
  @user ||= ENV["USER"] || ENV["USERNAME"] || "root"
10
12
  end
data/lib/scout/http.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "net/https"
2
+ require "uri"
3
+
4
+ module Scout
5
+ module HTTP
6
+ CA_FILE = File.join( File.dirname(__FILE__), *%w[.. .. data cacert.pem] )
7
+ VERIFY_MODE = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
8
+
9
+ # take care of http/https proxy, if specified in command line options
10
+ # Given a blank string, the proxy_uri URI instance's host/port/user/pass will be nil
11
+ # Net::HTTP::Proxy returns a regular Net::HTTP class if the first argument (host) is nil
12
+ def build_http(uri)
13
+ proxy_uri = URI.parse(uri.is_a?(URI::HTTPS) ? @https_proxy : @http_proxy)
14
+ http = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.port).new(uri.host, uri.port)
15
+
16
+ if uri.is_a?(URI::HTTPS)
17
+ http.use_ssl = true
18
+ http.ca_file = CA_FILE
19
+ http.verify_mode = VERIFY_MODE
20
+ end
21
+ http
22
+ end
23
+ end
24
+ end
@@ -9,6 +9,8 @@ require "base64"
9
9
 
10
10
  module Scout
11
11
  class ServerBase
12
+ include Scout::HTTP
13
+
12
14
  # A new class for plugin Timeout errors.
13
15
  class PluginTimeoutError < RuntimeError; end
14
16
  # A new class for API Timeout errors.
@@ -51,23 +53,11 @@ module Scout
51
53
  end
52
54
  end
53
55
 
54
- def request(url, response_handler, error, &connector)
56
+ def request(uri, response_handler, error, &connector)
55
57
  response = nil
56
58
  Timeout.timeout(5 * 60, APITimeoutError) do
57
- # take care of http/https proxy, if specified in command line options
58
- # Given a blank string, the proxy_uri URI instance's host/port/user/pass will be nil
59
- # Net::HTTP::Proxy returns a regular Net::HTTP class if the first argument (host) is nil
60
- info "using http_proxy=#{@http_proxy}, https_proxy=#{@https_proxy}" if @http_proxy != '' || @https_proxy != ''
61
- proxy_uri = URI.parse(url.is_a?(URI::HTTPS) ? @https_proxy : @http_proxy)
62
- http=Net::HTTP::Proxy(proxy_uri.host,proxy_uri.port,proxy_uri.user,proxy_uri.password).new(url.host, url.port)
59
+ http = build_http(uri)
63
60
 
64
- if url.is_a? URI::HTTPS
65
- http.use_ssl = true
66
- http.ca_file = File.join(File.dirname(__FILE__),
67
- *%w[.. .. data cacert.pem])
68
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER |
69
- OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
70
- end
71
61
  response = no_warnings { http.start(&connector) }
72
62
  end
73
63
  case response
data/lib/scout/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.7.2.pre"
2
+ VERSION = "5.7.2.pre.2"
3
3
  end
data/lib/scout.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby -wKU
2
2
  require "scout/version"
3
3
 
4
+ require "scout/http"
4
5
  require "scout/command"
5
6
  require "scout/plugin"
6
7
  require "scout/plugin_options"
metadata CHANGED
@@ -1,44 +1,52 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: scout
3
- version: !ruby/object:Gem::Version
4
- version: 5.7.2.pre
3
+ version: !ruby/object:Gem::Version
4
+ hash: -793397844
5
5
  prerelease: 6
6
+ segments:
7
+ - 5
8
+ - 7
9
+ - 2
10
+ - pre
11
+ - 2
12
+ version: 5.7.2.pre.2
6
13
  platform: ruby
7
- authors:
14
+ authors:
8
15
  - Andre Lewis
9
16
  - Derek Haynes
10
17
  - James Edward Gray II
11
18
  autorequire:
12
19
  bindir: bin
13
20
  cert_chain: []
14
- date: 2013-09-09 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
21
+
22
+ date: 2013-09-09 00:00:00 -06:00
23
+ default_executable:
24
+ dependencies:
25
+ - !ruby/object:Gem::Dependency
17
26
  name: elif
18
- requirement: !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '0'
24
- type: :runtime
25
27
  prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
28
+ requirement: &id001 !ruby/object:Gem::Requirement
27
29
  none: false
28
- requirements:
29
- - - ! '>='
30
- - !ruby/object:Gem::Version
31
- version: '0'
32
- description: ! 'The scout gem reports metrics to scoutapp.com, an easy-to-use hosted
33
- server monitoring service.
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ hash: 3
34
+ segments:
35
+ - 0
36
+ version: "0"
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ description: |
40
+ The scout gem reports metrics to scoutapp.com, an easy-to-use hosted server monitoring service.
34
41
 
35
- '
36
42
  email: support@scoutapp.com
37
- executables:
43
+ executables:
38
44
  - scout
39
45
  extensions: []
46
+
40
47
  extra_rdoc_files: []
41
- files:
48
+
49
+ files:
42
50
  - .gitignore
43
51
  - CHANGELOG.markdown
44
52
  - Gemfile
@@ -60,6 +68,7 @@ files:
60
68
  - lib/scout/daemon_spawn.rb
61
69
  - lib/scout/data_file.rb
62
70
  - lib/scout/environment.rb
71
+ - lib/scout/http.rb
63
72
  - lib/scout/plugin.rb
64
73
  - lib/scout/plugin_options.rb
65
74
  - lib/scout/scout_logger.rb
@@ -193,33 +202,41 @@ files:
193
202
  - vendor/signature/spec/signature_spec.rb
194
203
  - vendor/signature/spec/spec_helper.rb
195
204
  - vendor/util/lib/core_extensions.rb
205
+ has_rdoc: true
196
206
  homepage: http://scoutapp.com
197
207
  licenses: []
208
+
198
209
  post_install_message:
199
210
  rdoc_options: []
200
- require_paths:
211
+
212
+ require_paths:
201
213
  - lib
202
- required_ruby_version: !ruby/object:Gem::Requirement
214
+ required_ruby_version: !ruby/object:Gem::Requirement
203
215
  none: false
204
- requirements:
205
- - - ! '>='
206
- - !ruby/object:Gem::Version
207
- version: '0'
208
- required_rubygems_version: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ hash: 3
220
+ segments:
221
+ - 0
222
+ version: "0"
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
209
224
  none: false
210
- requirements:
211
- - - ! '>'
212
- - !ruby/object:Gem::Version
225
+ requirements:
226
+ - - ">"
227
+ - !ruby/object:Gem::Version
228
+ hash: 25
229
+ segments:
230
+ - 1
231
+ - 3
232
+ - 1
213
233
  version: 1.3.1
214
234
  requirements: []
235
+
215
236
  rubyforge_project: scout
216
- rubygems_version: 1.8.25
237
+ rubygems_version: 1.4.2
217
238
  signing_key:
218
239
  specification_version: 3
219
- summary: Scout is an easy-to-use hosted server monitoring service. The scout Ruby
220
- gem reports metrics to our service. The agent runs plugins, configured via the Scout
221
- web interface, to monitor a server.
222
- test_files:
223
- - test/plugins/disk_usage.rb
224
- - test/scout_test.rb
225
- has_rdoc:
240
+ summary: Scout is an easy-to-use hosted server monitoring service. The scout Ruby gem reports metrics to our service. The agent runs plugins, configured via the Scout web interface, to monitor a server.
241
+ test_files: []
242
+