hutch 0.4.5 → 0.5.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/.gitignore +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/hutch/broker.rb +3 -1
- data/lib/hutch/cli.rb +10 -0
- data/lib/hutch/config.rb +2 -0
- data/lib/hutch/version.rb +1 -1
- data/spec/hutch/cli_spec.rb +48 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad4ea66e507cf8c01b3e402c933223e0c525503
|
4
|
+
data.tar.gz: 736c571f2a6cc790ab2b3dda796a1c29b624ec74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d16e7ef03f63fdedf9501bee91dd49e6b5edb03db74e1027d7a0fa1ed140994dd9e545f757484f86441d078271523df98d3d9d9d83156ad33329ca761cfbaae9
|
7
|
+
data.tar.gz: 719bd84eced5c8876a2dbc43b785db900bc7300a091ffb479a6949fb0797ef66eb354a273b438f92ef3932eba07a1e1703dc8c2abed31cea7fd4bbd52f109a83
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/hutch/broker.rb
CHANGED
@@ -37,11 +37,13 @@ module Hutch
|
|
37
37
|
host, port, vhost = @config[:mq_host], @config[:mq_port]
|
38
38
|
username, password = @config[:mq_username], @config[:mq_password]
|
39
39
|
vhost, tls = @config[:mq_vhost], @config[:mq_tls]
|
40
|
+
tls_key, tls_cert = @config[:mq_tls_key], @config[:mq_tls_cert]
|
40
41
|
protocol = tls ? "amqps://" : "amqp://"
|
41
42
|
uri = "#{username}:#{password}@#{host}:#{port}/#{vhost.sub(/^\//, '')}"
|
42
43
|
logger.info "connecting to rabbitmq (#{protocol}#{uri})"
|
43
44
|
|
44
|
-
@connection = Bunny.new(host: host, port: port, vhost: vhost,
|
45
|
+
@connection = Bunny.new(host: host, port: port, vhost: vhost,
|
46
|
+
tls: tls, tls_key: tls_key, tls_cert: tls_cert,
|
45
47
|
username: username, password: password,
|
46
48
|
heartbeat: 1, automatically_recover: true,
|
47
49
|
network_recovery_interval: 1)
|
data/lib/hutch/cli.rb
CHANGED
@@ -101,6 +101,16 @@ module Hutch
|
|
101
101
|
Hutch::Config.mq_tls = tls
|
102
102
|
end
|
103
103
|
|
104
|
+
opts.on('--mq-tls-cert FILE', 'Certificate for TLS client verification') do |file|
|
105
|
+
abort "Certificate file '#{file}' not found" unless File.exists?(file)
|
106
|
+
Hutch::Config.mq_tls_cert = file
|
107
|
+
end
|
108
|
+
|
109
|
+
opts.on('--mq-tls-key FILE', 'Private key for TLS client verification') do |file|
|
110
|
+
abort "Private key file '#{file}' not found" unless File.exists?(file)
|
111
|
+
Hutch::Config.mq_tls_key = file
|
112
|
+
end
|
113
|
+
|
104
114
|
opts.on('--mq-exchange EXCHANGE',
|
105
115
|
'Set the RabbitMQ exchange') do |exchange|
|
106
116
|
Hutch::Config.mq_exchange = exchange
|
data/lib/hutch/config.rb
CHANGED
data/lib/hutch/version.rb
CHANGED
data/spec/hutch/cli_spec.rb
CHANGED
@@ -28,5 +28,53 @@ describe Hutch::CLI do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
context "--mq-tls-key" do
|
33
|
+
context "when the keyfile file does not exist" do
|
34
|
+
let(:file) { "/path/to/nonexistant/file" }
|
35
|
+
before { STDERR.stub(:write) }
|
36
|
+
|
37
|
+
it "bails" do
|
38
|
+
expect {
|
39
|
+
cli.parse_options(["--mq-tls-key=#{file}"])
|
40
|
+
}.to raise_error SystemExit
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when the keyfile file exists" do
|
45
|
+
let(:file) do
|
46
|
+
Tempfile.new("hutch-test-key.pem").to_path
|
47
|
+
end
|
48
|
+
|
49
|
+
it "sets mq_tls_key to the file" do
|
50
|
+
Hutch::Config.should_receive(:mq_tls_key=)
|
51
|
+
cli.parse_options(["--mq-tls-key=#{file}"])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "--mq-tls-cert" do
|
57
|
+
context "when the certfile file does not exist" do
|
58
|
+
let(:file) { "/path/to/nonexistant/file" }
|
59
|
+
before { STDERR.stub(:write) }
|
60
|
+
|
61
|
+
it "bails" do
|
62
|
+
expect {
|
63
|
+
cli.parse_options(["--mq-tls-cert=#{file}"])
|
64
|
+
}.to raise_error SystemExit
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when the certfile file exists" do
|
69
|
+
let(:file) do
|
70
|
+
Tempfile.new("hutch-test-cert.pem").to_path
|
71
|
+
end
|
72
|
+
|
73
|
+
it "sets mq_tls_cert to the file" do
|
74
|
+
Hutch::Config.should_receive(:mq_tls_cert=)
|
75
|
+
cli.parse_options(["--mq-tls-cert=#{file}"])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
31
79
|
end
|
32
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hutch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Marr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|