Added changes to accept discovery/api server IP or dns name

This patch add appropriate changes to support either IP address or dns name for
 discovery or api server.
It copied dns_resolve function from puppet-rjil to avoid dependancy on it.