moby-derp 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moby_derp/container.rb +1 -0
- data/lib/moby_derp/container_config.rb +5 -1
- data/lib/moby_derp/pod.rb +4 -0
- data/lib/moby_derp/pod_config.rb +10 -5
- data/smoke_tests/exposed.bats +28 -0
- data/smoke_tests/test_helper.bash +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c2c89cac1b196c48dc2c2183367d61578b1e4e1bae1ff7d698dd7ef6c23cb5
|
4
|
+
data.tar.gz: c7b83663a971a01f3e8b5e8a5420b12b6192d207107ce1cd3047539644051f3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34c40eb8d1d8cfa668a3048c6a8ceaf231c4fae6a607d389bf073d3a3874a74a10a31e728c0c322476a154c9c425fd92869d0fb5849707c1dee2b4c0970f15af
|
7
|
+
data.tar.gz: 01d15f3f197b48fe5748f27718a8e8c7035ff0713113742bf1ae7a43a480197ab7a97559e4ae19fbec8ca5711d22ebd38f02865194e9ce73a817b11a0899bf9a
|
data/lib/moby_derp/container.rb
CHANGED
@@ -3,6 +3,7 @@ require_relative "./error"
|
|
3
3
|
require_relative "./mount"
|
4
4
|
|
5
5
|
require "docker-api"
|
6
|
+
require "shellwords"
|
6
7
|
|
7
8
|
module MobyDerp
|
8
9
|
class ContainerConfig
|
@@ -66,7 +67,10 @@ module MobyDerp
|
|
66
67
|
def validate_command
|
67
68
|
case @command
|
68
69
|
when String
|
69
|
-
|
70
|
+
# Despite the Docker Engine API spec saying you can pass a string,
|
71
|
+
# if you do it doesn't get parsed into arguments... so that's pretty
|
72
|
+
# fucking useless.
|
73
|
+
@command = Shellwords.split(@command)
|
70
74
|
when Array
|
71
75
|
unless @command.all? { |c| String === c }
|
72
76
|
raise ConfigurationError, "all elements of the command array must be strings"
|
data/lib/moby_derp/pod.rb
CHANGED
data/lib/moby_derp/pod_config.rb
CHANGED
@@ -21,8 +21,8 @@ module MobyDerp
|
|
21
21
|
:publish,
|
22
22
|
:publish_all,
|
23
23
|
:mount_root,
|
24
|
-
|
25
|
-
|
24
|
+
:system_config,
|
25
|
+
:logger
|
26
26
|
|
27
27
|
def initialize(filename, system_config)
|
28
28
|
@logger = system_config.logger
|
@@ -181,18 +181,23 @@ module MobyDerp
|
|
181
181
|
"expose must be an array"
|
182
182
|
end
|
183
183
|
|
184
|
-
@expose.map!
|
185
|
-
|
186
|
-
@expose.each do |e|
|
184
|
+
@expose.map! do |e|
|
185
|
+
e = e.to_s
|
187
186
|
unless e.is_a?(String) && e =~ %r{\A\d+(/(tcp|udp))?\z}
|
188
187
|
raise ConfigurationError,
|
189
188
|
"exposed ports must be integers, with an optional protocol specifier (got #{e.inspect})"
|
190
189
|
end
|
191
190
|
|
191
|
+
if $1.nil?
|
192
|
+
e += "/tcp"
|
193
|
+
end
|
194
|
+
|
192
195
|
if e.to_i < 1 || e.to_i > 65535
|
193
196
|
raise ConfigurationError,
|
194
197
|
"exposed port #{e} is out of range (expected 1-65535)"
|
195
198
|
end
|
199
|
+
|
200
|
+
e
|
196
201
|
end
|
197
202
|
end
|
198
203
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
load test_helper
|
2
|
+
|
3
|
+
@test "Exposed ports" {
|
4
|
+
config_file <<-'EOF'
|
5
|
+
expose:
|
6
|
+
- 80
|
7
|
+
- "53/udp"
|
8
|
+
containers:
|
9
|
+
bob:
|
10
|
+
image: busybox:latest
|
11
|
+
command: sleep 600
|
12
|
+
common_labels:
|
13
|
+
moby-derp-smoke-test: ayup
|
14
|
+
EOF
|
15
|
+
|
16
|
+
run $MOBY_DERP_BIN $TEST_CONFIG_FILE
|
17
|
+
|
18
|
+
echo "status: $status"
|
19
|
+
echo "output: $output"
|
20
|
+
|
21
|
+
[ "$status" = "0" ]
|
22
|
+
container_running "mdst"
|
23
|
+
container_running "mdst.bob"
|
24
|
+
|
25
|
+
docker inspect mdst --format='{{.Config.ExposedPorts}}'
|
26
|
+
docker inspect mdst --format='{{.Config.ExposedPorts}}' | grep 'map.*53/udp:{}'
|
27
|
+
docker inspect mdst --format='{{.Config.ExposedPorts}}' | grep 'map.*80/tcp:{}'
|
28
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moby-derp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/moby_derp/pod_config.rb
|
221
221
|
- lib/moby_derp/system_config.rb
|
222
222
|
- moby-derp.gemspec
|
223
|
+
- smoke_tests/exposed.bats
|
223
224
|
- smoke_tests/minimal.bats
|
224
225
|
- smoke_tests/no_file.bats
|
225
226
|
- smoke_tests/test_helper.bash
|