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 +4 -4
- data/lib/limepie-docker-host/docker_host.rb +32 -0
- data/lib/limepie-docker-host/version.rb +1 -1
- 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: cbf9b053ecb0692c4049504269411b2041e3d33a
|
4
|
+
data.tar.gz: 21d84602afca58fc4166df9945f6406065149b69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|