sshkit-backend-docker 0.1.1 → 0.1.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/sshkit/backend/docker.rb +10 -12
- data/lib/sshkit/backend/docker/version.rb +1 -1
- data/lib/sshkit/docker_host_ext.rb +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e89f20ce4b32f28e675301f83427854cfaf60ed9
|
|
4
|
+
data.tar.gz: 971ea2e3471ca9e52715b163488b34a1c4251597
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d5b5f9f9c0059ebf5637b4d9aa9d96e5193a2a7a123f1145a4fab0427380ca2a0d63f9ab3ddfd776a88ce7d5c74f40300d218f72c5ec6a716c5b523eb95f88d
|
|
7
|
+
data.tar.gz: 953a0c6c6c17f820836b8f4931f04fe94aca40fc8a7ea263cbd94f04d828da0c5070f0166b5c531787edc862e1ed5a89121fab5b252c1405b8eb8bcd956beebd
|
|
@@ -16,16 +16,8 @@ module SSHKit
|
|
|
16
16
|
CONTAINER_WAIT_IO = {}
|
|
17
17
|
attr_accessor :docker_open_stdin
|
|
18
18
|
|
|
19
|
-
def self.
|
|
20
|
-
|
|
21
|
-
key.delete :container
|
|
22
|
-
key.delete :commit
|
|
23
|
-
key
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def self.find_cntainer_by_host(host)
|
|
27
|
-
host.docker_options[:container] ||
|
|
28
|
-
CONTAINER_MAP[host_container_map_key(host)]
|
|
19
|
+
def self.find_container_by_host(host)
|
|
20
|
+
host.docker_options[:container] || CONTAINER_MAP[host.docker_host_id]
|
|
29
21
|
end
|
|
30
22
|
|
|
31
23
|
def initialize(host, &block)
|
|
@@ -41,6 +33,9 @@ module SSHKit
|
|
|
41
33
|
@container = docker_run_image
|
|
42
34
|
host.hostname.chop! << ", container: #{@container})"
|
|
43
35
|
end
|
|
36
|
+
if host.respond_to? :roles_array
|
|
37
|
+
host.hostname.chop! << ", roles: #{host.roles_array.inspect})"
|
|
38
|
+
end
|
|
44
39
|
@container
|
|
45
40
|
end
|
|
46
41
|
|
|
@@ -108,15 +103,18 @@ module SSHKit
|
|
|
108
103
|
|
|
109
104
|
if host.is_a?(String)
|
|
110
105
|
image_name = host
|
|
106
|
+
host_id = host.__id__
|
|
111
107
|
host = _deep_dup(self.host)
|
|
112
108
|
host.docker_options[:image] = image_name
|
|
109
|
+
host.docker_host_id = host_id
|
|
113
110
|
elsif host.is_a?(Hash)
|
|
114
111
|
d_opts = host
|
|
115
112
|
host = _deep_dup(self.host)
|
|
116
113
|
host.docker_options = d_opts.symbolize_keys
|
|
114
|
+
host.docker_host_id = d_opts.__id__
|
|
117
115
|
end
|
|
118
116
|
|
|
119
|
-
map_key =
|
|
117
|
+
map_key = host.docker_host_id
|
|
120
118
|
CONTAINER_MAP[map_key] and
|
|
121
119
|
return CONTAINER_MAP[map_key]
|
|
122
120
|
|
|
@@ -166,7 +164,7 @@ module SSHKit
|
|
|
166
164
|
|
|
167
165
|
host.docker_options[:commit] or return
|
|
168
166
|
|
|
169
|
-
container = self.class.
|
|
167
|
+
container = self.class.find_container_by_host(host) or
|
|
170
168
|
raise "Cannot find container for host #{host.inspect}"
|
|
171
169
|
|
|
172
170
|
cmd = %w(docker commit)
|
|
@@ -2,6 +2,7 @@ require 'sshkit'
|
|
|
2
2
|
module SSHKit
|
|
3
3
|
class Host
|
|
4
4
|
attr_writer :docker_options
|
|
5
|
+
attr_accessor :docker_host_id
|
|
5
6
|
|
|
6
7
|
def docker?
|
|
7
8
|
!docker_options.empty?
|
|
@@ -12,8 +13,10 @@ module SSHKit
|
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def docker=(hash)
|
|
16
|
+
@docker_host_id = hash.__id__
|
|
15
17
|
@hostname = "(docker "
|
|
16
18
|
@user ||= 'root'
|
|
19
|
+
@port = @docker_host_id # Use hash id to ident host by injecting to port
|
|
17
20
|
docker_options.update hash.symbolize_keys
|
|
18
21
|
if docker_options.has_key?(:image)
|
|
19
22
|
@hostname << "image: #{@docker_options[:image]})"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sshkit-backend-docker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tatsuki Sugiura
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sshkit
|
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
114
114
|
version: '0'
|
|
115
115
|
requirements: []
|
|
116
116
|
rubyforge_project:
|
|
117
|
-
rubygems_version: 2.5.
|
|
117
|
+
rubygems_version: 2.5.2
|
|
118
118
|
signing_key:
|
|
119
119
|
specification_version: 4
|
|
120
120
|
summary: Docker connector backend for SSHKit
|