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: cb9676f204982f48a8ab97b94d7f1d894511a37e
4
- data.tar.gz: 0e007f58482d2f0f0cca433ee39cb250ae1eb619
3
+ metadata.gz: 383ec167dd125a14982c8202369009c7142831d9
4
+ data.tar.gz: 24e5fe8212625785a4dafa3a59de7badc62ef734
5
5
  SHA512:
6
- metadata.gz: ef68793aa622a1eaf5532faed2c20857aab7c0d84aa8e678af9556489a5cde0dc1f958ba0c607ec7febb3c5f61f7ff6ea2bd6f365b6cfb5400620cf551d4e6e2
7
- data.tar.gz: 5163a581ba02be45c2e7bb6c0354147ea119e5800455c835baf71a8582a65d3c5acb4b93957f111148ee460fd1444616996e901f70254d580efd4ab5a5db202d
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
- if comm.test("cat /etc/docker/daemon.json 2>&1")
16
- json = comm.sudo("cat /etc/docker/daemon.json 2>&1")
17
- json = json.parse(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")
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module DockerMirrorConfigProvisioner
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-docker-mirror-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoffrey Ragot