centurion 1.8.3 → 1.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/centurion/deploy.rb +5 -2
- data/lib/centurion/deploy_dsl.rb +6 -3
- data/lib/centurion/docker_server.rb +1 -1
- data/lib/centurion/docker_via_cli.rb +5 -0
- data/lib/centurion/version.rb +1 -1
- data/spec/deploy_spec.rb +15 -1
- 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: 369271bc0ce536e622fa0f0af79033e644fabd73
|
4
|
+
data.tar.gz: 0a6212a1a65e3c2d5d24dfdc5aee9d41c4144993
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b48a1ff8e0da6f5a2b942ba7a5dbbbd377200c2c0f45c7d763fc99cfa2936a1c3c135f5b6bff84feabe10f813e8e7d18f3e23c1e50b674e96733ea7c1f3aa66
|
7
|
+
data.tar.gz: 80a0fdae74711b67cd80cb732a0bf14bfefb56c69bafa0302b07a8b6449dc96873b2552cfc11fbf6a7db4590d0e272fe894ae6eefdffd5f7ccd694b3b697981b
|
data/lib/centurion/deploy.rb
CHANGED
@@ -7,8 +7,11 @@ module Centurion::Deploy
|
|
7
7
|
FAILED_CONTAINER_VALIDATION = 100
|
8
8
|
|
9
9
|
def stop_containers(target_server, service, timeout = 30)
|
10
|
-
old_containers =
|
11
|
-
|
10
|
+
old_containers = if service.public_ports.nil? || service.public_ports.empty?
|
11
|
+
target_server.find_containers_by_name(service.name)
|
12
|
+
else
|
13
|
+
target_server.find_containers_by_public_port(service.public_ports.first)
|
14
|
+
end
|
12
15
|
|
13
16
|
info "Stopping container(s): #{old_containers.inspect}"
|
14
17
|
|
data/lib/centurion/deploy_dsl.rb
CHANGED
@@ -75,9 +75,12 @@ module Centurion::DeployDSL
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def public_port_for(port_bindings)
|
78
|
-
#
|
79
|
-
|
80
|
-
|
78
|
+
# port_bindings = [#<struct Centurion::Service::PortBinding
|
79
|
+
# host_port=17090,
|
80
|
+
# container_port=80,
|
81
|
+
# type="tcp",
|
82
|
+
# host_ip=nil>]
|
83
|
+
port_bindings.first.host_port
|
81
84
|
end
|
82
85
|
|
83
86
|
def host_volume(volume, options)
|
@@ -16,7 +16,7 @@ class Centurion::DockerServer
|
|
16
16
|
def_delegators :docker_via_api, :create_container, :inspect_container,
|
17
17
|
:inspect_image, :ps, :start_container, :stop_container,
|
18
18
|
:remove_container, :restart_container
|
19
|
-
def_delegators :docker_via_cli, :pull, :tail, :attach
|
19
|
+
def_delegators :docker_via_cli, :pull, :tail, :attach, :exec
|
20
20
|
|
21
21
|
def initialize(host, docker_path, tls_params = {})
|
22
22
|
@docker_path = docker_path
|
@@ -27,6 +27,10 @@ class Centurion::DockerViaCli
|
|
27
27
|
Centurion::Shell.echo(build_command(:attach, container_id))
|
28
28
|
end
|
29
29
|
|
30
|
+
def exec(container_id, commandline)
|
31
|
+
Centurion::Shell.echo(build_command(:exec, "#{container_id} #{commandline}"))
|
32
|
+
end
|
33
|
+
|
30
34
|
private
|
31
35
|
|
32
36
|
def self.tls_keys
|
@@ -61,6 +65,7 @@ class Centurion::DockerViaCli
|
|
61
65
|
when :pull then ' pull '
|
62
66
|
when :logs then ' logs -f '
|
63
67
|
when :attach then ' attach '
|
68
|
+
when :exec then ' exec '
|
64
69
|
end
|
65
70
|
command << destination
|
66
71
|
command
|
data/lib/centurion/version.rb
CHANGED
data/spec/deploy_spec.rb
CHANGED
@@ -120,11 +120,25 @@ describe Centurion::Deploy do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
describe '#stop_containers' do
|
123
|
-
it 'calls stop_container on the right containers' do
|
123
|
+
it 'calls stop_container on the right containers when ports are mapped' do
|
124
124
|
service = Centurion::Service.new(:centurion)
|
125
125
|
service.add_port_bindings(80, 80)
|
126
126
|
|
127
|
+
second_container = container.dup.tap { |c| c['Id'] = c['Id'].sub(/49494/, '55555') }
|
128
|
+
containers = [ container, second_container ]
|
129
|
+
|
130
|
+
expect(server).to receive(:find_containers_by_public_port).with(80).and_return(containers)
|
131
|
+
expect(server).to receive(:stop_container).with(container['Id'], 30).once
|
132
|
+
expect(server).to receive(:stop_container).with(second_container['Id'], 30).once
|
133
|
+
|
134
|
+
test_deploy.stop_containers(server, service)
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'calls stop_container on the right containers when ports are not mapped' do
|
138
|
+
service = Centurion::Service.new(:centurion)
|
139
|
+
|
127
140
|
second_container = container.dup
|
141
|
+
second_container = container.dup.tap { |c| c['Id'] = c['Id'].sub(/49494/, '55555') }
|
128
142
|
containers = [ container, second_container ]
|
129
143
|
|
130
144
|
expect(server).to receive(:find_containers_by_name).with(:centurion).and_return(containers)
|
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.4
|
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-
|
23
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: trollop
|