centurion 1.8.1 → 1.8.2
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/lib/centurion/deploy.rb +2 -2
- data/lib/centurion/docker_registry.rb +1 -1
- data/lib/centurion/docker_via_api.rb +6 -6
- data/lib/centurion/version.rb +1 -1
- data/lib/tasks/deploy.rake +2 -0
- data/spec/deploy_dsl_spec.rb +1 -1
- data/spec/deploy_spec.rb +1 -1
- data/spec/docker_registry_spec.rb +1 -1
- data/spec/docker_via_api_spec.rb +6 -6
- data/spec/docker_via_cli_spec.rb +2 -2
- 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: b1dc375b0634eab02f89f0a78cd5eb7b4dbc3133
|
4
|
+
data.tar.gz: 342b3afcaac56fff384fab3d80b32d04ce87e09b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcde80896ea6ed8e3bd5154d70c01360fae286810ecb38957b751a13a16cedd7cc01930e90087d4d400cebaddb299f843b086855336ad40ed141d2d5da67735c
|
7
|
+
data.tar.gz: 25de72a8c3f6511cd4b09336efe91311f347564d6d5d238393f34b436e75af40bccf9ab8f4978bf246460e9a75dd4bc1377521e3c32c8430b8522d94b8b26ba5
|
data/lib/centurion/deploy.rb
CHANGED
@@ -31,7 +31,7 @@ module Centurion::Deploy
|
|
31
31
|
end
|
32
32
|
|
33
33
|
unless health_check_method.call(target_server, port, endpoint)
|
34
|
-
error "Failed to validate started container on #{target_server}:#{port}"
|
34
|
+
error "Failed to validate started container on #{target_server.hostname}:#{port}"
|
35
35
|
exit(FAILED_CONTAINER_VALIDATION)
|
36
36
|
end
|
37
37
|
end
|
@@ -53,7 +53,7 @@ module Centurion::Deploy
|
|
53
53
|
def http_status_ok?(target_server, port, endpoint)
|
54
54
|
url = "http://#{target_server.hostname}:#{port}#{endpoint}"
|
55
55
|
response = begin
|
56
|
-
Excon.get(url, :
|
56
|
+
Excon.get(url, headers: {'Accept' => '*/*'})
|
57
57
|
rescue Excon::Errors::SocketError
|
58
58
|
warn "Failed to connect to #{url}, no socket open."
|
59
59
|
nil
|
@@ -17,7 +17,7 @@ class Centurion::DockerRegistry
|
|
17
17
|
path = "/v1/repositories/#{repository}/tags/#{tag}"
|
18
18
|
uri = uri_for_repository_path(repository, path)
|
19
19
|
$stderr.puts "GET: #{uri}"
|
20
|
-
options = { :
|
20
|
+
options = { headers: { "Content-Type" => "application/json" } }
|
21
21
|
if @user
|
22
22
|
options[:user] = @user
|
23
23
|
options[:password] = @password
|
@@ -28,7 +28,7 @@ class Centurion::DockerViaApi
|
|
28
28
|
|
29
29
|
response = Excon.get(
|
30
30
|
@base_uri + path,
|
31
|
-
tls_excon_arguments.merge(:
|
31
|
+
tls_excon_arguments.merge(headers: {'Accept' => 'application/json'})
|
32
32
|
)
|
33
33
|
raise response.inspect unless response.status == 200
|
34
34
|
JSON.load(response.body)
|
@@ -59,9 +59,9 @@ class Centurion::DockerViaApi
|
|
59
59
|
response = Excon.post(
|
60
60
|
@base_uri + path,
|
61
61
|
tls_excon_arguments.merge(
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
62
|
+
query: name ? {name: "#{name}-#{SecureRandom.hex(7)}"} : nil,
|
63
|
+
body: configuration.to_json,
|
64
|
+
headers: { "Content-Type" => "application/json" }
|
65
65
|
)
|
66
66
|
)
|
67
67
|
raise response.inspect unless response.status == 201
|
@@ -73,8 +73,8 @@ class Centurion::DockerViaApi
|
|
73
73
|
response = Excon.post(
|
74
74
|
@base_uri + path,
|
75
75
|
tls_excon_arguments.merge(
|
76
|
-
:
|
77
|
-
:
|
76
|
+
body: configuration.to_json,
|
77
|
+
headers: { "Content-Type" => "application/json" }
|
78
78
|
)
|
79
79
|
)
|
80
80
|
case response.status
|
data/lib/centurion/version.rb
CHANGED
data/lib/tasks/deploy.rake
CHANGED
data/spec/deploy_dsl_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe Centurion::DeployDSL do
|
|
31
31
|
it 'adds new env_vars to the existing ones, as strings' do
|
32
32
|
DeployDSLTest.env_vars('SHAKESPEARE' => 'Hamlet')
|
33
33
|
DeployDSLTest.env_vars('DICKENS' => 'David Copperfield',
|
34
|
-
:
|
34
|
+
DICKENS_BIRTH_YEAR: 1812)
|
35
35
|
|
36
36
|
expect(DeployDSLTest.defined_service.env_vars).to eq(
|
37
37
|
'SHAKESPEARE' => 'Hamlet',
|
data/spec/deploy_spec.rb
CHANGED
@@ -127,7 +127,7 @@ describe Centurion::Deploy do
|
|
127
127
|
second_container = container.dup
|
128
128
|
containers = [ container, second_container ]
|
129
129
|
|
130
|
-
expect(server).to receive(:
|
130
|
+
expect(server).to receive(:find_containers_by_name).with(:centurion).and_return(containers)
|
131
131
|
expect(server).to receive(:stop_container).with(container['Id'], 30).once
|
132
132
|
expect(server).to receive(:stop_container).with(second_container['Id'], 30).once
|
133
133
|
|
@@ -93,7 +93,7 @@ describe Centurion::DockerRegistry do
|
|
93
93
|
JSON
|
94
94
|
|
95
95
|
before do
|
96
|
-
expect(Excon).to receive(:get).with(kind_of(String), hash_including(:
|
96
|
+
expect(Excon).to receive(:get).with(kind_of(String), hash_including(user: user, password: password)).and_return(
|
97
97
|
double(status: 200, body: response)
|
98
98
|
)
|
99
99
|
end
|
data/spec/docker_via_api_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe Centurion::DockerViaApi do
|
|
27
27
|
|
28
28
|
it 'creates a container' do
|
29
29
|
configuration_as_json = double
|
30
|
-
configuration = double(:
|
30
|
+
configuration = double(to_json: configuration_as_json)
|
31
31
|
expect(Excon).to receive(:post).
|
32
32
|
with(excon_uri + "v1.10" + "/containers/create",
|
33
33
|
query: nil,
|
@@ -39,10 +39,10 @@ describe Centurion::DockerViaApi do
|
|
39
39
|
|
40
40
|
it 'creates a container with a name' do
|
41
41
|
configuration_as_json = double
|
42
|
-
configuration = double(:
|
42
|
+
configuration = double(to_json: configuration_as_json)
|
43
43
|
expect(Excon).to receive(:post).
|
44
44
|
with(excon_uri + "v1.10" + "/containers/create",
|
45
|
-
query: { :
|
45
|
+
query: { name: match(/^app1-[a-f0-9]+$/) },
|
46
46
|
body: configuration_as_json,
|
47
47
|
headers: {'Content-Type' => 'application/json'}).
|
48
48
|
and_return(double(body: json_string, status: 201))
|
@@ -51,7 +51,7 @@ describe Centurion::DockerViaApi do
|
|
51
51
|
|
52
52
|
it 'starts a container' do
|
53
53
|
configuration_as_json = double
|
54
|
-
configuration = double(:
|
54
|
+
configuration = double(to_json: configuration_as_json)
|
55
55
|
expect(Excon).to receive(:post).
|
56
56
|
with(excon_uri + "v1.10" + "/containers/12345/start",
|
57
57
|
body: configuration_as_json,
|
@@ -148,7 +148,7 @@ describe Centurion::DockerViaApi do
|
|
148
148
|
|
149
149
|
it 'creates a container' do
|
150
150
|
configuration_as_json = double
|
151
|
-
configuration = double(:
|
151
|
+
configuration = double(to_json: configuration_as_json)
|
152
152
|
expect(Excon).to receive(:post).
|
153
153
|
with(excon_uri + 'v1.10/containers/create',
|
154
154
|
client_cert: '/certs/cert.pem',
|
@@ -162,7 +162,7 @@ describe Centurion::DockerViaApi do
|
|
162
162
|
|
163
163
|
it 'starts a container' do
|
164
164
|
configuration_as_json = double
|
165
|
-
configuration = double(:
|
165
|
+
configuration = double(to_json: configuration_as_json)
|
166
166
|
expect(Excon).to receive(:post).
|
167
167
|
with(excon_uri + 'v1.10/containers/12345/start',
|
168
168
|
client_cert: '/certs/cert.pem',
|
data/spec/docker_via_cli_spec.rb
CHANGED
@@ -28,7 +28,7 @@ describe Centurion::DockerViaCli do
|
|
28
28
|
it 'should print all chars when one thread is running' do
|
29
29
|
expect(Centurion::Shell).to receive(:run_with_echo)
|
30
30
|
|
31
|
-
allow(Thread).to receive(:list) {[double(:
|
31
|
+
allow(Thread).to receive(:list) {[double(status: 'run')]}
|
32
32
|
|
33
33
|
docker_via_cli.pull('foo')
|
34
34
|
end
|
@@ -36,7 +36,7 @@ describe Centurion::DockerViaCli do
|
|
36
36
|
it 'should only print lines when multiple threads are running' do
|
37
37
|
expect(Centurion::Shell).to receive(:run_without_echo)
|
38
38
|
|
39
|
-
allow(Thread).to receive(:list) {[double(:
|
39
|
+
allow(Thread).to receive(:list) {[double(status: 'run'), double(status: 'run')]}
|
40
40
|
|
41
41
|
docker_via_cli.pull('foo')
|
42
42
|
end
|
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.
|
4
|
+
version: 1.8.2
|
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-
|
23
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: trollop
|