docker-api 1.14.0 → 1.15.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: dab7caebda8a517a9660ae2c95ea440ee306f726
4
- data.tar.gz: de34214e3e4529b93a3f0a2a5cc6d4a9361b12d8
3
+ metadata.gz: 026147324341d46ecc633b106fa941316435e612
4
+ data.tar.gz: c9022722fa623436a9a7f5b5ece2383c946eb21d
5
5
  SHA512:
6
- metadata.gz: 67e1f79132a6d26c962e7df5dee773fe196c7e6416db0024500ec517563cb1403a831f7215e795c6d985efd76381388b8d9cbaa66f45ea9f55305b7b893b5add
7
- data.tar.gz: fa18fd517d9cefaa26f5bc4342eba57e1dd27016400ee7de00cb65e2f06a2f933988157f867036890e8b36b65904d05e2365b06efdd0b45ee3fba229987ad6fd
6
+ metadata.gz: 0361890e0d8bd23b86c4b1cc362a4f7d5f327222ea0261c8a1159daaa331f5b7b90d5a93e8142558fd2e514b5d22ff7481fa80b60fc6fb64a55c6868e6bff1b6
7
+ data.tar.gz: 4d22cb2d2fb45120b9a7485e4be4e8a35b56085287c397ae624be1d6c6036acfe4cbb57879afa096fa8089d3e03524f54542841c9ae626087611086fee07a57f
@@ -35,11 +35,24 @@ module Docker
35
35
  end
36
36
 
37
37
  def env_url
38
- ENV['DOCKER_URL']
38
+ ENV['DOCKER_URL'] || ENV['DOCKER_HOST']
39
+ end
40
+
41
+ def env_options
42
+ if cert_path = ENV['DOCKER_CERT_PATH']
43
+ {
44
+ client_cert: File.join(cert_path, 'cert.pem'),
45
+ client_key: File.join(cert_path, 'key.pem'),
46
+ ssl_ca_file: File.join(cert_path, 'ca.pem'),
47
+ scheme: 'https'
48
+ }
49
+ else
50
+ {}
51
+ end
39
52
  end
40
53
 
41
54
  def url
42
- @url ||= ENV['DOCKER_URL'] || ENV['DOCKER_HOST'] || default_socket_url
55
+ @url ||= env_url || default_socket_url
43
56
  # docker uses a default notation tcp:// which means tcp://localhost:2375
44
57
  if @url == 'tcp://'
45
58
  @url = 'tcp://localhost:2375'
@@ -48,7 +61,7 @@ module Docker
48
61
  end
49
62
 
50
63
  def options
51
- @options ||= {}
64
+ @options ||= env_options
52
65
  end
53
66
 
54
67
  def url=(new_url)
@@ -57,7 +70,7 @@ module Docker
57
70
  end
58
71
 
59
72
  def options=(new_options)
60
- @options = new_options
73
+ @options = env_options.merge(new_options || {})
61
74
  reset_connection!
62
75
  end
63
76
 
@@ -98,8 +111,8 @@ module Docker
98
111
  raise Docker::Error::VersionError, "Expected API Version: #{API_VERSION}"
99
112
  end
100
113
 
101
- module_function :default_socket_url, :env_url, :url, :url=, :options,
102
- :options=, :creds, :creds=, :logger, :logger=,
114
+ module_function :default_socket_url, :env_url, :url, :url=, :env_options,
115
+ :options, :options=, :creds, :creds=, :logger, :logger=,
103
116
  :connection, :reset_connection!, :version, :info,
104
117
  :authenticate!, :validate_version!
105
118
  end
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  # The version of the docker-api gem.
3
- VERSION = '1.14.0'
3
+ VERSION = '1.15.0'
4
4
 
5
5
  # The version of the compatible Docker remote API.
6
6
  API_VERSION = '1.12'
@@ -6,6 +6,7 @@ describe Docker do
6
6
  before do
7
7
  ENV['DOCKER_URL'] = nil
8
8
  ENV['DOCKER_HOST'] = nil
9
+ ENV['DOCKER_CERT_PATH'] = nil
9
10
  end
10
11
 
11
12
  it { should be_a Module }
@@ -17,7 +18,7 @@ describe Docker do
17
18
  end
18
19
 
19
20
  context "when the DOCKER_* ENV variables aren't set" do
20
- its(:options) { {} }
21
+ its(:options) { should == {} }
21
22
  its(:url) { should == 'unix:///var/run/docker.sock' }
22
23
  its(:connection) { should be_a Docker::Connection }
23
24
  end
@@ -25,9 +26,10 @@ describe Docker do
25
26
  context "when the DOCKER_* ENV variables are set" do
26
27
  before do
27
28
  ENV['DOCKER_URL'] = 'unixs:///var/run/not-docker.sock'
29
+ Docker.options = nil
28
30
  end
29
31
 
30
- its(:options) { {} }
32
+ its(:options) { should == {} }
31
33
  its(:url) { should == 'unixs:///var/run/not-docker.sock' }
32
34
  its(:connection) { should be_a Docker::Connection }
33
35
  end
@@ -35,19 +37,21 @@ describe Docker do
35
37
  context "when the DOCKER_HOST is set and uses default tcp://" do
36
38
  before do
37
39
  ENV['DOCKER_HOST'] = 'tcp://'
40
+ Docker.options = nil
38
41
  end
39
42
 
40
- its(:options) { {} }
43
+ its(:options) { should == {} }
41
44
  its(:url) { should == 'tcp://localhost:2375' }
42
45
  its(:connection) { should be_a Docker::Connection }
43
46
  end
44
47
 
45
- context "when the DOCKER_HOST ENV variables is set" do
48
+ context "when the DOCKER_HOST ENV variable is set" do
46
49
  before do
47
50
  ENV['DOCKER_HOST'] = 'tcp://someserver:8103'
51
+ Docker.options = nil
48
52
  end
49
53
 
50
- its(:options) { {} }
54
+ its(:options) { should == {} }
51
55
  its(:url) { should == 'tcp://someserver:8103' }
52
56
  its(:connection) { should be_a Docker::Connection }
53
57
  end
@@ -56,13 +60,32 @@ describe Docker do
56
60
  before do
57
61
  ENV['DOCKER_HOST'] = 'tcp://someserver:8103'
58
62
  ENV['DOCKER_URL'] = 'tcp://someotherserver:8103'
59
-
63
+ Docker.options = nil
60
64
  end
61
65
 
62
- its(:options) { {} }
66
+ its(:options) { should == {} }
63
67
  its(:url) { should == 'tcp://someotherserver:8103' }
64
68
  its(:connection) { should be_a Docker::Connection }
65
69
  end
70
+
71
+ context "when the DOCKER_CERT_PATH and DOCKER_HOST ENV variables are set" do
72
+ before do
73
+ ENV['DOCKER_HOST'] = 'tcp://someserver:8103'
74
+ ENV['DOCKER_CERT_PATH'] = '/boot2dockert/cert/path'
75
+ Docker.options = nil
76
+ end
77
+
78
+ its(:options) {
79
+ should == {
80
+ client_cert: '/boot2dockert/cert/path/cert.pem',
81
+ client_key: '/boot2dockert/cert/path/key.pem',
82
+ ssl_ca_file: '/boot2dockert/cert/path/ca.pem',
83
+ scheme: 'https'
84
+ }
85
+ }
86
+ its(:url) { should == 'tcp://someserver:8103' }
87
+ its(:connection) { should be_a Docker::Connection }
88
+ end
66
89
  end
67
90
 
68
91
  describe '#reset_connection!' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swipely, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-03 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon