vagrant-docker-mirror-config 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 383ec167dd125a14982c8202369009c7142831d9
|
4
|
+
data.tar.gz: 24e5fe8212625785a4dafa3a59de7badc62ef734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b76b1314bc2611f458a3a8a5ca5a79f16a9c207d06e7ef30d00e19a1bf41e66d8969148830b3dcc4509ef31a5af74989a8e4fd541d0dea14e6cfece460febc9b
|
7
|
+
data.tar.gz: 401f701f3f5abc48c380653b5a6df663fd58fedfd126cd3c2a7303e4988a99e689b85729c38b216170bc47dd789ffb3b37a1236c84076884d05cb725a3131efe
|
@@ -12,16 +12,21 @@ module VagrantPlugins
|
|
12
12
|
|
13
13
|
def configure
|
14
14
|
@machine.communicate.tap do |comm|
|
15
|
-
|
16
|
-
|
17
|
-
json
|
15
|
+
json = nil
|
16
|
+
if comm.test("test -f /etc/docker/daemon.json", { :sudo => true })
|
17
|
+
comm.sudo("cat /etc/docker/daemon.json", { :shell => "/bin/sh" }) do |type, data|
|
18
|
+
json = JSON.parse(data)
|
19
|
+
end
|
18
20
|
else
|
19
21
|
json = {}
|
20
22
|
end
|
23
|
+
registryMirror = "#{@config.scheme}://#{@config.host}:#{@config.port}"
|
24
|
+
insecureHost= "#{@config.host}:#{@config.port}"
|
25
|
+
|
21
26
|
json["registry-mirrors"] = [] if not json['registry-mirrors']
|
22
|
-
json["registry-mirrors"].insert(0, "#{@config.scheme}://#{@config.host}:#{@config.port}")
|
27
|
+
json["registry-mirrors"].insert(0, "#{@config.scheme}://#{@config.host}:#{@config.port}") if not json["registry-mirrors"].include? registryMirror
|
23
28
|
json["insecure-registries"] = [] if not json['insecure-registries'] && @config.insecure
|
24
|
-
json["insecure-registries"].insert(0, "#{@config.host}:#{@config.port}") if @config.insecure
|
29
|
+
json["insecure-registries"].insert(0, "#{@config.host}:#{@config.port}") if @config.insecure if not json["insecure-registries"].include? insecureHost
|
25
30
|
File.open("/tmp/daemon.json", 'w') { |file| file.write(JSON.pretty_generate(json)) }
|
26
31
|
comm.upload("/tmp/daemon.json", "/tmp/daemon.json")
|
27
32
|
comm.sudo("mv /tmp/daemon.json /etc/docker/daemon.json")
|