Class: VagrantDns::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_dns/middleware/network_binder.rb

Instance Method Summary collapse

Instance Method Details

#report(host, ip, status) ⇒ Object

if socket is created on middleware initialization vagrant will get stuck



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vagrant_dns/middleware/network_binder.rb', line 31

def report(host,ip,status)
	url = CONF.get('zmq_url')
	if(port_open?('localhost',url.split(':')[-1]))
	  context = ZMQ::Context.new
	  pub = context.socket(ZMQ::PUB)
	  pub.connect(url)
	  UI.say(:debug,"connection made")
	  pub.send("#{CHANNEL} #{host} #{ip} #{status.to_s}", ZMQ::NOBLOCK)
	  UI.say(:info,"notifying dns server with #{status} status")
	  pub.close
	else
	  UI.say(:debug,"dns server isn't up, skiping notifying #{status} status") 
	end
end