limepie-docker-host 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48066fb065af9055e46e9e33f8ed106c1ca4551f
4
- data.tar.gz: d742d83419304a9a88f9e909505a86cc21ae5d34
3
+ metadata.gz: cbf9b053ecb0692c4049504269411b2041e3d33a
4
+ data.tar.gz: 21d84602afca58fc4166df9945f6406065149b69
5
5
  SHA512:
6
- metadata.gz: 60721b6c024937be075d34919b9692c805b90a2a531955c51c78ae5591d9ed963d1277a4847e700c20517ee24a01ebe493a46972e3885acbbd91c2a3c3d9ab70
7
- data.tar.gz: fdea6c12ed6a2fd2885c6f74c8afce17d55c3c10f6c9d292a1c3caab4d07e782e5d28a420846dc522233b93a75effbea4d4d4baec8eca667f591a88732bf8542
6
+ metadata.gz: b3d748e52023475971c5b6ef78e575e9927d5806cb253f10fff8fbfcb830512bc48be1ba5c0604e641ca8fab0ee9cf4cd73637fdd902a9c50cdc6859e5c0924c
7
+ data.tar.gz: 0e752ebc2aca9171fa1be4f4d177982a65ddb50f88b59fc5c3ccfeb62c5f5db12a7ab5f8f770ee607bce90462431bd7caa0fde86fa42148699d21fd204191388
@@ -20,6 +20,7 @@ module VagrantPlugins
20
20
  end
21
21
 
22
22
  def addHostEntries
23
+ removeHost
23
24
  removeHostEntries
24
25
  host = []
25
26
  uuid = @machine.id || @machine.config.hostsupdater.id
@@ -86,7 +87,38 @@ module VagrantPlugins
86
87
  end
87
88
  end
88
89
 
90
+ def removeHost
91
+ components = []
92
+ components << "docker network inspect --format '{{range .IPAM.Config}}{{.Subnet}}{{end}}' share_default"
93
+ command = components.join(" ")
94
+
95
+ @machine.communicate.sudo(command) do |type, data|
96
+
97
+ tmp = data.split('.', 3)
98
+ tmp.delete_at(2);
99
+ uuid = tmp.join(".");
100
+
101
+ if !File.writable_real?(@@hosts_path)
102
+ if !sudo(%Q(sed -i -e '/#{uuid}/ d' #@@hosts_path))
103
+ @ui.error "[vagrant-hostsupdater] Failed to remove hosts, could not use sudo"
104
+ adviseOnSudo
105
+ end
106
+ else
107
+ hosts = ""
108
+ File.open(@@hosts_path).each do |line|
109
+ hosts << line unless line.include?(uuid)
110
+ end
111
+ hostsFile = File.open(@@hosts_path, "w")
112
+ hostsFile.write(hosts)
113
+ hostsFile.close()
114
+ end
115
+
116
+ #handle_comm(type, data)
117
+ end
118
+ end
119
+
89
120
  def removeHostEntries(options = {})
121
+
90
122
  uuid = @machine.id || @machine.config.hostsupdater.id
91
123
 
92
124
  if !File.writable_real?(@@hosts_path)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module DockerHostProvisioner
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: limepie-docker-host
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yejune