docker-api 1.20.0 → 1.21.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8561445c82a9399f7fc303f3a0980b9a0435cb0e
4
- data.tar.gz: 436d9e686521e49445dc2e6f786998f2dfd81730
3
+ metadata.gz: c60e727e41589271f61a49d530a0dded82d81448
4
+ data.tar.gz: da74b0b29b1732a2aaabca6dc0dddca84d628a9e
5
5
  SHA512:
6
- metadata.gz: b42de620e15d9b503791ef23fc7bdd9598f4541ddff03d7a7b306b6e48ba30ec6c263038e2719c37405e3176ca9fc05042d5a864ded610f1664362bb7051ec62
7
- data.tar.gz: f75aec1ebe9c929cca1bac68a0a46e0c474e03b73259c87c7f72ba30ba5e0dbe86f1395a45aa092553a8d50b94d4216b975c7de23ad5c385af8b3e3df87cc5e6
6
+ metadata.gz: 5dd6e22287a43e0fb91fddd529c371c44e0b2c5de387e10d973be9d71de3b917c887f7e3b9fd20771be6210b4480e2f59f78f9d7f16dc29fb0de053343bc9bf1
7
+ data.tar.gz: e455ff3b6fda2c4d3eb86d044b0bd9a09705b6bcfa6f969576e0d142a8f8fb39243b4fcc242a522840a773551321feab29308d4bd6c951fe11fbe8c9a2de0a58
data/.cane CHANGED
@@ -1 +1,2 @@
1
1
  --abc-max 16
2
+ --style-measure 100
data/README.md CHANGED
@@ -44,7 +44,9 @@ $ sudo docker -d
44
44
 
45
45
  This will daemonize Docker so that it can be used for the remote API calls.
46
46
 
47
- If you're running Docker locally as a socket, there is no setup to do in Ruby. If you're not or change the path of the socket, you'll have to point the gem to your socket or local/remote port. For example:
47
+ ### Host
48
+
49
+ If you're running Docker locally as a socket, there is no setup to do in Ruby. If you're not using a socket or have changed the path of the socket, you'll have to point the gem to your socket or local/remote port. For example:
48
50
 
49
51
  ```ruby
50
52
  Docker.url = 'tcp://example.com:5422'
@@ -76,6 +78,22 @@ irb(main):004:0> Docker.options
76
78
 
77
79
  Before doing anything else, ensure you have the correct version of the Docker API. To do this, run `Docker.validate_version!`. If your installed version is not supported, a `Docker::Error::VersionError` is raised.
78
80
 
81
+ ### SSL
82
+
83
+ When running docker using SSL, setting the DOCKER_CERT_PATH will configure docker-api to use SSL.
84
+ The cert path is a folder that contains the cert, key and cacert files.
85
+ docker-api is expecting the files to be named: cert.pem, key.pem, and ca.pem.
86
+ If your files are named different, you'll want to set your options explicity:
87
+
88
+ ```
89
+ Docker.options = {
90
+ client_cert: File.join(cert_path, 'cert.pem'),
91
+ client_key: File.join(cert_path, 'key.pem'),
92
+ ssl_ca_file: File.join(cert_path, 'ca.pem'),
93
+ scheme: 'https'
94
+ }
95
+ ```
96
+
79
97
  ## Global calls
80
98
 
81
99
  All of the following examples require a connection to a Docker server. See the <a href="#starting-up">Starting up</a> section above for more information.
data/lib/docker.rb CHANGED
@@ -46,6 +46,16 @@ module Docker
46
46
  client_key: File.join(cert_path, 'key.pem'),
47
47
  ssl_ca_file: File.join(cert_path, 'ca.pem'),
48
48
  scheme: 'https'
49
+ }.merge(ssl_options)
50
+ else
51
+ {}
52
+ end
53
+ end
54
+
55
+ def ssl_options
56
+ if ENV['DOCKER_SSL_VERIFY'] == 'false'
57
+ {
58
+ ssl_verify_peer: false
49
59
  }
50
60
  else
51
61
  {}
@@ -121,5 +131,5 @@ module Docker
121
131
  module_function :default_socket_url, :env_url, :url, :url=, :env_options,
122
132
  :options, :options=, :creds, :creds=, :logger, :logger=,
123
133
  :connection, :reset!, :reset_connection!, :version, :info,
124
- :authenticate!, :validate_version!
134
+ :authenticate!, :validate_version!, :ssl_options
125
135
  end
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  # The version of the docker-api gem.
3
- VERSION = '1.20.0'
3
+ VERSION = '1.21.0'
4
4
 
5
5
  # The version of the compatible Docker remote API.
6
6
  API_VERSION = '1.16'
data/spec/docker_spec.rb CHANGED
@@ -82,6 +82,7 @@ describe Docker do
82
82
  .and_return('tcp://someserver:8103')
83
83
  allow(ENV).to receive(:[]).with('DOCKER_CERT_PATH')
84
84
  .and_return('/boot2dockert/cert/path')
85
+ allow(ENV).to receive(:[]).with('DOCKER_SSL_VERIFY').and_return(nil)
85
86
  Docker.reset!
86
87
  end
87
88
 
@@ -96,6 +97,32 @@ describe Docker do
96
97
  its(:url) { should == 'tcp://someserver:8103' }
97
98
  its(:connection) { should be_a Docker::Connection }
98
99
  end
100
+
101
+ context "when the DOCKER_CERT_PATH and DOCKER_SSL_VERIFY ENV variables are set" do
102
+ before do
103
+ allow(ENV).to receive(:[]).with('DOCKER_URL').and_return(nil)
104
+ allow(ENV).to receive(:[]).with('DOCKER_HOST')
105
+ .and_return('tcp://someserver:8103')
106
+ allow(ENV).to receive(:[]).with('DOCKER_CERT_PATH')
107
+ .and_return('/boot2dockert/cert/path')
108
+ allow(ENV).to receive(:[]).with('DOCKER_SSL_VERIFY')
109
+ .and_return('false')
110
+ Docker.reset!
111
+ end
112
+
113
+ its(:options) {
114
+ should == {
115
+ client_cert: '/boot2dockert/cert/path/cert.pem',
116
+ client_key: '/boot2dockert/cert/path/key.pem',
117
+ ssl_ca_file: '/boot2dockert/cert/path/ca.pem',
118
+ scheme: 'https',
119
+ ssl_verify_peer: false
120
+ }
121
+ }
122
+ its(:url) { should == 'tcp://someserver:8103' }
123
+ its(:connection) { should be_a Docker::Connection }
124
+ end
125
+
99
126
  end
100
127
 
101
128
  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.20.0
4
+ version: 1.21.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: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon