docker-armada 2.8.0 → 2.9.0

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: c741d480da83fb371c6f20ea0ecd11d8170cd969
4
- data.tar.gz: 247cc72cdc17beee8a1147d4f836e3a217535017
3
+ metadata.gz: 403ae99285b97c3c3032440db767628a8fa2876e
4
+ data.tar.gz: bc5a27e415ae56faa4ef5885c92ddb1ae852ad7d
5
5
  SHA512:
6
- metadata.gz: 3f349c33d13bed42612fbd76b1d60e747eba2665e6c22165ebfb183f87f21629f4028d93e6b7774994413c23f1f5b006b7bbf2b9400e00e7453ab391bb90505c
7
- data.tar.gz: cdcef98da8616d11f0b8b604c8d2234550fea29ce147359318fb6331ad0b0014bc9257399ad0c9fa6644d036b6652b1abad0db3f25e79f5078948263e3500c76
6
+ metadata.gz: a7710d1c50edcd5b06ee5c199c343a8a4196eedbe0257e3fab7e892a201379733fe15c7debef106019706dd8ded6cf3bbd3911bed8265a28f23ec6e5415c65f3
7
+ data.tar.gz: b5407fdabb2fe90a90fbdbf0e803186bb64e357de021fb1a5fb098ad5fbf32d54fe87c7155805170e5e8cfb0fa4cb52b68909932fd895670a77845fb1cd705c4
data/README.md CHANGED
@@ -295,6 +295,13 @@ Examples:
295
295
  armada clean images --hosts my-docker-host-01:3435
296
296
  ```
297
297
 
298
+ ## TLS Support
299
+ If the DOCKER_CERT_PATH environment variable is set then the proper cert options will be set for the client. Make sure you have the following files in the DOCKER_CERT_PATH location:
300
+ * `cert.pem`
301
+ * `key.pem`
302
+ * `ca.pem`
303
+
304
+
298
305
  ## Maintainers
299
306
  [Jonathan Chauncey (jchauncey)](https://github.com/jchauncey)
300
307
  [Darrell Hamilton (zeroem)](https://github.com/zeroem)
@@ -14,8 +14,25 @@ module Armada
14
14
 
15
15
  private
16
16
  def create_connection
17
- return ::Docker::Connection.new("http://localhost:#{@tunneled_port}", {}) if @gateway
18
- return ::Docker::Connection.new("http://#{@host}:#{@port}", {})
17
+ return ::Docker::Connection.new("#{scheme}://localhost:#{@tunneled_port}", connection_opts) if @gateway
18
+ return ::Docker::Connection.new("#{scheme}://#{@host}:#{@port}", connection_opts)
19
+ end
20
+
21
+ def scheme
22
+ ENV['DOCKER_CERT_PATH'] ? 'https' : 'http'
23
+ end
24
+
25
+ def connection_opts
26
+ opts = {}
27
+
28
+ if cert_path = ENV['DOCKER_CERT_PATH']
29
+ opts[:client_cert] = File.join(cert_path, 'cert.pem')
30
+ opts[:client_key] = File.join(cert_path, 'key.pem')
31
+ opts[:ssl_ca_file] = File.join(cert_path, 'ca.pem')
32
+ opts[:ssl_verify_peer] = false if @gateway
33
+ end
34
+
35
+ opts
19
36
  end
20
37
  end
21
38
  end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe Armada::Connection::Docker do
4
+ let(:connection) { described_class.new('localhost:1234').connection }
5
+
6
+ context 'when no certificate path is set' do
7
+ before(:each) { ENV['DOCKER_CERT_PATH'] = nil }
8
+
9
+ context 'scheme' do
10
+ subject { connection.url }
11
+
12
+ it { should start_with 'http://' }
13
+ end
14
+
15
+ context 'connection options' do
16
+ subject { connection.options }
17
+
18
+ it { should_not include(:client_cert, :client_key, :ssl_ca_file, :ssl_verify_peer) }
19
+ end
20
+ end
21
+
22
+ context 'when certificate path is set' do
23
+ before(:each) { ENV['DOCKER_CERT_PATH'] = '/some/cert/path' }
24
+
25
+ context 'scheme' do
26
+ subject { connection.url }
27
+
28
+ it { should start_with 'https://' }
29
+ end
30
+
31
+ context 'connection options' do
32
+ subject { connection.options }
33
+
34
+ it { should include(:client_cert, :client_key, :ssl_ca_file) }
35
+ it { should_not include(:ssl_verify_peer) }
36
+ end
37
+ end
38
+
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-armada
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Chauncey
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-02-13 00:00:00.000000000 Z
13
+ date: 2015-02-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: excon
@@ -253,6 +253,7 @@ files:
253
253
  - lib/armada/utils/commands.rb
254
254
  - lib/armada/utils/time.rb
255
255
  - lib/armada/version.rb
256
+ - spec/connection/docker_spec.rb
256
257
  - spec/connection/health_check_spec.rb
257
258
  - spec/deploy_dsl_spec.rb
258
259
  - spec/docker/container_spec.rb
@@ -283,6 +284,7 @@ signing_key:
283
284
  specification_version: 4
284
285
  summary: Deploy utility for docker containers
285
286
  test_files:
287
+ - spec/connection/docker_spec.rb
286
288
  - spec/connection/health_check_spec.rb
287
289
  - spec/deploy_dsl_spec.rb
288
290
  - spec/docker/container_spec.rb