longshoreman 0.0.3 → 0.0.5
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/longshoreman/container.rb +18 -11
- 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: 7b6b000b8424b8b5ee43ef4a38b908bd79773d5f
|
4
|
+
data.tar.gz: 87aff00311d535ad90f4091623db27df3c84ede8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7907574c4e9e52f9dc40a0fea7993e727dc4524c3c8a26c9bdce3b316cbafd77cbfe2cf254f55379a969416ff3751febd8c81f2d80c1ceb671da9851bae95ec3
|
7
|
+
data.tar.gz: a2a08af51c8347c1c95a676bebbdb540b0bd2b9e2cab763bbd9ea0af4965b7e495068bd4a5e6295285f04e7f4dc0ab43ca6efe38b436547a9dc1d93810b80c67
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Longshoreman::Container
|
2
|
-
|
2
|
+
|
3
3
|
def initialize(image = nil, name = nil, extra_args = {})
|
4
4
|
if image && name
|
5
5
|
create(image, name, extra_args)
|
@@ -57,15 +57,7 @@ class Longshoreman::Container
|
|
57
57
|
def get(id, opts = {})
|
58
58
|
@raw = Docker::Container.get(id, opts)
|
59
59
|
end
|
60
|
-
|
61
|
-
# Return the randomized port number associated with the exposed port.
|
62
|
-
def rport(exposed_port, protocol="tcp")
|
63
|
-
# Get all mapped ports
|
64
|
-
ports = @raw.json["NetworkSettings"]["Ports"]
|
65
|
-
# We're going to expect 1:1 mapping here
|
66
|
-
ports["#{exposed_port.to_s}/#{protocol}"][0]["HostPort"].to_i
|
67
|
-
end
|
68
|
-
|
60
|
+
|
69
61
|
def id
|
70
62
|
@raw.id
|
71
63
|
end
|
@@ -75,6 +67,14 @@ class Longshoreman::Container
|
|
75
67
|
end
|
76
68
|
alias_method :delete, :remove
|
77
69
|
|
70
|
+
# Return the randomized port number associated with the exposed port.
|
71
|
+
def rport(exposed_port, protocol="tcp")
|
72
|
+
# Get all mapped ports
|
73
|
+
ports = @raw.json["NetworkSettings"]["Ports"]
|
74
|
+
# We're going to expect 1:1 mapping here
|
75
|
+
ports["#{exposed_port.to_s}/#{protocol}"][0]["HostPort"].to_i
|
76
|
+
end
|
77
|
+
|
78
78
|
def start
|
79
79
|
@raw.start
|
80
80
|
end
|
@@ -83,6 +83,13 @@ class Longshoreman::Container
|
|
83
83
|
@raw.stop
|
84
84
|
end
|
85
85
|
|
86
|
-
|
86
|
+
def network_delay(ms)
|
87
|
+
@raw.exec(['tc', 'qdisc', 'add', 'dev', 'eth0', 'root', 'netem', 'delay', '#{ms}ms'])
|
88
|
+
end
|
87
89
|
|
90
|
+
def remove_network_delay
|
91
|
+
@raw.exec(['tc', 'qdisc', 'del', 'dev', 'eth0', 'root', 'netem'])
|
92
|
+
end
|
93
|
+
|
94
|
+
attr_accessor :raw
|
88
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: longshoreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Mildenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|