skylight 1.2.2 → 1.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/skylight/cli/doctor.rb +36 -7
- data/lib/skylight/normalizers.rb +2 -1
- data/lib/skylight/normalizers/couch_potato/query.rb +20 -0
- data/lib/skylight/util/http.rb +11 -2
- data/lib/skylight/util/ssl.rb +4 -0
- data/lib/skylight/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f628a6b5a3ed23626781369f5cab3b4adfbbb3c0
|
4
|
+
data.tar.gz: 8c623387c32d39fdde9bbbd482039be124fa92c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0915a87d423f154fe620d05a090574bc40c1ae10ad511a564a07b1917c54f1d0d94af969e5e858e915387c51ce2126616e3dfcea17aaac7cb58b3bd5e693b958'
|
7
|
+
data.tar.gz: a12c534ac052171b7f37b5f62f3aee67f3a230fa6a5925fdd545653489904c7469ea45c90190fdc409f973e24f2308ca1bf7d8ef1f534219a812edbed6941bc9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 1.3.0 (May 17, 2017)
|
2
|
+
|
3
|
+
* [FEATURE] Add normalizer for couch_potato. (Thanks @cobot)
|
4
|
+
* [IMPROVEMENT] `skylight doctor` now validates SSL configuration
|
5
|
+
* [IMPROVEMENT] Add ENV option to force use of bundled SSL certificates
|
6
|
+
|
1
7
|
## 1.2.2 (April 28, 2017)
|
2
8
|
|
3
9
|
* [BUGFIX] Update bundled SSL certificates to avoid an authentication issue some users encountered due to a new skylight.io certificate.
|
data/lib/skylight/cli/doctor.rb
CHANGED
@@ -5,16 +5,34 @@ module Skylight
|
|
5
5
|
|
6
6
|
desc "Run some basic tests to look out for common errors"
|
7
7
|
|
8
|
+
def check_ssl
|
9
|
+
say "Checking SSL"
|
10
|
+
http = Util::HTTP.new(config)
|
11
|
+
indent do
|
12
|
+
req = http.get("/", "Accept" => "text/html")
|
13
|
+
if req.success?
|
14
|
+
say "OK", :green
|
15
|
+
else
|
16
|
+
if req.exception.is_a?(Util::HTTP::StartError) && req.exception.original.is_a?(OpenSSL::SSL::SSLError)
|
17
|
+
say "Failed to verify SSL certificate.", :red
|
18
|
+
if Util::SSL.ca_cert_file?
|
19
|
+
say "Certificates located at #{Util::SSL.ca_cert_file_or_default} may be out of date.", :yellow
|
20
|
+
say "Please update your local certificates or try setting `SKYLIGHT_FORCE_OWN_CERTS=1` in your environment.", :yellow
|
21
|
+
end
|
22
|
+
else
|
23
|
+
say "Unable to reach Skylight servers.", :red
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
say "\n"
|
28
|
+
end
|
29
|
+
|
8
30
|
def check_rails
|
9
31
|
say "Checking for Rails"
|
10
32
|
|
11
33
|
indent do
|
12
34
|
if is_rails?
|
13
35
|
say "Rails application detected", :green
|
14
|
-
|
15
|
-
# Normally auto-loaded, but we haven't loaded Rails by the time Skylight is loaded
|
16
|
-
require 'skylight/railtie'
|
17
|
-
require rails_rb
|
18
36
|
else
|
19
37
|
say "No Rails application detected", :red
|
20
38
|
abort "Currently `skylight doctor` only works with Rails applications"
|
@@ -60,7 +78,10 @@ module Skylight
|
|
60
78
|
say "Configuration is valid", :green
|
61
79
|
rescue ConfigError => e
|
62
80
|
say "Configuration is invalid", :red
|
63
|
-
|
81
|
+
indent do
|
82
|
+
say e.message, :red
|
83
|
+
say "This may occur if you are configuring with ENV variables and didn't set them in this shell."
|
84
|
+
end
|
64
85
|
abort
|
65
86
|
end
|
66
87
|
end
|
@@ -131,8 +152,16 @@ module Skylight
|
|
131
152
|
return @config if @config
|
132
153
|
|
133
154
|
# MEGAHAX
|
134
|
-
|
135
|
-
|
155
|
+
if is_rails?
|
156
|
+
# Normally auto-loaded, but we haven't loaded Rails by the time Skylight is loaded
|
157
|
+
require 'skylight/railtie'
|
158
|
+
require rails_rb
|
159
|
+
|
160
|
+
railtie = Skylight::Railtie.send(:new)
|
161
|
+
@config = railtie.send(:load_skylight_config, Rails.application)
|
162
|
+
else
|
163
|
+
super
|
164
|
+
end
|
136
165
|
end
|
137
166
|
end
|
138
167
|
end
|
data/lib/skylight/normalizers.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module Skylight
|
4
|
+
module Normalizers
|
5
|
+
module CouchPotato
|
6
|
+
class Query < Normalizer
|
7
|
+
register "couch_potato.load"
|
8
|
+
register "couch_potato.view"
|
9
|
+
|
10
|
+
CAT = "db.couch_db.query".freeze
|
11
|
+
|
12
|
+
def normalize(trace, name, payload)
|
13
|
+
description = payload[:name] if payload
|
14
|
+
_name = name.sub('couch_potato.', '')
|
15
|
+
[CAT, _name, description]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/skylight/util/http.rb
CHANGED
@@ -29,7 +29,16 @@ module Skylight
|
|
29
29
|
READ_EXCEPTIONS << Net::ReadTimeout if defined?(Net::ReadTimeout)
|
30
30
|
READ_EXCEPTIONS.freeze
|
31
31
|
|
32
|
-
class StartError < StandardError
|
32
|
+
class StartError < StandardError
|
33
|
+
attr_reader :original
|
34
|
+
|
35
|
+
def initialize(e)
|
36
|
+
@original = e
|
37
|
+
super e.inspect
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
33
42
|
class ReadResponseError < StandardError; end
|
34
43
|
|
35
44
|
def initialize(config, service = :auth, opts = {})
|
@@ -101,7 +110,7 @@ module Skylight
|
|
101
110
|
client = http.start
|
102
111
|
rescue => e
|
103
112
|
# TODO: Retry here
|
104
|
-
raise StartError, e
|
113
|
+
raise StartError, e
|
105
114
|
end
|
106
115
|
|
107
116
|
begin
|
data/lib/skylight/util/ssl.rb
CHANGED
@@ -6,6 +6,8 @@ module Skylight
|
|
6
6
|
DEFAULT_CA_FILE = File.expand_path('../../data/cacert.pem', __FILE__)
|
7
7
|
|
8
8
|
def self.detect_ca_cert_file!
|
9
|
+
return nil if ENV['SKYLIGHT_FORCE_OWN_CERTS']
|
10
|
+
|
9
11
|
@ca_cert_file = false
|
10
12
|
if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
|
11
13
|
f = OpenSSL::X509::DEFAULT_CERT_FILE
|
@@ -17,6 +19,8 @@ module Skylight
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.detect_ca_cert_dir!
|
22
|
+
return nil if ENV['SKYLIGHT_FORCE_OWN_CERTS']
|
23
|
+
|
20
24
|
@ca_cert_dir = false
|
21
25
|
if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
|
22
26
|
d = OpenSSL::X509::DEFAULT_CERT_DIR
|
data/lib/skylight/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skylight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/skylight/normalizers/active_support/cache_read.rb
|
79
79
|
- lib/skylight/normalizers/active_support/cache_read_multi.rb
|
80
80
|
- lib/skylight/normalizers/active_support/cache_write.rb
|
81
|
+
- lib/skylight/normalizers/couch_potato/query.rb
|
81
82
|
- lib/skylight/normalizers/default.rb
|
82
83
|
- lib/skylight/normalizers/elasticsearch/request.rb
|
83
84
|
- lib/skylight/normalizers/grape/endpoint.rb
|