appsignal 1.3.4 → 1.3.5.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb8cdb9e1b2db95bc735c3d64eea9665be837d19
4
- data.tar.gz: 7021aa04820c7db059b86f6296bc6502fb771001
3
+ metadata.gz: c3a75a284960b4d62fbe5a44bb0d8874ea659d26
4
+ data.tar.gz: 9b0c5a85331cf63415a8d06d5f167fd51001e71d
5
5
  SHA512:
6
- metadata.gz: ad08fc277a7215b444c1298da267eebdf6a93435d001d4d6807701b1529107206907ed024c1715148a97ad51576827a4116f8f4530f337c29cbfd72312a0dd46
7
- data.tar.gz: 55fc2789cc506ee33d748dda6a78f38a188ca75b373a4b3459a45d9ba73da483cb73a1901adfe11ad341a5cc2e3c040c3d91aa4abfa4f461cc5fb7b900405787
6
+ metadata.gz: 5bc51d6d2696d1c9e3187bdc0542cffe1ac5c68c3bb6739ae720a54c5021891e8ec5897d0dfe03dbdf0eb81475e1688ea9cf11a482c370bfc7171c7d788563bd
7
+ data.tar.gz: 21fb5d5806e5f224960991fdc402ba6ef24dc8abf76af0835960935e39c4c72e96039d9e7412482a2b1f9dee1c95e5c6c7ada5bae5944ccc83b5ca32859fa714
data/.travis.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  sudo: false
2
2
 
3
+ branches:
4
+ only:
5
+ - "master"
6
+ - "develop"
7
+
3
8
  language: ruby
4
9
  cache: bundler
5
10
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.3.5
2
+
3
+ - Fix SSL certificate config in appsignal-agent. PR #151
4
+
1
5
  # 1.3.4
2
6
 
3
7
  * Fix argument order for `record_event` in the AppSignal extension
data/ext/agent.yml CHANGED
@@ -1,18 +1,18 @@
1
1
  ---
2
- version: 7d8fcfa
2
+ version: f0c15da
3
3
  triples:
4
4
  x86_64-linux:
5
- checksum: 9b11cbd3828f15fb79314459458877fc24b3cb5fb3b14ab4703def6136de77d3
6
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/7d8fcfa/appsignal-x86_64-linux-all-static.tar.gz
5
+ checksum: 2af2810c660b7b1ad38f5962db00a81965dcf0be07b101ff87f182d1699165b5
6
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f0c15da/appsignal-x86_64-linux-all-static.tar.gz
7
7
  i686-linux:
8
- checksum: 005d901b2097e0dc00327bfdffb34b5259bd93eb77b2da71436bd34b97062660
9
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/7d8fcfa/appsignal-i686-linux-all-static.tar.gz
8
+ checksum: a96f492f08bcccb0e66347fb0920b56d3d5c2958776469a241bf4357cfb4c1a0
9
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f0c15da/appsignal-i686-linux-all-static.tar.gz
10
10
  x86-linux:
11
- checksum: 005d901b2097e0dc00327bfdffb34b5259bd93eb77b2da71436bd34b97062660
12
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/7d8fcfa/appsignal-i686-linux-all-static.tar.gz
11
+ checksum: a96f492f08bcccb0e66347fb0920b56d3d5c2958776469a241bf4357cfb4c1a0
12
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f0c15da/appsignal-i686-linux-all-static.tar.gz
13
13
  x86_64-darwin:
14
- checksum: 1d2dbd22ad0fe22d9838022533df4debc2fbb9daa2519beed75d7e057b62e980
15
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/7d8fcfa/appsignal-x86_64-darwin-all-static.tar.gz
14
+ checksum: 0bbfdf50c06f1b3759ccac1a5b9bed8ebe42859144a045404ce258b3a2a93a4a
15
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f0c15da/appsignal-x86_64-darwin-all-static.tar.gz
16
16
  universal-darwin:
17
- checksum: 1d2dbd22ad0fe22d9838022533df4debc2fbb9daa2519beed75d7e057b62e980
18
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/7d8fcfa/appsignal-x86_64-darwin-all-static.tar.gz
17
+ checksum: 0bbfdf50c06f1b3759ccac1a5b9bed8ebe42859144a045404ce258b3a2a93a4a
18
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f0c15da/appsignal-x86_64-darwin-all-static.tar.gz
@@ -23,7 +23,8 @@ module Appsignal
23
23
  :running_in_container => false,
24
24
  :enable_host_metrics => true,
25
25
  :enable_minutely_probes => false,
26
- :hostname => ::Socket.gethostname
26
+ :hostname => ::Socket.gethostname,
27
+ :ca_file_path => File.expand_path(File.join('../../../resources/cacert.pem'), __FILE__)
27
28
  }.freeze
28
29
 
29
30
  ENV_TO_KEY_MAPPING = {
@@ -50,7 +51,8 @@ module Appsignal
50
51
  'APPSIGNAL_WORKING_DIR_PATH' => :working_dir_path,
51
52
  'APPSIGNAL_ENABLE_HOST_METRICS' => :enable_host_metrics,
52
53
  'APPSIGNAL_ENABLE_MINUTELY_PROBES' => :enable_minutely_probes,
53
- 'APPSIGNAL_HOSTNAME' => :hostname
54
+ 'APPSIGNAL_HOSTNAME' => :hostname,
55
+ 'APPSIGNAL_CA_FILE_PATH' => :ca_file_path
54
56
  }.freeze
55
57
 
56
58
  attr_reader :root_path, :env, :initial_config, :config_hash
@@ -127,6 +129,7 @@ module Appsignal
127
129
  ENV['APPSIGNAL_ENABLE_MINUTELY_PROBES'] = config_hash[:enable_minutely_probes].to_s
128
130
  ENV['APPSIGNAL_HOSTNAME'] = config_hash[:hostname].to_s
129
131
  ENV['APPSIGNAL_PROCESS_NAME'] = $0
132
+ ENV['APPSIGNAL_CA_FILE_PATH'] = config_hash[:ca_file_path].to_s
130
133
  end
131
134
 
132
135
  protected
@@ -175,7 +178,7 @@ module Appsignal
175
178
  # Configuration with string type
176
179
  %w(APPSIGNAL_PUSH_API_KEY APPSIGNAL_APP_NAME APPSIGNAL_PUSH_API_ENDPOINT
177
180
  APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH APPSIGNAL_HTTP_PROXY APPSIGNAL_LOG_PATH
178
- APPSIGNAL_WORKING_DIR_PATH APPSIGNAL_HOSTNAME).each do |var|
181
+ APPSIGNAL_WORKING_DIR_PATH APPSIGNAL_HOSTNAME APPSIGNAL_CA_FILE_PATH).each do |var|
179
182
  if env_var = ENV[var]
180
183
  config[ENV_TO_KEY_MAPPING[var]] = env_var
181
184
  end
@@ -8,7 +8,6 @@ module Appsignal
8
8
  class Transmitter
9
9
  CONTENT_TYPE = 'application/json; charset=UTF-8'.freeze
10
10
  CONTENT_ENCODING = 'gzip'.freeze
11
- CA_FILE_PATH = File.expand_path(File.join(__FILE__, '../../../resources/cacert.pem'))
12
11
 
13
12
  HTTP_ERRORS = [
14
13
  EOFError,
@@ -42,7 +41,7 @@ module Appsignal
42
41
  end
43
42
 
44
43
  def transmit(payload)
45
- Appsignal.logger.debug "Transmitting payload to #{uri}"
44
+ config.logger.debug "Transmitting payload to #{uri}"
46
45
  http_client.request(http_post(payload)).code
47
46
  end
48
47
 
@@ -71,7 +70,14 @@ module Appsignal
71
70
  http.use_ssl = true
72
71
  http.ssl_version = :TLSv1
73
72
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
74
- http.ca_file = CA_FILE_PATH
73
+
74
+ ca_file = config[:ca_file_path]
75
+ if ca_file && File.exist?(ca_file) && File.readable?(ca_file)
76
+ http.ca_file = ca_file
77
+ else
78
+ config.logger.warn "Ignoring non-existing or unreadable "\
79
+ "`ca_file_path`: #{ca_file}"
80
+ end
75
81
  end
76
82
  end
77
83
  end
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '1.3.4'
4
+ VERSION = '1.3.5.beta.1'
5
5
  end
@@ -35,7 +35,8 @@ describe Appsignal::Config do
35
35
  :running_in_container => false,
36
36
  :enable_host_metrics => true,
37
37
  :enable_minutely_probes => false,
38
- :hostname => Socket.gethostname
38
+ :hostname => Socket.gethostname,
39
+ :ca_file_path => File.join(resources_dir, 'cacert.pem')
39
40
  })
40
41
  end
41
42
 
@@ -130,6 +131,7 @@ describe Appsignal::Config do
130
131
  ENV['APPSIGNAL_ENABLE_MINUTELY_PROBES'].should eq 'false'
131
132
  ENV['APPSIGNAL_HOSTNAME'].should eq 'app1.local'
132
133
  ENV['APPSIGNAL_PROCESS_NAME'].should include 'rspec'
134
+ ENV['APPSIGNAL_CA_FILE_PATH'].should eq File.join(resources_dir, "cacert.pem")
133
135
  end
134
136
 
135
137
  context "if working_dir_path is set" do
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  if webmachine_present?
3
2
 
4
3
  require 'appsignal/integrations/webmachine'
@@ -1,11 +1,14 @@
1
1
  describe Appsignal::Transmitter do
2
2
  let(:config) { project_fixture_config }
3
3
  let(:action) { 'action' }
4
+ let(:log) { StringIO.new }
4
5
  let(:instance) { Appsignal::Transmitter.new(action, config) }
6
+ before do
7
+ config.config_hash[:hostname] = 'app1.local'
8
+ config.logger = Logger.new(log)
9
+ end
5
10
 
6
11
  describe "#uri" do
7
- before { ENV['APPSIGNAL_HOSTNAME'] = 'app1.local' }
8
-
9
12
  subject { instance.uri.to_s }
10
13
 
11
14
  it { should include 'https://push.appsignal.com/1/action?' }
@@ -20,7 +23,9 @@ describe Appsignal::Transmitter do
20
23
  before do
21
24
  stub_request(
22
25
  :post,
23
- "https://push.appsignal.com/1/action?api_key=abc&environment=production&gem_version=#{Appsignal::VERSION}&hostname=#{Socket.gethostname}&name=TestApp"
26
+ "https://push.appsignal.com/1/action?api_key=abc"\
27
+ "&environment=production&gem_version=#{Appsignal::VERSION}"\
28
+ "&hostname=#{config.config_hash[:hostname]}&name=TestApp"
24
29
  ).with(
25
30
  :body => Zlib::Deflate.deflate("{\"the\":\"payload\"}", Zlib::BEST_SPEED),
26
31
  :headers => {
@@ -31,10 +36,51 @@ describe Appsignal::Transmitter do
31
36
  :status => 200
32
37
  )
33
38
  end
34
-
35
39
  subject { instance.transmit(:the => :payload) }
36
40
 
37
41
  it { should eq '200' }
42
+
43
+ context "with ca_file_path config option set" do
44
+ context "when not existing file" do
45
+ before do
46
+ config.config_hash[:ca_file_path] = File.join(resources_dir, "cacert.pem")
47
+ end
48
+
49
+ it "ignores the config and logs a warning" do
50
+ expect(subject).to eq '200'
51
+ expect(log.string).to_not include "Ignoring non-existing or unreadable " \
52
+ "`ca_file_path`: #{config[:ca_file_path]}"
53
+ end
54
+ end
55
+
56
+ context "when not existing file" do
57
+ before do
58
+ config.config_hash[:ca_file_path] = File.join(tmp_dir, "ca_file_that_does_not_exist")
59
+ end
60
+
61
+ it "ignores the config and logs a warning" do
62
+ expect(subject).to eq '200'
63
+ expect(log.string).to include "Ignoring non-existing or unreadable " \
64
+ "`ca_file_path`: #{config[:ca_file_path]}"
65
+ end
66
+ end
67
+
68
+ context "when not readable file" do
69
+ let(:file) { File.join(tmp_dir, "ca_file") }
70
+ before do
71
+ config.config_hash[:ca_file_path] = file
72
+ File.open(file, "w") { |f| f.chmod 0000 }
73
+ end
74
+
75
+ it "ignores the config and logs a warning" do
76
+ expect(subject).to eq '200'
77
+ expect(log.string).to include "Ignoring non-existing or unreadable " \
78
+ "`ca_file_path`: #{config[:ca_file_path]}"
79
+ end
80
+
81
+ after { File.delete file }
82
+ end
83
+ end
38
84
  end
39
85
 
40
86
  describe "#http_post" do
@@ -53,13 +99,6 @@ describe Appsignal::Transmitter do
53
99
  end
54
100
  end
55
101
 
56
- describe ".CA_FILE_PATH" do
57
- subject { Appsignal::Transmitter::CA_FILE_PATH }
58
-
59
- it { should include('resources/cacert.pem') }
60
- it("should exist") { File.exist?(subject).should be_true }
61
- end
62
-
63
102
  describe "#http_client" do
64
103
  subject { instance.send(:http_client) }
65
104
 
@@ -78,7 +117,7 @@ describe Appsignal::Transmitter do
78
117
  its(:proxy?) { should be_false }
79
118
  its(:use_ssl?) { should be_true }
80
119
  its(:verify_mode) { should eq OpenSSL::SSL::VERIFY_PEER }
81
- its(:ca_file) { Appsignal::Transmitter::CA_FILE_PATH }
120
+ its(:ca_file) { should eq config[:ca_file_path] }
82
121
  end
83
122
 
84
123
  context "with a proxy" do
@@ -1,4 +1,8 @@
1
1
  module DirectoryHelper
2
+ def project_dir
3
+ @project_dir ||= File.expand_path('..', spec_dir)
4
+ end
5
+
2
6
  def spec_dir
3
7
  APPSIGNAL_SPEC_DIR
4
8
  end
@@ -14,4 +18,8 @@ module DirectoryHelper
14
18
  def fixtures_dir
15
19
  @fixtures_dir ||= File.join(support_dir, 'fixtures')
16
20
  end
21
+
22
+ def resources_dir
23
+ @resources_dir ||= File.join(project_dir, 'resources')
24
+ end
17
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-09 00:00:00.000000000 Z
12
+ date: 2016-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -313,9 +313,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
313
313
  version: '1.9'
314
314
  required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  requirements:
316
- - - ">="
316
+ - - ">"
317
317
  - !ruby/object:Gem::Version
318
- version: '0'
318
+ version: 1.3.1
319
319
  requirements: []
320
320
  rubyforge_project:
321
321
  rubygems_version: 2.5.1