hyperdock 0.17.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyperdock/resource/container.rb +35 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eadebb2c8c8687e53e78bcfea870323b5f439816
|
4
|
+
data.tar.gz: d7d9a58cac8f941cc409c62ebebc02800ee77be2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66fdfab3468bf520587f966e878eb10fd55c879a0508a312546c2067a2a2b6881fe562a0961379750191f67c68f372ca149d0d8458d937d175f7241e307833e0
|
7
|
+
data.tar.gz: c6b360a7e348a953efd79df830993152ebfb7384ca6eb42529ead6c4af994ab24a0aca5ea46dcf31e5dfe5bea6bf959646e3586cd0a806351c47ea2cf3e869f9
|
@@ -19,32 +19,50 @@ module HyperDock
|
|
19
19
|
false
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
def attributes
|
23
|
+
@attributes ||= container.info
|
24
|
+
end
|
25
|
+
|
26
|
+
Contract None => Hash
|
23
27
|
def networks
|
24
|
-
@networks ||=
|
25
|
-
.values
|
26
|
-
.map { |network| network['NetworkID'] }
|
27
|
-
.compact
|
28
|
-
.map { |network| { href: "/network/#{network}" } }
|
28
|
+
@networks ||= attributes.dig('NetworkSettings', 'Networks') || {}
|
29
29
|
end
|
30
30
|
|
31
|
+
Contract None => ArrayOf[Hash]
|
32
|
+
def network_links
|
33
|
+
@network_links ||= networks.flat_map do |name, network|
|
34
|
+
{ name: name, href: "/network/#{network['NetworkID']}" }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Contract None => ArrayOf[Hash]
|
31
39
|
def volumes
|
32
|
-
@volumes ||=
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
@volumes ||= attributes.fetch('Mounts') { [] }
|
41
|
+
end
|
42
|
+
|
43
|
+
Contract None => ArrayOf[Hash]
|
44
|
+
def volume_links
|
45
|
+
@volume_links ||= volumes.map do |volume|
|
46
|
+
{ name: volume['Destination'], href: "/volume/#{volume['Name']}" }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def named_links
|
51
|
+
@named_links ||= [
|
52
|
+
network_links
|
53
|
+
.map { |network| { "network:#{network[:name]}" => network } },
|
54
|
+
volume_links
|
55
|
+
.map { |volume| { "volume:#{volume[:name]}" => volume } }
|
56
|
+
].flatten.reduce(&:merge)
|
36
57
|
end
|
37
58
|
|
59
|
+
Contract None => HashOf[RespondTo[:to_s], Or[Hash, ArrayOf[Hash]]]
|
38
60
|
def links
|
39
61
|
@links ||= {
|
40
|
-
networks:
|
41
|
-
volumes:
|
62
|
+
networks: network_links,
|
63
|
+
volumes: volume_links,
|
42
64
|
ports: { href: "/#{request.disp_path}/ports" }
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
def attributes
|
47
|
-
{ info: container.info }
|
65
|
+
}.merge(named_links)
|
48
66
|
end
|
49
67
|
end
|
50
68
|
end
|