centurion 1.8.2 → 1.8.3

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: b1dc375b0634eab02f89f0a78cd5eb7b4dbc3133
4
- data.tar.gz: 342b3afcaac56fff384fab3d80b32d04ce87e09b
3
+ metadata.gz: 03c6b6730357fe18ad3c5ba0da07c985f2beb83d
4
+ data.tar.gz: ca13d8ee3ae197a28f74332ecba32215afc3234e
5
5
  SHA512:
6
- metadata.gz: bcde80896ea6ed8e3bd5154d70c01360fae286810ecb38957b751a13a16cedd7cc01930e90087d4d400cebaddb299f843b086855336ad40ed141d2d5da67735c
7
- data.tar.gz: 25de72a8c3f6511cd4b09336efe91311f347564d6d5d238393f34b436e75af40bccf9ab8f4978bf246460e9a75dd4bc1377521e3c32c8430b8522d94b8b26ba5
6
+ metadata.gz: 7ef770e7477c372180ea27ce21b1ef76f37745da94513d76ca9a34ab43efa0ad8cd35cf544f82758c636d3c25fd8bbbf9ed8400ac1e78f49730842e3c9b0f964
7
+ data.tar.gz: 2d73c5575ad77bc907c58a798e19d42f85e42731d67bd1ef36a9a13d9d45261045432600f8385e1cfad78c2e43724c43815a2b26ba4e897f03e8c8a7da92a03a
@@ -12,6 +12,7 @@ Your name could be here!
12
12
  * [Suren Karapetyan][skarap]
13
13
  * [Jon Wood][jellybob]
14
14
  * [Mark Borcherding][markborcherding]
15
+ * [Nick Laferriere][laferrieren]
15
16
 
16
17
  Pre-release
17
18
  -----------
@@ -64,7 +64,7 @@ class Centurion::DockerServer
64
64
 
65
65
  def docker_via_api
66
66
  @docker_via_api ||= Centurion::DockerViaApi.new(@hostname, @port,
67
- @tls_params)
67
+ @tls_params, nil)
68
68
  end
69
69
 
70
70
  def docker_via_cli
@@ -6,15 +6,16 @@ require 'securerandom'
6
6
  module Centurion; end
7
7
 
8
8
  class Centurion::DockerViaApi
9
- def initialize(hostname, port, tls_args = {})
9
+ def initialize(hostname, port, tls_args = {}, api_version = nil)
10
10
  @tls_args = default_tls_args(tls_args[:tls]).merge(tls_args.reject { |k, v| v.nil? }) # Required by tls_enable?
11
11
  @base_uri = "http#{'s' if tls_enable?}://#{hostname}:#{port}"
12
-
12
+ api_version ||= "/v1.12"
13
+ @docker_api_version = api_version
13
14
  configure_excon_globally
14
15
  end
15
16
 
16
17
  def ps(options={})
17
- path = "/v1.7/containers/json"
18
+ path = @docker_api_version + "/containers/json"
18
19
  path += "?all=1" if options[:all]
19
20
  response = Excon.get(@base_uri + path, tls_excon_arguments)
20
21
 
@@ -24,7 +25,7 @@ class Centurion::DockerViaApi
24
25
 
25
26
  def inspect_image(image, tag = "latest")
26
27
  repository = "#{image}:#{tag}"
27
- path = "/v1.7/images/#{repository}/json"
28
+ path = @docker_api_version + "/images/#{repository}/json"
28
29
 
29
30
  response = Excon.get(
30
31
  @base_uri + path,
@@ -35,7 +36,7 @@ class Centurion::DockerViaApi
35
36
  end
36
37
 
37
38
  def remove_container(container_id)
38
- path = "/v1.7/containers/#{container_id}"
39
+ path = @docker_api_version + "/containers/#{container_id}"
39
40
  response = Excon.delete(
40
41
  @base_uri + path,
41
42
  tls_excon_arguments
@@ -45,7 +46,7 @@ class Centurion::DockerViaApi
45
46
  end
46
47
 
47
48
  def stop_container(container_id, timeout = 30)
48
- path = "/v1.7/containers/#{container_id}/stop?t=#{timeout}"
49
+ path = @docker_api_version + "/containers/#{container_id}/stop?t=#{timeout}"
49
50
  response = Excon.post(
50
51
  @base_uri + path,
51
52
  tls_excon_arguments
@@ -55,7 +56,7 @@ class Centurion::DockerViaApi
55
56
  end
56
57
 
57
58
  def create_container(configuration, name = nil)
58
- path = "/v1.10/containers/create"
59
+ path = @docker_api_version + "/containers/create"
59
60
  response = Excon.post(
60
61
  @base_uri + path,
61
62
  tls_excon_arguments.merge(
@@ -69,7 +70,7 @@ class Centurion::DockerViaApi
69
70
  end
70
71
 
71
72
  def start_container(container_id, configuration)
72
- path = "/v1.10/containers/#{container_id}/start"
73
+ path = @docker_api_version + "/containers/#{container_id}/start"
73
74
  response = Excon.post(
74
75
  @base_uri + path,
75
76
  tls_excon_arguments.merge(
@@ -88,7 +89,7 @@ class Centurion::DockerViaApi
88
89
  end
89
90
 
90
91
  def restart_container(container_id, timeout = 30)
91
- path = "/v1.10/containers/#{container_id}/restart?t=#{timeout}"
92
+ path = @docker_api_version + "/containers/#{container_id}/restart?t=#{timeout}"
92
93
  response = Excon.post(
93
94
  @base_uri + path,
94
95
  tls_excon_arguments
@@ -106,7 +107,7 @@ class Centurion::DockerViaApi
106
107
  end
107
108
 
108
109
  def inspect_container(container_id)
109
- path = "/v1.7/containers/#{container_id}/json"
110
+ path = @docker_api_version + "/containers/#{container_id}/json"
110
111
  response = Excon.get(
111
112
  @base_uri + path,
112
113
  tls_excon_arguments
@@ -1,3 +1,3 @@
1
1
  module Centurion
2
- VERSION = '1.8.2'
2
+ VERSION = '1.8.3'
3
3
  end
@@ -4,6 +4,7 @@ require 'centurion/docker_via_api'
4
4
  describe Centurion::DockerViaApi do
5
5
  let(:hostname) { 'example.com' }
6
6
  let(:port) { '2375' }
7
+ let(:api_version) { '1.12' }
7
8
  let(:json_string) { '[{ "Hello": "World" }]' }
8
9
  let(:json_value) { JSON.load(json_string) }
9
10
 
@@ -13,14 +14,14 @@ describe Centurion::DockerViaApi do
13
14
 
14
15
  it 'lists processes' do
15
16
  expect(Excon).to receive(:get).
16
- with(excon_uri + 'v1.7/containers/json', {}).
17
+ with(excon_uri + "v1.12" + "/containers/json", {}).
17
18
  and_return(double(body: json_string, status: 200))
18
19
  expect(api.ps).to eq(json_value)
19
20
  end
20
21
 
21
22
  it 'lists all processes' do
22
23
  expect(Excon).to receive(:get).
23
- with(excon_uri + 'v1.7/containers/json?all=1', {}).
24
+ with(excon_uri + "v1.12" + "/containers/json?all=1", {}).
24
25
  and_return(double(body: json_string, status: 200))
25
26
  expect(api.ps(all: true)).to eq(json_value)
26
27
  end
@@ -29,7 +30,7 @@ describe Centurion::DockerViaApi do
29
30
  configuration_as_json = double
30
31
  configuration = double(to_json: configuration_as_json)
31
32
  expect(Excon).to receive(:post).
32
- with(excon_uri + "v1.10" + "/containers/create",
33
+ with(excon_uri + "v1.12" + "/containers/create",
33
34
  query: nil,
34
35
  body: configuration_as_json,
35
36
  headers: {'Content-Type' => 'application/json'}).
@@ -41,7 +42,7 @@ describe Centurion::DockerViaApi do
41
42
  configuration_as_json = double
42
43
  configuration = double(to_json: configuration_as_json)
43
44
  expect(Excon).to receive(:post).
44
- with(excon_uri + "v1.10" + "/containers/create",
45
+ with(excon_uri + "v1.12" + "/containers/create",
45
46
  query: { name: match(/^app1-[a-f0-9]+$/) },
46
47
  body: configuration_as_json,
47
48
  headers: {'Content-Type' => 'application/json'}).
@@ -53,7 +54,7 @@ describe Centurion::DockerViaApi do
53
54
  configuration_as_json = double
54
55
  configuration = double(to_json: configuration_as_json)
55
56
  expect(Excon).to receive(:post).
56
- with(excon_uri + "v1.10" + "/containers/12345/start",
57
+ with(excon_uri + "v1.12" + "/containers/12345/start",
57
58
  body: configuration_as_json,
58
59
  headers: {'Content-Type' => 'application/json'}).
59
60
  and_return(double(body: json_string, status: 204))
@@ -62,49 +63,49 @@ describe Centurion::DockerViaApi do
62
63
 
63
64
  it 'stops a container' do
64
65
  expect(Excon).to receive(:post).
65
- with(excon_uri + 'v1.7/containers/12345/stop?t=300', {}).
66
+ with(excon_uri + "v1.12" + "/containers/12345/stop?t=300", {}).
66
67
  and_return(double(status: 204))
67
68
  api.stop_container('12345', 300)
68
69
  end
69
70
 
70
71
  it 'stops a container with a custom timeout' do
71
72
  expect(Excon).to receive(:post).
72
- with(excon_uri + 'v1.7/containers/12345/stop?t=30', {}).
73
+ with(excon_uri + "v1.12" + "/containers/12345/stop?t=30", {}).
73
74
  and_return(double(status: 204))
74
75
  api.stop_container('12345')
75
76
  end
76
77
 
77
78
  it 'restarts a container' do
78
79
  expect(Excon).to receive(:post).
79
- with(excon_uri + "v1.10" + "/containers/12345/restart?t=30", {}).
80
+ with(excon_uri + "v1.12" + "/containers/12345/restart?t=30", {}).
80
81
  and_return(double(body: json_string, status: 204))
81
82
  api.restart_container('12345')
82
83
  end
83
84
 
84
85
  it 'restarts a container with a custom timeout' do
85
86
  expect(Excon).to receive(:post).
86
- with(excon_uri + "v1.10" + "/containers/12345/restart?t=300", {}).
87
+ with(excon_uri + "v1.12" + "/containers/12345/restart?t=300", {}).
87
88
  and_return(double(body: json_string, status: 204))
88
89
  api.restart_container('12345', 300)
89
90
  end
90
91
 
91
92
  it 'inspects a container' do
92
93
  expect(Excon).to receive(:get).
93
- with(excon_uri + 'v1.7/containers/12345/json', {}).
94
+ with(excon_uri + "v1.12" + "/containers/12345/json", {}).
94
95
  and_return(double(body: json_string, status: 200))
95
96
  expect(api.inspect_container('12345')).to eq(json_value)
96
97
  end
97
98
 
98
99
  it 'removes a container' do
99
100
  expect(Excon).to receive(:delete).
100
- with(excon_uri + 'v1.7/containers/12345', {}).
101
+ with(excon_uri + "v1.12" + "/containers/12345", {}).
101
102
  and_return(double(status: 204))
102
103
  expect(api.remove_container('12345')).to eq(true)
103
104
  end
104
105
 
105
106
  it 'inspects an image' do
106
107
  expect(Excon).to receive(:get).
107
- with(excon_uri + "v1.7" + "/images/foo:bar/json",
108
+ with(excon_uri + "v1.12" + "/images/foo:bar/json",
108
109
  headers: {'Accept' => 'application/json'}).
109
110
  and_return(double(body: json_string, status: 200))
110
111
  expect(api.inspect_image('foo', 'bar')).to eq(json_value)
@@ -120,7 +121,7 @@ describe Centurion::DockerViaApi do
120
121
 
121
122
  it 'lists processes' do
122
123
  expect(Excon).to receive(:get).
123
- with(excon_uri + 'v1.7/containers/json',
124
+ with(excon_uri + "v1.12" + "/containers/json",
124
125
  client_cert: '/certs/cert.pem',
125
126
  client_key: '/certs/key.pem').
126
127
  and_return(double(body: json_string, status: 200))
@@ -129,7 +130,7 @@ describe Centurion::DockerViaApi do
129
130
 
130
131
  it 'lists all processes' do
131
132
  expect(Excon).to receive(:get).
132
- with(excon_uri + 'v1.7/containers/json?all=1',
133
+ with(excon_uri + "v1.12" + "/containers/json?all=1",
133
134
  client_cert: '/certs/cert.pem',
134
135
  client_key: '/certs/key.pem').
135
136
  and_return(double(body: json_string, status: 200))
@@ -138,7 +139,7 @@ describe Centurion::DockerViaApi do
138
139
 
139
140
  it 'inspects an image' do
140
141
  expect(Excon).to receive(:get).
141
- with(excon_uri + 'v1.7/images/foo:bar/json',
142
+ with(excon_uri + "v1.12" + "/images/foo:bar/json",
142
143
  client_cert: '/certs/cert.pem',
143
144
  client_key: '/certs/key.pem',
144
145
  headers: {'Accept' => 'application/json'}).
@@ -150,7 +151,7 @@ describe Centurion::DockerViaApi do
150
151
  configuration_as_json = double
151
152
  configuration = double(to_json: configuration_as_json)
152
153
  expect(Excon).to receive(:post).
153
- with(excon_uri + 'v1.10/containers/create',
154
+ with(excon_uri + "v1.12" + "/containers/create",
154
155
  client_cert: '/certs/cert.pem',
155
156
  client_key: '/certs/key.pem',
156
157
  query: nil,
@@ -164,7 +165,7 @@ describe Centurion::DockerViaApi do
164
165
  configuration_as_json = double
165
166
  configuration = double(to_json: configuration_as_json)
166
167
  expect(Excon).to receive(:post).
167
- with(excon_uri + 'v1.10/containers/12345/start',
168
+ with(excon_uri + "v1.12" + "/containers/12345/start",
168
169
  client_cert: '/certs/cert.pem',
169
170
  client_key: '/certs/key.pem',
170
171
  body: configuration_as_json,
@@ -175,7 +176,7 @@ describe Centurion::DockerViaApi do
175
176
 
176
177
  it 'stops a container' do
177
178
  expect(Excon).to receive(:post).
178
- with(excon_uri + 'v1.7/containers/12345/stop?t=300',
179
+ with(excon_uri + "v1.12" + "/containers/12345/stop?t=300",
179
180
  client_cert: '/certs/cert.pem',
180
181
  client_key: '/certs/key.pem').
181
182
  and_return(double(status: 204))
@@ -184,7 +185,7 @@ describe Centurion::DockerViaApi do
184
185
 
185
186
  it 'stops a container with a custom timeout' do
186
187
  expect(Excon).to receive(:post).
187
- with(excon_uri + 'v1.7/containers/12345/stop?t=30',
188
+ with(excon_uri + "v1.12" + "/containers/12345/stop?t=30",
188
189
  client_cert: '/certs/cert.pem',
189
190
  client_key: '/certs/key.pem').
190
191
  and_return(double(status: 204))
@@ -193,7 +194,7 @@ describe Centurion::DockerViaApi do
193
194
 
194
195
  it 'restarts a container' do
195
196
  expect(Excon).to receive(:post).
196
- with(excon_uri + "v1.10" + "/containers/12345/restart?t=30",
197
+ with(excon_uri + "v1.12" + "/containers/12345/restart?t=30",
197
198
  client_cert: '/certs/cert.pem',
198
199
  client_key: '/certs/key.pem').
199
200
  and_return(double(body: json_string, status: 204))
@@ -202,7 +203,7 @@ describe Centurion::DockerViaApi do
202
203
 
203
204
  it 'restarts a container with a custom timeout' do
204
205
  expect(Excon).to receive(:post).
205
- with(excon_uri + "v1.10" + "/containers/12345/restart?t=300",
206
+ with(excon_uri + "v1.12" + "/containers/12345/restart?t=300",
206
207
  client_cert: '/certs/cert.pem',
207
208
  client_key: '/certs/key.pem').
208
209
  and_return(double(body: json_string, status: 204))
@@ -211,7 +212,7 @@ describe Centurion::DockerViaApi do
211
212
 
212
213
  it 'inspects a container' do
213
214
  expect(Excon).to receive(:get).
214
- with(excon_uri + 'v1.7/containers/12345/json',
215
+ with(excon_uri + "v1.12" + "/containers/12345/json",
215
216
  client_cert: '/certs/cert.pem',
216
217
  client_key: '/certs/key.pem').
217
218
  and_return(double(body: json_string, status: 200))
@@ -220,7 +221,7 @@ describe Centurion::DockerViaApi do
220
221
 
221
222
  it 'removes a container' do
222
223
  expect(Excon).to receive(:delete).
223
- with(excon_uri + 'v1.7/containers/12345',
224
+ with(excon_uri + "v1.12" + "/containers/12345",
224
225
  client_cert: '/certs/cert.pem',
225
226
  client_key: '/certs/key.pem').
226
227
  and_return(double(status: 204))
@@ -235,7 +236,7 @@ describe Centurion::DockerViaApi do
235
236
 
236
237
  it 'lists processes' do
237
238
  expect(Excon).to receive(:get).
238
- with(excon_uri + 'v1.7/containers/json',
239
+ with(excon_uri + "v1.12" + "/containers/json",
239
240
  client_cert: File.expand_path('~/.docker/cert.pem'),
240
241
  client_key: File.expand_path('~/.docker/key.pem')).
241
242
  and_return(double(body: json_string, status: 200))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: centurion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Benders
@@ -20,7 +20,7 @@ authors:
20
20
  autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
- date: 2015-09-22 00:00:00.000000000 Z
23
+ date: 2015-11-04 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: trollop
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  version: '0'
218
218
  requirements: []
219
219
  rubyforge_project:
220
- rubygems_version: 2.4.5
220
+ rubygems_version: 2.2.2
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: A deployment tool for Docker. Takes containers from a Docker registry and
@@ -239,4 +239,3 @@ test_files:
239
239
  - spec/spec_helper.rb
240
240
  - spec/support/matchers/capistrano_dsl_matchers.rb
241
241
  - spec/support/matchers/exit_code_matches.rb
242
- has_rdoc: