centurion 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTORS.md +4 -0
- data/lib/centurion/deploy_dsl.rb +5 -4
- data/lib/centurion/version.rb +1 -1
- data/spec/deploy_dsl_spec.rb +11 -0
- metadata +1 -1
data/CONTRIBUTORS.md
CHANGED
@@ -9,6 +9,8 @@ Your name could be here!
|
|
9
9
|
* [Tom Dooner][tdooner]
|
10
10
|
* [Jonathan Chauncey][jchauncey]
|
11
11
|
* [Matt Sanford][mzsanford]
|
12
|
+
* [Suren Karapetyan][skarap]
|
13
|
+
* [Jon Wood][jellybob]
|
12
14
|
|
13
15
|
Pre-release
|
14
16
|
-----------
|
@@ -67,3 +69,5 @@ Contributor | Commits | Additions | Deletio
|
|
67
69
|
[tdooner]: https://github.com/tdooner
|
68
70
|
[jchauncey]: https://github.com/jchauncey
|
69
71
|
[mzsanford]: https://github.com/mzsanford
|
72
|
+
[skarap]: https://github.com/skarap
|
73
|
+
[jellybob]: https://github.com/jellybob
|
data/lib/centurion/deploy_dsl.rb
CHANGED
@@ -38,7 +38,7 @@ module Centurion::DeployDSL
|
|
38
38
|
require_options_keys(options, [ :container_port ])
|
39
39
|
|
40
40
|
add_to_bindings(
|
41
|
-
options[:host_ip]
|
41
|
+
options[:host_ip],
|
42
42
|
options[:container_port],
|
43
43
|
port,
|
44
44
|
options[:type] || 'tcp'
|
@@ -79,9 +79,10 @@ module Centurion::DeployDSL
|
|
79
79
|
|
80
80
|
def add_to_bindings(host_ip, container_port, port, type='tcp')
|
81
81
|
set(:port_bindings, fetch(:port_bindings, {}).tap do |bindings|
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
binding = { 'HostPort' => port.to_s }.tap do |b|
|
83
|
+
b['HostIp'] = host_ip if host_ip
|
84
|
+
end
|
85
|
+
bindings["#{container_port.to_s}/#{type}"] = [ binding ]
|
85
86
|
bindings
|
86
87
|
end)
|
87
88
|
end
|
data/lib/centurion/version.rb
CHANGED
data/spec/deploy_dsl_spec.rb
CHANGED
@@ -71,6 +71,17 @@ describe Centurion::DeployDSL do
|
|
71
71
|
DeployDSLTest.set(:port_bindings, dummy_value)
|
72
72
|
DeployDSLTest.host_port(999, container_port: 80)
|
73
73
|
|
74
|
+
expect(DeployDSLTest).to have_key_and_value(
|
75
|
+
:port_bindings,
|
76
|
+
dummy_value.merge('80/tcp' => [{ 'HostPort' => '999' }])
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'adds new bind ports to the list with an IP binding when supplied' do
|
81
|
+
dummy_value = { '666/tcp' => ['value'] }
|
82
|
+
DeployDSLTest.set(:port_bindings, dummy_value)
|
83
|
+
DeployDSLTest.host_port(999, container_port: 80, host_ip: '0.0.0.0')
|
84
|
+
|
74
85
|
expect(DeployDSLTest).to have_key_and_value(
|
75
86
|
:port_bindings,
|
76
87
|
dummy_value.merge('80/tcp' => [{ 'HostIp' => '0.0.0.0', 'HostPort' => '999' }])
|