vagrant-dnsdock-hostupdater 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/host-manager.rb +31 -16
- data/lib/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: aa90639855cf134d5b9dbd02ab45a53fae9d6952
|
4
|
+
data.tar.gz: 0267f2fee7cc93cce385a256bab7e4153f53f1ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d30d0032da17b0ec47b3eaa38c27718d6683b078b5f3245482830e0994c829f7aac3a4648ddfc0a35e7672a4f0f73d9a1084558c64884c2c2e94793c0fdb890
|
7
|
+
data.tar.gz: 7bba31f86f5f0e0ca5e5da72cedcc0fdad07c26bd0161213f2adde3ca553c8d43af844651107903aff97d3c7bd92f70ecd4ec233485d47d0aba317eb89c35d8c
|
data/lib/host-manager.rb
CHANGED
@@ -90,7 +90,7 @@ module HostManager
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
execute(data['action'], data['hostname'], data['ip'], data['containerId'])
|
93
|
-
|
93
|
+
|
94
94
|
elsif data.is_a?(Array)
|
95
95
|
hosts = get_hosts
|
96
96
|
|
@@ -104,13 +104,18 @@ module HostManager
|
|
104
104
|
|
105
105
|
# add recieved entries
|
106
106
|
data.each do |entry|
|
107
|
-
|
107
|
+
comment = HostManager.comment_prefix + (entry['containerId'] ? " Container ID: #{entry['containerId']}" : '')
|
108
|
+
|
109
|
+
hosts.elements << Hosts::Entry.new(entry['ip'], entry['hostname'], :comment => comment)
|
110
|
+
hosts.write
|
108
111
|
end
|
109
112
|
|
113
|
+
hosts.write
|
114
|
+
|
110
115
|
end
|
111
|
-
|
116
|
+
|
112
117
|
end
|
113
|
-
|
118
|
+
|
114
119
|
rescue => e
|
115
120
|
log.error("Caught exception attempting to execute with data #{content}. #{e}")
|
116
121
|
end
|
@@ -207,21 +212,31 @@ module HostManager
|
|
207
212
|
|
208
213
|
def sync_hosts(container_data)
|
209
214
|
data = []
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
215
|
+
|
216
|
+
if container_data && container_data.is_a?(Array)
|
217
|
+
container_data.each do |container_info|
|
218
|
+
container = Docker::Container.get(container_info.info['id'])
|
219
|
+
|
220
|
+
if container.info['State']['Running']
|
221
|
+
name = container.info['Name']
|
222
|
+
if name
|
223
|
+
ip = container.info['NetworkSettings']['IPAddress']
|
224
|
+
|
225
|
+
if ip
|
226
|
+
item = {
|
227
|
+
:hostname => host_name(name),
|
228
|
+
:ip => ip,
|
229
|
+
:containerId => container.info['id']
|
230
|
+
}
|
231
|
+
|
232
|
+
data.push(item)
|
233
|
+
end
|
234
|
+
end
|
222
235
|
end
|
236
|
+
|
223
237
|
end
|
224
238
|
|
239
|
+
send(data)
|
225
240
|
end
|
226
241
|
end
|
227
242
|
|
data/lib/version.rb
CHANGED